is a lightweight commandline tool which helps you manage those big yaml files when using rails and multiple languages
if you want to keep things simple and do not need online services like localeapp
- install - setup - edit only your chosen language .yml file - run "locale_assistant en" from your rails root direcotry (no need for bundle exec) this will sort your en.yml alphabetically (if 'en' is your primary language) update or generate other language files (defined in LocaleAssistant::Languages) Of course it can not translate, but will insert "TODO (text in other language)" keys in other files - commit
$ gem install locale_assistant
or you can just copy that single file from the bin directory
edit RAILSROOT/config/l_assistant.conf.rb
module LocaleAssistant Files = ['config/locales/#lang#.yml', 'config/locales/#lang#_models.yml', 'vendor/engines/contract_management/config/locales/#lang#.yml' ] Languages = ['hu','en','he'] IgnoreList = [] end
$ locale_assistant [options] source_language -D, --destructive If you want to clear keys that are not in the source language -t, --tempfile Use .temp files for inspecting before overwriting -i, --inspecting-mode Do not make changes, just list the missing keys -a, --add_hyphens Add "--- \n" to the beginning of every yaml file -h, --help Display this screen
This script understands only a limited subset of yaml. I had trouble instructing the yaml parser to cooperate, so i wrote a simple one, just enough to make this workflow fly Full line comments, empty lines, starting 3 hyphens, and comments on non leaf elements are dropped Comments on leaves are copied Multiline values, along with many features of yaml are unsupported at the moment.