-
Notifications
You must be signed in to change notification settings - Fork 755
Translations
Doing translations require collaboration between translators and developers! Sometimes the translator is also a developer which is cool, but not required. If you're interested in proposing a new language for our app to be in, please file an issue (example) and tag it under the label "translations". You don't have to be the person working on the translations either, but it would be helpful to suggest translators and developers who could help.
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
Please note, our translations are gender neutral and have a similar tone as talking to a loved one.
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
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!