Skip to main content
Warning This document has not been updated for a while now. It may be out of date.
Last updated: 23 Nov 2022

Add support for a new translation in Whitehall

Before starting, it’s worth checking the language tag that is being added is correct: it should be compatible with the IETF Language Tag syntax and use correct ISO 639 codes (with optional ISO 15924 or ISO 3166 subtags where appropriate). This is important to ensure maximum compatibility with accessibility features such as screen readers. Some other useful reading includes Rails Translation Manager and Whitehall Internationalisation guide.

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:

    $ echo "foo: bar" >> config/locales/<new_locale>.yml
    $ # the contents will get overwritten below
    $ rake translation:add_missing
    
  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:

    $ echo "foo: bar" >> config/locales/<new_locale>.yml
    $ # the contents will get overwritten below
    $ rake translation:add_missing
    
  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 content schemas in publishing api

Please note that this example PR is for the retired govuk-content-schemas repo - please add examples of adding to publishing api when it is available:

Example PR

In publishing api:

  1. Edit content_schemas/formats/shared/definitions/locale.jsonnet to include the new locale in alphabetical order
  2. Run rake build_schemas 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