Skip to main content
Table of contents

Publishing

Last updated: 16 Dec 2020

Add support for a new translation in Whitehall

Useful links:

1. Update Government Frontend

Example PR

In Government Frontend:

  1. Add the new locale to config/application.rb and config/locales/en.yml in alphabetical order
  2. Run the following commands to generate the locale files from the English template:

     $ export LOCALE=<new_locale>
     $ rake "translation:export[tmp/locale_csv,en,${LOCALE}]"
     $ rake "translation:import[${LOCALE},tmp/locale_csv/${LOCALE}.csv]"
    
  3. In config/locales/<new_locale>.yml add the language translation under the language_names key.

    For example:

      it:
        language_names:
          it: italiano
    

2. Update Whitehall

Example PR

In Whitehall:

  1. Add the new locale to lib/whitehall.rb and config/locales/en.yml in alphabetical order
  2. Run the following commands to generate the locale files from the English template:

     $ export LOCALE=<new_locale>
     $ rake "translation:export[tmp/locale_csv,en,${LOCALE}]"
     $ rake "translation:import[${LOCALE},tmp/locale_csv/${LOCALE}.csv]"
    
  3. In config/locales/<new_locale>.yml add:
    • the language direction under the i18n.direction key
    • the appropriate boolean under the i18n.latin_script? key
    • the language translation under the language_names key

    For example:

      it:
        i18n:
          direction: ltr
          latin_script?: true
        language_names:
          it: Italiano
    

3. Update GOV.UK Content Schemas

Example PR

In GOV.UK Content Schemas:

  1. Edit formats/shared/definitions/locale.jsonnet to include the new locale in alphabetical order
  2. Run rake to generate all the schemas

4. Update Content Store

Example PR

In Content Store:

  • Add the locale key to config/application.rb in alphabetical order

5. Update Publishing API

Example PR

In Publishing API:

  • Add the locale key to config/application.rb in alphabetical order