data-locales
v1.3.0
Published
Generate locales and localized data
Downloads
2
Maintainers
Readme
data-locales
Generate locales and localized data.
How it works
- It take structured data (JavaScript or JSON);
- look for
$properties
($
leading); - create a "locale" string;
- save it;
- assign it to new "localized" data file.
Example
Sources
example/test.js
export default {
test: {
$localizeMe: 'foo',
dontTouchMe: 'bar',
},
}
example/test2.json
{
"test2": {
"$localizeMe": "baz",
"dontTouchMe": "qux"
}
}
Command
data-locales -e 'example/*.(js|json)' -d 'data' -l 'locales' -f 'EN'
Outputs
data/test.json
{
"test": {
"$localizeMe": "test.localizeMe",
"dontTouchMe": "bar"
}
}
data/test2.json
{
"test2": {
"$localizeMe": "test2.localizeMe",
"dontTouchMe": "bar"
}
}
locales/EN.json
{
"test.localizeMe": "foo",
"test2.localizeMe": "baz",
}