README.md in i18n-js-3.8.2 vs README.md in i18n-js-3.8.3
- old
+ new
@@ -478,10 +478,12 @@
I18n.locales.no = function (locale) {
return ["nb"];
};
```
+### Translation Missing Behaviour Control
+
By default a missing translation will be displayed as
[missing "name of scope" translation]
While you are developing or if you do not want to provide a translation in the
@@ -496,12 +498,14 @@
questionnaire.whatIsYourFavorite_ChristmasPresent
becomes "what is your favorite Christmas present"
+#### Option `missingTranslationPrefix`
+
In order to still detect untranslated strings, you can set
-`i18n.missingTranslationPrefix` to something like:
+`I18n.missingTranslationPrefix` to something like:
```javascript
I18n.missingTranslationPrefix = "EE: ";
```
@@ -512,16 +516,29 @@
```
This will help you doing automated tests against your localisation assets.
-Some people prefer returning `null` for missing translation:
+#### Customize return when translation entry missing
+Some people prefer returning `null`/`undefined` for missing translation:
+
```javascript
-I18n.missingTranslation = function () {
+I18n.missingTranslation = function (scope, options) {
return undefined;
};
```
+
+### Option `defaultSeparator` (global) / `separator` (local)
+
+Default separator of translation key is `.` (dot)
+Meaning `I18n.t("scope.entry")` would search for translation entry `I18n.translations[locale].scope.entry`
+Using a different separator can be done either globally or locally.
+
+Globally: `I18n.defaultSeparator = newSeparator`
+Locally: `I18n.t("full_sentences|Server Busy. Please retry later", {separator: '|'})`
+
+### Pluralization
Pluralization is possible as well and by default provides English rules:
```javascript
I18n.t("inbox.counting", { count: 10 }); // You have 10 messages