Releases: i18next/i18next-scanner
Releases · i18next/i18next-scanner
v1.2.0
#28 - Adds support for parsing Context & Plural syntax
Options
- Adds pluralSeparator option
- Adds contextSeparator option
API
class Parser {
// @param {string} key The translation key
// @param {object} [options] The options object
// @param {string} [options.defaultValue] defaultValue to return if translation not found
// @param {number} [options.count] count value used for plurals
// @param {string} [options.context] used for contexts (eg. male)
set(key, options) {
}
}
v1.1.0
Fixes issue #27 - Disabiling nsSeparator breaks the defaultValue fallback
Now the defaultValue option can either be a string or a function. For example:
- Provides the default value with a string
{
defaultValue: '__NOT_TRANSLATED__'
}
- Provides the default value as a callback function
{
// @param {string} lng The language currently used.
// @param {ns} ns The namespace currently used.
// @param {key} key The translation key.
// @return {string} Returns a default value for the translation key.
defaultValue: function(lng, ns, key) {
if (lng === 'en') {
// Return key as the default value for English language
return key;
}
// Return the string '__NOT_TRANSLATED__' for other languages
return '__NOT_TRANSLATED__';
}
}
v1.0.2
v1.0.1
v1.0.0
There is a major breaking change since v1.0, and the API interface and options are not compatible with v0.x.
Checkout Migration Guide for doing migration from earlier versions.