tolgee-merge-namespaces
v1.0.1
Published
A tool to merge translations across namespaces in Tolgee i18n files
Maintainers
Readme
tolgee-merge-namespaces
A command-line tool to merge translations across namespaces in Tolgee i18n files.
Installation
You can install the package globally:
npm install -g tolgee-merge-namespacesOr use it directly with npx:
npx tolgee-merge-namespacesUsage
tolgee-merge-namespaces [options]Options
--dir, -d <path>: Specify the i18n directory (default: "i18n")--help, -h: Show help message--version, -v: Show version information
What it does
This tool helps you manage translations in Tolgee projects that use namespaces. It:
- Finds all language files in the i18n directory and its subdirectories
- Merges translations from namespace directories into the root language files
- When there are conflicts, it prioritizes translations from the root files
- Removes the namespace files after merging
- Removes empty namespace directories
Example
Suppose you have the following structure:
i18n/
en.json
de.json
namespace1/
en.json
de.json
namespace2/
en.jsonAfter running tolgee-merge-namespaces, all translations will be merged into the root files (i18n/en.json and i18n/de.json), and the namespace directories will be removed.
Testing locally
To test the package locally before publishing:
- Clone the repository
- Navigate to the project directory
- Run
npm linkto create a global symlink - Now you can use
tolgee-merge-namespacescommand from anywhere
To unlink after testing:
npm unlink -g tolgee-merge-namespacesLicense
MIT
