localized-strings
Advanced tools
Comparing version 0.0.4 to 0.0.5
@@ -198,3 +198,5 @@ 'use strict'; | ||
//Return an array containing the available languages passed as props in the constructor | ||
/** | ||
* Return an array containing the available languages passed as props in the constructor | ||
*/ | ||
@@ -263,2 +265,12 @@ }, { | ||
} | ||
/** | ||
* The current props (locale object) | ||
*/ | ||
}, { | ||
key: 'getContent', | ||
value: function getContent() { | ||
return this._props; | ||
} | ||
}]); | ||
@@ -265,0 +277,0 @@ |
{ | ||
"name": "localized-strings", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"description": "Simple module to localize the strings of any JS based program using the same syntax used in the ReactLocalization and ReactNativeLocalization module, use 'npm run build' before publishing", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -47,2 +47,35 @@ # localized-strings | ||
The first language is considered the default one, so if a translation is missing for the selected language, the default one is shown and a line is written to the log as a reminder. | ||
#### Update / Overwrite Locale | ||
You might have default localized in the build but then download the latest localization strings from a server. Use setContent to overwrite the whole object. | ||
**NOTE** that this will remove all other localizations if used. | ||
```js | ||
strings.setContent({ | ||
en:{ | ||
how:"How do you want your egg todajsie?", | ||
boiledEgg:"Boiled eggsie", | ||
softBoiledEgg:"Soft-boiled egg", | ||
choice:"How to choose the egg" | ||
} | ||
}) | ||
``` | ||
You can also only overwrite a specific language using: | ||
```js | ||
strings.setContent(Object.assign({},strings.getContent(), | ||
{ | ||
en:{ | ||
how:"How do you want your egg todajsie?", | ||
boiledEgg:"Boiled eggsie", | ||
softBoiledEgg:"Soft-boiled egg", | ||
choice:"How to choose the egg" | ||
} | ||
})); | ||
``` | ||
## Custom getInterfaceLanguage method | ||
@@ -49,0 +82,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
21171
299
204