neeto-translate-cli
A Ruby CLI tool that extracts translation files from Rails applications and makes requests to the neeto-translate API for automated translation management.
Table of Contents
Installation
Install the gem via RubyGems:
gem install neeto-translate-cli
Or add it to your Gemfile:
gem 'neeto-translate-cli'
Then run:
bundle install
Usage
The neeto-translate-cli
tool helps you manage translations by:
- Extracting translation keys from your Rails application's frontend (JSON) and backend (YAML) locale files
- Identifying missing translations across different languages
- Detecting updated translation keys since the last automated translation
- Sending translation requests to the neeto-translate API
Basic Usage
neeto-translate-cli [OPTIONS]
Command line options
Options:
--frontend PATH
- Path to frontend locales (default:app/javascript/src/translations
)--backend PATH
- Path to backend locales (default:config/locales
)--defaults LANGUAGES
- Comma-separated list of languages to translate (default:en,fr,de,es
)--repo NAME
- GitHub repository name (e.g.,neetozone/neeto-cal-web
)
Examples
Custom paths:
neeto-translate-cli --frontend src/locales --backend config/translations
Specific languages:
neeto-translate-cli --defaults "fr,de,es,it"
Full example:
neeto-translate-cli \
--frontend app/javascript/src/translations \
--backend config/locales \
--defaults "fr,de,es" \
--repo "neetozone/neeto-cal-web"
Environment Variables
The following environment variables can be configured:
NEETO_TRANSLATE_URL
- Base URL for the neeto-translate API (default:https://translate.neeto.com
)NEETO_TRANSLATE_X_TOKEN
- Authentication token for the APIDEFAULT_LANGUAGES
- Comma-separated list of default languages (default:en,fr,de,es
)
How It Works
- Extraction: The tool reads your English translation files (
en.json
for frontend,en.yml
for backend) - Analysis: It compares with other language files to identify missing translations
- Change Detection: It detects keys that have been updated since the last automated translation run
- API Request: Sends a payload to the neeto-translate API with:
- Current English translations
- Missing translation keys for each language
- Updated keys that need re-translation
- Repository metadata
Development
Setup
- Clone the repository:
git clone https://github.com/neetozone/neeto-translate.git
cd neeto-translate/cli
- Install dependencies:
bundle install
- Run tests:
bundle exec rake test