data-locales
TypeScript icon, indicating that this package has built-in type declarations

1.3.0 • Public • Published

data-locales

Generate locales and localized data.

stability-wip npm version Commitizen friendly Conventional Commits License CircleCI Coverage Status


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",
}

Package Sidebar

Install

npm i data-locales

Weekly Downloads

2

Version

1.3.0

License

SEE LICENSE IN UNLICENSE

Unpacked Size

120 kB

Total Files

24

Last publish

Collaborators

  • thierrymichel