Skip to content

Instantly share code, notes, and snippets.

@ceritium
Created January 21, 2017 15:13
Show Gist options
  • Save ceritium/825cf33240d605d512fbee1c5f3b6e27 to your computer and use it in GitHub Desktop.
Save ceritium/825cf33240d605d512fbee1c5f3b6e27 to your computer and use it in GitHub Desktop.
Dump from i18n with redis backend to yaml
locales = I18n.available_locales.map(&:to_s)
keys = TRANSLATION_STORE.keys
keys = keys.select{|x| locales.include?(x.split('.',2)[0]) }
translations = keys.inject({}) do |memo, key|
memo[key] = TRANSLATION_STORE.get(key)
memo
end
File.open('translations.yml', 'w') do |f|
f.write translations.to_yaml
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment