Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

localized-strings

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

localized-strings - npm Package Compare versions

Comparing version 0.0.4 to 0.0.5

14

lib/LocalizedStrings.js

@@ -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 @@

2

package.json
{
"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 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc