Adding a custom language

The multilingual plugin adds a “Multilingual” admin panel to your Discourse with a list of “Languages”. You can use this list of languages to administer your interface and content languages.

How is the default list generated?

The default languages list is generated from the list of language names in Discourse (see names.yml). The plugin uses all the languages “as is” in the names.yml file, unless there is a locale file in Discourse that uses a regional code that varies from the base (or ‘primary’) language code, e.g. bs (Bosnian) becomes bs_BA, as that is the code used in the locale file.

See further https://github.com/paviliondev/discourse-multilingual/blob/master/lib/multilingual/language.rb#L37

You may find that you need to add to this list, to provide a new interface or content language to your users.

:exclamation: Please note that if you are looking to add an interface language, the best way of doing this is by adding it to Discourse itself, as described here: How to add a new language - translations - Discourse Meta. If you get a set of translations accepted into Discourse, they will automatically be administerable in the Multilingual plugin.

You can add custom languages to this list by clicking “Upload” and selecting an appropriately formatted .yml file.

Language .yml file format

The format of a custom language .yml file should be the same as the format of the names.yml file in Discourse, namely:

<code>:
    name: <name>
    nativeName: <navtiveName>
  • code: ISO 639 language code
  • name: ISO 639 language name
  • nativeName: Name as appears in its own language (the endonymic name)

You can list as many custom languages as you like in the one file.

For example, if you want to add “Walpiri”, the language spoken by the Walpiri people in the north of Australia, you would have a file that looks like this:

wbp: 
  name: "Warlpiri"
  nativeName: "Warlpiri"

Once uploaded, the Warlpiri language will appear on the list like this

Immediately after successfully uploading a custom language file, the list of languages will be filtered to show you only custom languages. You can remove this filter by unchecking ‘custom only’ on the left.

Using a custom language

You can use a custom language like any other language in your list. You can immediately use it as a content language. If you also upload translation files, you can also use it as an interface language.

You can also remove any custom language you’ve added by clicking X in the “Actions” column.