DEV Community

Organize your translations using multiple locales files

João Chitas on May 06, 2019

Of course, this contains an example with Pokémon! Photo by Kyle Glenn on Unsplash Internationalization of a website's content is always something...
Collapse
 
goranovs profile image
Samuil Goranov

We use Localeapp.com for a very large Rails project. It has CLI and the workflow is pretty simple, but no matter what tool you use it always comes back to bite you. Rails documentation about locales suggests a very bad approach for locales organization and leads to thousands of dollars in duplicated locales. Also, I wonder how this example especially the model scales.

models:
  pokemon:
   name: Name
   type: Type

If we have many models with type or name attribute it will be duplicated in the locales. Scoping locales by folders/models/controllers/views is not so good idea in my opinion. For example if you have a dropdown menu in your app that has a "delete" button, you should not put the locales in a scoped view path. You will probably have a delete button in hundred places in your app.

Just my few cents on the locales in 7+ years old Rails project with a lot of locales :D

Collapse
 
jkostolansky profile image
Juraj Kostolanský

Nice article, João! I used this approach in the past. But my problem was that our non-tech translators couldn't deal with the YAML files, and even if they could, it wasn't an efficient approach. So I've built LocaleData.com - a translation management platform for Rails. The side effect is that I no longer need to touch directly the YAML files. I'm using the web interface to manage the translations and a command line tool to download them into a Rails app. I've successfully used it for all my projects since then :).