Skip to content

Instantly share code, notes, and snippets.

@eddanger
Created February 28, 2014 23:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eddanger/9282175 to your computer and use it in GitHub Desktop.
Save eddanger/9282175 to your computer and use it in GitHub Desktop.
Convert locales files for testing new locales.
locale = YAML.load_file("#{Rails.root}/config/locales/en.yml")
new_locale = zero_value_in_hash(locale)
puts new_locale.to_yaml
def zero_value_in_hash(hash)
result = {}
hash.each do |k,v|
if v.is_a?(Hash)
result[k] = zero_value_in_hash(v)
else
result[k] = "XXXXXX"
end
end
result
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment