Rosetty
Complete Intl/I18n solution for browser and node. Old Owner: @flexper
Usage
const { rosetty } = require('rosetty');
const { enGB } = require('date-fns/locale');
const r = rosetty(
{
en: {
dict: {
test: 'This is a test',
},
locale: enGB,
},
},
'en'
);
console.log(r.t('test'));
API
rosetty(config, defaultLang?)
Options
Field Name | Type | Description |
---|
config | Record<string, Language> | Specify dictionnary and locale to use for each lang |
defaultLang | string? | Specify default language to use (should be the same as config) |
translateFallback | boolean? | Return fallback if translation is not defined |
Return
WARNING FOR LOCALE !
You need to import locale from date-fns
package.
const { enGB } = require('date-fns/locale');
Maintain
This package use TSdx. Please check documentation to update this package.