Created
June 5, 2012 13:44
-
-
Save miguelperez/2875065 to your computer and use it in GitHub Desktop.
Localization guidelines
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This are some common conventions for localization files in ruby on rails. | |
Most of this can be found in the rails guides. | |
I basically separate the files in directories related to where they will be used. Adding this line to config/application.rb so the files gets loaded correctly. | |
config.i18n.load_path += Dir[Rails.root.join('config', 'locales', '**/*.{rb,yml}').to_s] | |
Models | |
Views | |
Controllers | |
The models directory holds the model's name and its attributes as well. | |
The views directory holds the strings that are used in the views. edit, view, list, delete, show and so on, as well as string messages. That explain something. | |
The controllers directory holds all the messages that are passed through flash messages. | |
********** NOTES | |
1. When the text is a string separated by spaces, I prefer adding it in simple quotes. | |
2. All the attributes of the model should be added. Event those that reference another model like: | |
user_id: User |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
en: | |
activerecord: | |
models: | |
model_name: 'Model Translation' | |
model_name_2: Translation | |
attributes: | |
model_name: | |
attribute_1: Attribute | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment