Skip to content

Ideas for an i18n module

Aaike Van Roekeghem edited this page Mar 4, 2015 · 13 revisions

Lets gather here some ideas how we'd like to structure an I18N module for use in Aurelia. Just add your thoughts down here and try to categorize them. Also add different options if you can think of them

General Development

  • Use an existing module (e.g. i18next.com)
  • Custom module but built using small helper modules (e.g. MomentJS for Dates, Intl. API for Number/Date formats)
  • Custom, everything done by ourselves

Area of use

  • independent ES6 module, also to be used outside of Aurelia (e.g. I18N-Core)
  • Separate Plugin to work with I18N-Core (Aurelia-I18N)
  • Pure Aurelia solution

Features

  • translation
  • number formats (separators, etc)
  • dates
  • currency
  • pluralization
  • placeholders --> Hello {name}!
  • Route generation (prefix all routes with the language except the default langauge)
  • User locale detection

Aurelia specific features

  • Translation via code (e.g. i18n.tr('KEY') --> returns translated version)
  • Filters aka ValueConverters for declarative translations
  • Live-switch of current language
  • Default widgets --> e.g. Flag list, DatePicker, Validator ...

Resource location

  • Local files (e.g. JSON, or PO files)
  • Load via Ajax from Backend --> define a specific interface
  • In code setup --> e.g. if you render the translations into the index.html from the backend
  • Resource file bundles
  • Caching of i18n variables to local storage or other means (perhaps a general caching system can be used here, not only for i18n variables ex: aurelia.cache(key,value,lang))

Editing Translations

  • The application can be put in edit mode where editable text will be highlighted and clickable to edit in various languages, maybe similar to createjs using RDFa tags
Clone this wiki locally