Skip to content

Adding and Deleting Translation Keys

Rafael Teixeira edited this page Jun 30, 2016 · 3 revisions

When creating a pull request that introduces new translation keys, it is important that the new keys will eventually be added to the corresponding LocaleApp project of the repository.

Translations for the Editor/Admin

  • Provide translations of all new keys for all supported locales (at the moment en and de) by placing files in the config/locales/new directory:

      # config/locales/new/my_feature.en.yml
      en:
        pageflow:
          my_new_key: "A Translation"
    
      # config/locales/new/my_feature.de.yml
      de:
        pageflow:
          my_new_key: "Eine Übersetzung"
    
  • Use the decomposed gem name as a key prefix, i.e. if you are adding a translation key for the pageflow-external-links gem, add keys of the form pageflow.external_links.some_key.

  • If a formerly used key is no longer needed, add entries of the following form to both translation files:

      # config/locales/new/my_feature.en.yml
      en:
        pageflow:
          some_key: "DELETED"
    

    That way they are easy to spot on LocaleApp after import.

After your pull request has been merged, keys from your yaml file will eventually be imported into the LocaleApp project by one of the maintainers. Once translation files have been updated, the new directory will be removed.

Translations for Published Entries

If the translation is visible inside published entries, the key has to be added to the pageflow-public-i18n gem. The pull request then has to include an update of the gemspec file to depend on a minor version of the pageflow-public-i18n gem that includes translations for the required key.