yml_gtranslate is a convenience gem to get your rails localization process going quickly. It uses the Google Translate service (no API required though).
It creates missing
*.yml localization config files or updates the locale files with missing keys and translates those missing keys.
A: The easiest way is to use rubygems for installation:
$ gem install yml_gtranslate
or add this line to your application's Gemfile:
And then execute:
$ bundle install
After installation use the command:
$ yml_gt <from_lang> <to_lang> [directory]
goes thru all
*from_lang.yml files in the
the default dir is config/locales
Translates config/locales/*en.yml files to German
$ yml_gt en de
Translates all sk.yml files in the current directory to English (hence the dot)
$ yml_gt sk en .
This is going to take your all your
config/locales/*sk.yml files and compare them with
(That is in case your locale files are divided, e.g. sk.yml, devise.sk.yml etc.). If the target file does not exist
it's going to create it and translate all string keys in the source file to English using Google Translate.
If the target file already exists it's gonna compare all the string keys in both source and target and translate only those missing in the target.
The translation adds a comment "#i18n-GT" after the translated key. This is to let you know, that this string was generated by Google Translate and probably needs some fine tuning (coz let's face it, GT is seldom perfect in translations).
###Example 1. Completing and sorting locale files:
en: oranges: "oranges" apples: "apples" cherries: "cherries"
de: oranges: "my awesome deutsch translation: Orangen"
yml_gt en de . will result in
de.yml being updated to:
de: apples: "Äpfel" #i18n-GT cherries: "Kirschen" #i18n-GT oranges: "my awesome deutsch translation: Orangen"
A: Shoot me an email and we'll talk it over
- Fork it
- Create your feature branch (
git checkout -b my-new-feature)
- Commit your changes (
git commit -am 'Add some feature')
- Push to the branch (
git push origin my-new-feature)
- Create new Pull Request