1.0.2 • Published 7 years ago

flowchat-map-i18n v1.0.2

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

flowchat-map-i18n

i18n output mapping for Flowchat

Getting started

Install

$ npm install --save flowchat-map-i18n

or

$ yarn add flowchat-map-i18n

Usage

app.js

import { Flowchat } from 'flowchat';
const FlowchatMapI18n = require('./flowchat-map-i18n.js');

const i18nMap = new FlowchatMapI18n();

i18nMap.configure({
    locales:['en', 'pl'],
    defaultLocale: 'en',
    directory: __dirname + '/../locales'
});

const bot = new Flowchat();

bot.output
  .map(i18nMap.output())
  .subscribe(({ data, sessionId }) => {
    console.log(data);
  });

flows/helloI18n.js

import { send } from 'flowchat';

// const activator ...
// const reducer ...

const saga = function* (input, state, sessionId) {
  yield send({ i18n: { phrase: 'hello', locale: state.locale } }, sessionId);
}
1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago

0.3.2

7 years ago

0.3.1

7 years ago

0.2.1

7 years ago

0.1.0

7 years ago