-
Notifications
You must be signed in to change notification settings - Fork 2
i18n
Mobile Framework provides an I18n wrapper to help you translate you application modules and Timeline modules.
The i18n module located at /app/infra/i18n.ts loads the locales and all the i18n keys defined in /assets/i18n, and set the application language based on the device settings.
When you have to translate a string in your module, don't use the
i18nnpm package. Use this wrapper instead by usingimport { I18n } from "../infra/i18n";
When you want to display or manage dates and times, don't use the
momentnpm package. Use this wrapper instead by usingimport { moment, IMoment } from "../infra/i18n".
This wrapper ensures you that all translated modules will be configured in the same locale.
I18n keys are not externalized in their own application module or Timeline module yet.
To add a translation key, open in /assets/i18n every language file, and create the key you want.
Try to keep all languages files synchronized : one line number key key across the languages, keys ordered lexically.
Create the appropriate language file in the /assets/i18n folder, and make these alterations in app/infra/i18n.ts :
- Line ~14:
importthe corresponding moment.js locale - Line ~24:
requirethe language file you just created