-
Notifications
You must be signed in to change notification settings - Fork 756
Translations
All of our translation files can be found in /config/locales. Assuming that you'll be translating from English to a new language, you'll want to duplicate all of the files containing en.yml
. We recommend copying and pasting the contents the English files into your new language files and then doing translations line by line.
For example:
back_to_top: Back to Top
copied and pasted from en.yml would become back_to_top: Regresar al Inicio
in Spanish in es.yml
It is highly recommended that you work on translations with another fluent individual. They don't have to be a developer. Having a second pair of eyes will help catch translation errors!
In every existing main translation file e.g. ptbr.yml, add an entry for the new language
languages:
en: English
es: Español
ptbr: Português
sv: Svenska
Add locale initials to:
-
set_locale
method inapp/controllers/application_controller.rb
-
validates :locale
inclusion array inapp/models/user.rb
-
config.i18n.available_locales
array inconfig/application.rb
Add language to announcement banner that shows up on our English pages by updating the translationsAnnouncement
method in app/assets/javascripts/announcement.js
.
Please do manual testing. View the app on your local development environment and ensure everything is a-ok.
We have automated tests for i18n to make sure things don't go wrong.
Please add your new translation files to the LOCALES_FILES
object in spec/support/compare_locales_support.rb
and add tests to spec/compare_locales_support_spec.rb
.
Your branch will be out of sync over time, and keys may be changed or added to the master branch. After syncing your branch to master you can run some tools to check against these changes to help identify them. The repository sexybiggetje/ifme-languagetools contains scripts for comparing locales and offers writing style suggestions using a LanguageTool.org instance.
Huge thanks to @sexybiggetje, who translated our site to Dutch, for working on this tool!