Synchronize locale yml files tool in Rails?

I just wrote my own rake task for this: LOCALES_PATH = "#{Rails. Root}/config/locales/*. Yml" MASTER_LOCALE = "#{Rails.

Root}/config/locales/en. Yml" class Hash def to_yaml( opts = {} ) YAML::quick_emit( object_id, opts ) do |out| out. Map( taguri, to_yaml_style ) do |map| sort.

Each do |k, v| # "sort" added map. Add( k, v ) end end end end end namespace :locales do task :merge do require 'yaml' master = YAML::load_file MASTER_LOCALE master_language_code = File. Basename(MASTER_LOCALE, '.

Yml') DirLOCALES_PATH. Each do |file_name| if file_name == MASTER_LOCALE puts "=> skipping master locale #{File. Basename(MASTER_LOCALE)}" next end language_code = File.

Basename(file_name, '. Yml') slave = YAML::load_file(file_name) unless slavelanguage_code puts "-> ERROR on #{File. Basename(file_name)}: can't find key '#{language_code}'!" next end merged = mastermaster_language_code.

Deep_merge(slavelanguage_code) final = { language_code => merged } # remove other keys File. Open(file_name, 'w') do |file| file. Write final.

To_yaml. Gsub(/\s+$/, '') end puts "+ merged #{File. Basename(file_name)} with master" end end end It does a simple merge().

In your case it takes the en. Yml and merges the el. Yml into it and saves it as el.yml.

The en. Yml does not get touched.

It's not exactly what you need, but maybe checking out github.com/mynewsdesk/translate out can prove useful. Quote: This plugin provides a web interface for translating Rails I18n texts (requires Rails 2.2 or higher) from one locale to another. The plugin has been tested only with the simple I18n backend that ships with Rails.

I18n texts are read from and written to YAML files under config/locales.

Didn't found either, so I wrote a lil gem: github.com/nofxx/i18n_sync.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions