-
Notifications
You must be signed in to change notification settings - Fork 3
Translation, reverse translation, and cross translation
var translations = Resolver("translations"), _ = translations._;
_(key,params)
_({ key:key },params)
_({ key:key, context:context },params)
_({ phrase:phrase },params)
Call this to get the translated sentence for the current locale. Parameters will be substituted in the sentence if referenced. To substitute parameters the signature of reference must be defined. That is done when loading the translations. Refer to setKeysForLocale.
Translations can be overridden by context which allow a fallback mechanism.
translations.setKeysForLocale(locale,context,keys,BucketGenerator)
Call this to add translations (by key) within a context.
The default context value is null.
Pass a bucket generator to create the objects that hold the translations for a particular key. Entries will be set on it for each of the supported locales. In most cases just one.
In addition the bucket object can provide a begin and end property. These are then used to match parameters in the translated sentence. It is a good idea to set these using the prototype rather than setting them on the instance as it is then duplicated for every translation.
TODO locale=null means default TODO phrase or key for regular translate call. TODO setPhraseForLocale TODO reverseTranslate
_(key,params)
_({ key:key },params)
_({ key:key, context:context },params)
_({ phrase:phrase },params)