You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Managing locale files is a pain. It's not obvious how to structure those files and how to keep them consistent. Right now, locale files are a mess. Inconsistent number of lines, inconsistent structure and too many global translation strings.
I did a big cleanup for rubygems.org a while back as they had similar issue: rubygems/rubygems.org#1522 Honestly, I don't want to do it again as it's just tedious. Maybe somebody wants to tackle this easy, but time consuming task.
So, about structure. Putting everything on the root level is bad. You can't see where that translation string is being used. This is how it can be improved:
en:
# ActiveRecord translations used for things like formsactiverecord:
models:
shoe: Shoeattributes:
shoe:
name: Namecolor: Color# Controller and View translationsshoes:
# translations inside the controller. You can use them via `t("shoes.not_found")`not_found: Shoe not found!# Now for strings used in view templates. You can use shorcut like `t(".title")`index:
title: List of Shoesnew_link: New Shoe new:
title: New Shoe# this is for _form.html.erb partialform:
create: Create a Shoe
Managing locale files is a pain. It's not obvious how to structure those files and how to keep them consistent. Right now, locale files are a mess. Inconsistent number of lines, inconsistent structure and too many global translation strings.
I did a big cleanup for rubygems.org a while back as they had similar issue: rubygems/rubygems.org#1522 Honestly, I don't want to do it again as it's just tedious. Maybe somebody wants to tackle this easy, but time consuming task.
So, about structure. Putting everything on the root level is bad. You can't see where that translation string is being used. This is how it can be improved:
If you get all locale files structured the same, and add a test like this: https://github.com/comfy/comfortable-mexican-sofa/blob/master/test/integration/i18n_test.rb You're golden. It will be very difficult to mess up locales going forward. You'll only need I18n-tasks to detect unused strings, but with care, you don't even need it.
So, if somebody wants to tackle this, feel free to ask questions.
If you never had to deal with translations, this is a must-read: http://guides.rubyonrails.org/i18n.html Specifically this section ("Lazy" Lookup bit)
Cheers.
This will close: #980 #861
The text was updated successfully, but these errors were encountered: