martinandert / counterpart

A translation and localization library for Node.js and the browser.
MIT License
242 stars 25 forks source link

Fallback mechanism automatically searching a default resource file? #16

Closed shev72 closed 9 years ago

shev72 commented 9 years ago

The fallback mechanism requires the default parameter to be supplied on each call. It would be nice if we a method could be added which would look up a default translation file if the translation did not exist. In many cases we are happy if the english translation (or another default language) is provided if the translation does not exist in the language. it is cumbersome to have to supply the default param each time.

shev72 commented 9 years ago

Actually I see that this may have been implemented in saknarat't fork already, , would be nice if it could be merged in to the core.

martinandert commented 9 years ago

You could use the (currently undocumented) setFallbackLocale function to use as fallback mechanism.

This is available since v0.16.5 and was introduced in 38d575bae.