lion/packages/localize
CircleCI f9ce60c08c chore: release new versions
- @lion/ajax@0.3.0
 - @lion/button@0.6.0
 - @lion/calendar@0.8.0
 - @lion/checkbox-group@0.9.0
 - @lion/choice-input@0.9.0
 - @lion/core@0.6.0
 - @lion/dialog@0.6.0
 - @lion/field@0.13.0
 - @lion/fieldset@0.11.0
 - @lion/form-system@0.8.0
 - @lion/form@0.5.0
 - @lion/helpers@0.4.0
 - @lion/icon@0.5.0
 - @lion/input-amount@0.6.0
 - @lion/input-date@0.6.0
 - @lion/input-datepicker@0.13.0
 - @lion/input-email@0.7.0
 - @lion/input-iban@0.8.0
 - @lion/input-range@0.3.0
 - @lion/input@0.6.0
 - @lion/localize@0.10.0
 - @lion/overlays@0.15.0
 - @lion/radio-group@0.9.0
 - @lion/select-rich@0.17.0
 - @lion/select@0.6.0
 - singleton-manager@1.0.0
 - @lion/steps@0.4.0
 - @lion/switch@0.9.0
 - @lion/tabs@0.3.0
 - @lion/textarea@0.6.0
 - @lion/tooltip@0.10.0
 - @lion/validate@0.10.0
2020-05-18 13:28:30 +00:00
..
docs feat: refrain from using dynamic vars inside dynamic import 2020-03-25 17:02:10 +01:00
src feat: use singleton manager to support nested npm installations 2020-05-18 15:25:21 +02:00
stories feat: refrain from using dynamic vars inside dynamic import 2020-03-25 17:02:10 +01:00
test fix(localization): force TR currency code at the end (#641) 2020-04-29 10:05:06 +02:00
test-helpers fix: public test-helpers 2019-07-30 15:50:53 +02:00
CHANGELOG.md chore: release new versions 2020-05-18 13:28:30 +00:00
index.js fix(input-amount): normalize added for currency label (#618) 2020-03-04 17:33:09 +01:00
package.json chore: release new versions 2020-05-18 13:28:30 +00:00
README.md chore: remove pilot phase header 2020-04-29 10:05:06 +02:00
test-helpers.js fix: public test-helpers 2019-07-30 15:50:53 +02:00

Localize

The localization system helps to manage localization data split into locales and automate its loading.

Live Demo/Documentation

See our storybook for a live demo and documentation

How to use

Installation

npm i --save @lion/localize
import { localize } from '@lion/localize';

Example

Translation data:

// path/to/hello-world/translations/en-GB.js
export default { greeting: 'Hello {name}!', };`

Loading translations:

// path/to/hello-world/HelloWorld.js
localize.loadNamespace({
  'hello-world': locale => {
    return import(`./translations/${locale}.js`);
  },
});

Note: dynamic variables inside dynamic imports may cause problems with tools that do static analysis, and may not work out of the box

Translating messages:

localize.msg('hello-world:greeting', { name: 'John' });
// Hello John!