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

react-intl-locale-manager

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-intl-locale-manager

Manage the translation process of projects that use the 'react-intl' translation library.

  • 1.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
86
increased by3.61%
Maintainers
1
Weekly downloads
 
Created
Source

build codecov Dependabot Status semantic-release Commitizen friendly node license

react-intl-locale-manager

react-intl-locale-manager is a CLI utility created to aid in the extraction and manteinance of react-intl messages. It uses @babel/core and babel-plugin-react-intl under the hood to handle message extraction.

Features

  • Extract messages from source files.
  • Detect duplicate IDs.
  • Get information about added and deleted IDs and languages.
  • Get information about empty translation keys.

Installation

yarn add react-intl-manager

or

npm install --save react-intl-manager

Usage

intl-manager --help
Usage: locale-manager [options] [command]

Extract react-intl translation messages from source files.
The input language is expected to be TypeScript or any version of JavaScript
that can be parsed by Babel (currently up to ES2020).

Options:
  -v, --version                output the version number
  -h --help                    Show this screen.

Commands:
  manage [options] [files...]  Manage the translation process of projects
                               that use the 'react-intl' translation library.
                               This command extracts react-intl messages into
                               key-value pairs of id and message
                               that can be imported directly in code and passed
                               to the 'IntlProvider' component.
                               Additonally, existing translations will be
                               merged with the extracted messages
                               and information about the changes will be
                               printed to console.
  help [command]               display help for command

intl-manager manage --help
Usage: locale-manager manage [options] [files...]

Manage the translation process of projects that use the 'react-intl' translation library.
This command extracts react-intl messages into key-value pairs of id and message
that can be imported directly in code and passed to the 'IntlProvider' component.
Additonally, existing translations will be merged with the extracted messages
and information about the changes will be printed to console.

Options:
  -l --languages <codes>                Comma-separated list of language codes
                                        to mantain. A translation entry be
                                        generated and mantained for every code
                                        in this list.
  -o --out-dir <path>                   Output the extracted messages in JSON
                                        format in the specified directory,
                                        generating a [locale].json file for
                                        each locale.
                                        Mutually exclusive with '--out-file'.
  -f --out-file <path>                  Output the extracted messages in a
                                        single JSON file containing an entry
                                        for each locale.
                                        Mutually exclusive with '--out-dir'.
  -i --ignore <glob>                    Glob pattern designationg the files to
                                        exlcude from the translation process.
                                        It is possible to specify the flag
                                        multiple times to use more than one
                                        pattern.
  --module-source-name <name>           The ES6 module source name of the React
                                        Intl package. (default: "react-intl")
  --additional-component-names <names>  Comma separated list of component names
                                        to extract messages from. Note that
                                        default we check for the fact that
                                        'FormattedMessage' is imported from
                                        '--module-source-name' to make sure
                                        variable alias works. This option does
                                        not do that so it's less safe.
  --extract-from-format-message-call    Opt-in to extract from
                                        'intl.formatMessage' calls with the
                                        restriction that it has to be called
                                        with an object literal such as
                                        'intl.formatMessage({ id: 'foo', ...})'
                                        (default: false)
  -h, --help                            display help for command

Examples:
  locale-manager manage -l en,es -o ./locales -i src/**/*.test.tsx src/**/*.tsx
  locale-manager manage -l de,it -f locales.json src/**/*.{js,ts,jsx,tsx}

For additional information, visit: https://github.com/murar8/react-intl-manager

Contributing

If you would like to make a contribution to the project you can fork it then submit a pull request.

Please note that this projects uses semantic-release following the Angular Commit Message Conventions, so version bumping is completely automated. In order to ensure the commit messages follow the specification, you can use the commit script in package.json. The README.md and CHANGELOG.md are automatically generated when pushing the code to the repository. To modify the readme, edit README_template.md.

Pre-commit checklist
Run the unit testsyarn test:unit
Build the projectyarn build
Run the integration tests.yarn test:integration

FAQs

Package last updated on 03 Apr 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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