Content languages are the languages used in forum posts.
Content languages are different from interface languages, which can already be set in Discourse (see
default locale and
allow user locale site settings, and the
Interface language user setting).
In a multilingual forum, you may have more than one content language. This raises a few issues:
- How do I make it easy for my users to find content in their language?
- How do I make it easy for my users to filter out content in a language they can’t understand?
- How do I make it easy for my users to translate content in a language they can’t understand?
The content languages feature is designed to make it easy to handle these and similar issues when running a multilingual forum.
The content languages feature uses Discourse’s tagging system to filter content. When content languages are enabled, a new tag selector appears in the topic composer and topic edit controls that lets a user add a content language tag to a topic.
When a topic is tagged with a content language, a content language tag is applied to the topic, appearing in the topic list item and underneath the topic title, next to the normal tags but differentiated by a language symbol.
(pro tip: the tag itself is the languge ISO code, e.g. “en”, but it is rendered using the “native name” of the language, e.g. “English” for ease of use).
A user can set a content language(s) for their account in their interface preferences.
If a user sets a content language, all topic lists on the site will be filtered by that language (i.e. only topics tagged with that language will appear) and the language icon next to the topic list filters will change color to indicate the topic list is being filtered.
Clicking on the language icon shows the languages being filtered by, and links the user to their content language setting. If the user has more than one content language set, they will see all topics tagged with any of their content languages.
If the user has at least one content language set, the first in their list will appear automatically in the composer content language selector when the user is creating a topic.
Guests can also filter topics by a content language by selecting it in the language dropdown next to the topic list filters.
Like interface languges, content languages can be administered in the “Languages” list in the “Multilingual” admin panel. This list gives you an overview of the languages in your Discourse. If you wish to use a content language not in the standard language list, you can add it by adding a Custom Language.
Content languages can be enabled by toggling the site setting
multilingual content languages enabled. This setting is off by default. None of the content languages features will work if that setting is disabled.
If content languages are enabled, the list of content languages a user (or guest) can select is determined by which languages in your Languages list have “content” checked
Any language with “content” checked will automatically have a corresponding tag in a tag group called “Multilingual content tags”. Both the group and the corresponding tags will be automatically generated if the setting is enabled, and they do not currently exist (see below on how to remove the group and tags).
You can navigate to the “Multilingual content tags” tag group by clicking the “Tags” link in the Multilingual admin panel
This group of tags determines what tags will be available in the content language tags selector. The tags in this group are also filtered out of the normal tag selector and in the
The Tags Group interface has been changed for the Multilingual content tag group, to reflect its unique character (the interface for other tag groups remains the same).
You can’t change the permissions of the group, or its visibility. That is determined by the content languages settings. Also, administrators (but not moderators) are given the power to delete all tags in the group and update all tags in the group.
Updating all tags means ensuring that all languages with “content” enabled in your Languages list have a corresponding tag in the group. This should be the case anyway, but the control is there in the event the two get out of sync for any reason.
Deleting all tags is added to allow you to easily remove all of the content language tags generated by the multilingual plugin if you wish to disable content languages or remove the plugin entirely. The plugin does not do this automatically, as you may wish to retain the tags.
You can require users to select a content language when creating a topic by setting the
multilingual require content language tag setting. This setting has three options:
- no: content languages are not required when creating a topic
- non-staff: content languages are only required of non-staff when creating a topic
- yes: content languges are required of everybody when creating a topic
If this setting is enabled, and it applies to the user in question, they will not be able to post a topic without a content language.
If you have:
- the Discourse Translator Plugin installed;
- the Translator Plugin enabled;
- the Multilingual Plugin enabled; and
- content languages enabled
you can enable
multilingual translator content tag sync (you won’t be able to enable it unless all four things are true).
The sync automatically applies the detected language of posts in a topic as content languages, as long as the detected language matches a content language enabled on your site.
If the Translator plugin detects additional languages in subsequent posts in a topic, these will also be added as content language tags.