Skip to content

Contribute on translations

Rix Beck edited this page Aug 7, 2019 · 9 revisions

Bolt uses Symfony's translations layer. If you'd like to help us keep the different translations up to date, or perhaps even add a new one, you're more than welcome. There are a number of ways you can update a translation:

Add a new language

Add the language code to locales: in config/packages/translation.yaml:

translation:
    locales: ['en', 'nl', 'es', 'fr', 'de', 'pl', 'it', 'pt_BR']

The term locale refers roughly to the user's language and country. It can be any string that your application uses to manage translations and other format differences (e.g. currency format). You can use either an ISO 639-1 language code, like nl, or an ISO 639-1 language code, an underscore (_), then the ISO 3166-1 alpha-2 country code, for example fr_FR for French/France. For more information, see the Symfony docs.

Add the same new locale to config/services.yaml

parameters:
    
    app_locales: en|nl|es|fr|de|pl|it|pt_BR

Note: Before Bolt 4 stable is released, we'll make it so you'll only need to add it in one location.

Finally, go to the page to edit your profile, and select your new locale:

schermafbeelding 2019-02-01 om 14 05 20

Editing the language files

There are no less than four different ways to edit the language files:

From the debug toolbar

If you're on a page you can directly edit the used translation labels from there. Click the Translation nub on the debug toolbar:

schermafbeelding 2019-02-01 om 14 05 32

From there you can find the translations that need adding under the "Missing" and "Fallback" tabs:

schermafbeelding 2019-02-01 om 14 10 24

After updating the file(s), make a Pull Request to get your contributed translations into the Bolt 4 core.

Editing the xlf files

You can edit the xlf files directly, located in the translations/ folder in your project root. You can do this in your text-editor of choice, or using an Open Source tool like Using Poedit or Virtaal.

If you don't find your language xlf file you can create - or update if just partial definitions you have in - with the following command in your project root folder.

#> bin/console translation:update --dump-messages --force <lng> where lng is your requested locale, as de, en, etc.

After updating the file(s), make a Pull Request to get your contributed translations into the Bolt 4 core.

From the Bolt interface

Navigate to the "Edit Translations" page, found under 'Maintenance' > 'Translations / Labels'. Click the language you want to edit, and make your changes.

After updating the file(s), make a Pull Request to get your contributed translations into the Bolt 4 core.

Using Loco / Localise.biz

We're using Localise.biz to manage the translations. If you have an account on that service, and wish to help out managing the translations, ping me (Bob) on Slack, and we'll get you set up.