Skip to main content

Translate en/messages.json (chrome.i18n format) to other locales.

Reason this release was yanked:

Wrong ver for minor release

Project description

> translate-messages

Translate en/messages.json (chrome.i18n format) to other locales automatically.

Installation

pip install translate-messages

Usage

Run the CLI:

translate-msgs

If no options are provided, the CLI will:

  1. Prompt for message keys to ignore
  2. Auto-discover closest _locales dir
  3. Translate en/messages.json to target languages

Note: Any messages.json in the chrome.i18n format can be used as a source file.

Options

Options can be set by using command-line arguments:

Option Description Example
--locales-dir Name of the folder containing locale files (default: _locales) --locales-dir=_messages
--target-langs Comma-separated list of languages to include (default: all supported_locales) --target-langs=en,es,fr
--exclude-langs Comma-separated list of languages to exclude --exclude-langs=en,es
--exclude-keys Comma-separated list of keys to ignore --exclude-keys=appName,author
--init Create translate-messages.config.json in project root to store defaults
--no-wizard Skip interactive prompts during start-up
-h, --help Show help screen

Example

translate-msgs --include-langs=fr,es --ignore-keys=appName,author

Config file

Use --init to create translate-messages.config.json in your project root to set default options.

Example defaults:

{
  "locales_dir": "_locales",
  "target_langs": "",
  "exclude_langs": "",
  "exclude_keys": "",
  "no_wizard": false
}

Note: CLI arguments always override config file.

MIT License

Copyright © 2023–2026 Adam Lui.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Back to top ↑

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

translate_messages-1.0.5.tar.gz (11.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

translate_messages-1.0.5-py3-none-any.whl (11.9 kB view details)

Uploaded Python 3

File details

Details for the file translate_messages-1.0.5.tar.gz.

File metadata

  • Download URL: translate_messages-1.0.5.tar.gz
  • Upload date:
  • Size: 11.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.2

File hashes

Hashes for translate_messages-1.0.5.tar.gz
Algorithm Hash digest
SHA256 f7ff1e62d44db191277d9da66d7cd73e08da870dba026c2052db07d1389b8799
MD5 bb14a3c7e57a99812b9b53fceb96f92b
BLAKE2b-256 97d5b60c9a9ecd40df57ccc99397120db9961abedaff0b3da62c5193f1079e72

See more details on using hashes here.

File details

Details for the file translate_messages-1.0.5-py3-none-any.whl.

File metadata

File hashes

Hashes for translate_messages-1.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 cdc875efa0a46639968e86b9a7eae14c43ac2f1f912a15502a0ea9d964ab745b
MD5 d4ab2c91d56f3fc8ebce727e6df5e78e
BLAKE2b-256 42a405695aa52df8167811c1e9c02193263d626fe2fd63d3c133fa859cdc764f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page