6.4.0 • Published 6 months ago

@raytio/react-intl-manager v6.4.0

Weekly downloads
91
License
MIT
Repository
gitlab
Last release
6 months ago

react-intl-manager

pipeline coverage npm version

A fork of react-intl-translations-manager which works better for Raytio and integrates with the GitLab CI.

What it actually does

  • Remove duplicates from the locale json files
  • Remove redundant keys from locale json files
  • Detect missing keys and add them as null
  • Generate a codequality report for codeclimate or GitLab CI.

Note that for performance reasons, this script only parses files that import the i18n module. If it fails to detect this, you can add // @i18nForceCheck to force it to check that file.

Usage:

npm i -D @raytio/react-intl-manager

Then add a section to package.json called i18n which contains the config:

{
  "scripts": {
    "i18n": "react-intl-manager"
  },
  "i18n": {
    "localeDir": "path/to/locale-json-files",

    // optional, src by default
    "sourceFolder": "src",

    // optional, .messages by default
    "messagesDir": ".messages",

    // optional, the name of the es module - default is "i18n", not "react-intl"
    // set to `false` to parse every js-like file
    "moduleSourceName": "i18n",

    // optional, this will append any issues to this file if exists (or create it)
    "codeQualityReport": "path/to/codequality.json"
  }
}

Contributing

# makes cli.js available
npm link

Publishing

The CI will publish every commit to main if the version number in package.json has been bumped.