Interface languages

Interface languages
0

What are interface languages? (and how are they related to “locales”?)

Interface languages are the languages of text you see in the Discourse software interface, such as “New Topic” or “Categories”.

You will find the term “locale” used in the Discourse site settings and in other places. “Locale” is used in the context of software to refer to various place-specific software customisations, including language, location, currency and more (See Locale (computer software) - Wikipedia).

For our purposes we will use “Interface language” synonymously with “locale”. The reason we’re preferencing “Interface language” over “locale”, is simply for the functional reason that it provides an easier conceptual contrast to “Content language”, another feature set in the Multilingual Plugin.

Discourse’s interface language features

Discourse already provides a number of tools to administer interface languages. Without the Multilingual Plugin installed, Discourse allow you to:

  1. Set a default locale for the site, using the default locale site setting

  2. Let the user chose their interface language, using the allow user locale site setting and the “Interface Language” user setting.

  3. Set the guest locale by using the web browser’s language headers, using the set locale from accept language header site setting.

The list of available (and the scope of each non-english translation) is determined by the translations of the Discourse locale files on the Discourse transifex project.

It is important to understand that the primary, and preferred way, of adding a new language to the list of available interface languages for Discourse is by contributing to the Discourse transifex project by following the steps outlined here:

You can also add additional interface languages via a seperate Discourse plugin by following the steps outlined here:

Any changes or additions via these existing Discourse features will be automatically picked up by the Multilingual plugin. The Multilingual Plugin does not change any of this functionality. It builds on top of it and adds additional features.

How the plugin extends the interface language features

After you’ve installed the Multilingual plugin, you’ll have a new admin panel “Multilingual”, with a “Languages” list. This list gives you an overview of the languages in your Discourse.

Interface language administration

The multilingual interface language features use the “alllow user locale” site setting as an “enabled” toggle. If this setting is off the rest of the interface language features will not work.

There are three states for the interface column in the languages list:

  1. No translations. There are no interface translations for that language. Out of the box, there are 187 languages in the list, 47 of which have translations in the Discourse codebase (there are more “project” languages in Discourse’s Transifex, however they are not all present in the codebase).

  2. Disabled (unchecked). There is an interface translation for that language, but it has been disabled. This will not show in the list of available interface languages to users or guests.

  3. Enabled (checked). There is an interface translation for that language and it is currently enabled and will show in the list of available interface languages to users or guests.

All languages with translations can be disabled apart from English (“en”).

When the multilingual plugin is installed the list of languages available to the user in their “Interface language” setting (in their “Interface” settings) will be determined by the list of “Enabled” interface languages.

Guest language switcher

If “allow user locale” is enabled, you can also enable multilingual guest language switcher. This gives guests (non-users) to your site an easy way to swtich between interface languages. There are two form-factors for the switcher, a footer bar and a header menu.

Footer bar

You can set which languages are initially visible in the bar using the site setting multilingual guest language switcher footer visible

Expanded

Header menu

Adding interface translations

It is possible to add interface languages via the multilingual plugin. As noted above, the preferred way of adding an interface language to Discourse is by adding it to Discourse itself, as explained here: How to add a new language - translations - Discourse Meta. It is also possible to add an interface language via a plugin, as described here: Add a new locale from plugin - developers - Discourse Meta.

If neither of the standard ways of adding an interface language are available to you, you can add one via the Multilingual Plugin. There are two steps to adding an interface translation in the Multilingual Plugin:

  1. Add the language to your language list if it’s not there already: Adding a custom language.

  2. Add translations to your translations list: Adding translations.