Skip to content

Adding translations for a new language

Ed Tewiah edited this page Jun 18, 2018 · 2 revisions

In order to support a new language there are 2 key files that need to be translated. The first is the "locale.yml" file here: https://github.com/etewiah/property_web_builder/tree/master/config/locales

So in the case of adding support for Romanian, I will need a "ro.yml" file there with the correct translations.

I will also need a translation of this file: https://github.com/etewiah/property_web_builder/blob/master/db/seeds/translations_en.rb

Devise and Rails framework translations:

There are 2 other files per local in the "config/locales" folder that may need to be translated as well. The first begins with "rails." and the other with "devise.".

These 2 files are for the texts that come with the Rails framework and the Devise gem. For the first file there is a version of it for most languages here: https://github.com/svenfuchs/rails-i18n/tree/master/rails/locale Translations for the second file can be found here: https://github.com/tigrish/devise-i18n/tree/master/rails/locales

If the translations for those 2 files are available at the locations I've mentioned above then simply copy them. If not I will need them to be translated too.

Admin page translations:

With translations for the above files available, I will be able to enable support for that language for the public pages of PropertyWebBuilder. To add support in the admin pages there is one other file that will need translation:

https://github.com/etewiah/property_web_builder/blob/master/config/locales/admin.en.yml

Example content:

Finally, if you wish to contribute some example content in the new language this is the file that needs translation:

https://github.com/etewiah/property_web_builder/blob/master/db/yml_seeds/content_translations/en.yml