Skip to content


Subversion checkout URL

You can clone with
Download ZIP
A small tool for Ruby on Rails locales - As gem
Branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.


A useful gem for Ruby-on-Rails apps that use multiple languages.

It can compare YAML 'locale' files with each other and lets you...

  • find missing translation-keys
  • find mismatching value types (e.g. String vs Array)
  • automatically add missing keys (merge)
  • existing, but not translated keys

You can also find AutoLocale at


Before using any of these, make sure to require 'autolocale'.

find problems

# run in irb "path/to/complete_locale.yml", "path/to/incomplete_locale.yml"

compare will just list missing or mismatching keys (with their path), but not affect the actual files.

add missing keys

AutoLocale.automerge "path/to/complete_locale.yml", "path/to/incomplete_locale.yml"

automerge will automatically add not existing keys (and their values) to the other file. This will not touch value type mismatches.

find not translated keys

AutoLocale.untranslated "path/to/complete_locale.yml", "path/to/incomplete_locale.yml"

Use untranslated to find untranslated (but existing) keys.
In fact, this will find each key's value and compare it with it's respective opposite. That means it will show up in the results whenever the values are the same (as they are after using the merge function).
Chances are you're finding keys that just share the same words in two languages.

Examples "example_files/en_complete.yml", "example_files/en_incomplete.yml"


AutoLocale.automerge "example_files/en_complete.yml", "example_files/en_incomplete.yml"

As mentioned above, it will not touch type mismatches - but it shows them to you so it can be fixed by hand.

AutoLocale.untranslated "example_files/en_complete.yml", "example_files/en_incomplete.yml"


Use more than just two files

Put this code into a file and run it with ruby filename (from your locales path):

Dir.glob('*.yml').permutation(2).to_a.each{|f|print "#{f[0]} <=> #{f[1]}: ";[0].to_s, f[1].to_s)}

It will compare every file with every other file in the directory.
Change compare() to anything listed above, if you want to.


Not sure when I have the time to do this.

  1. Allow to use path/to/file instead of "path/to/file"
  2. Add built-in support to iterate over every file in folder
  3. Create shorter methodnames / aliases
  4. Make executable, so it's not needed to run with irb
Something went wrong with that request. Please try again.