The previous article introduced the multilingual variants of content and showed you how to distinguish between translated and not-translated content in Xperience by Kentico. Now, we'll dive deeper into the theory of languages and how to set them up in Xperience by Kentico.
Editors can offer website visitors content in different languages. For example, a US-based company can have content in English and French for a Canadian audience. Different channels can have different language variants to fulfill any specific needs of the company.
These languages are defined by system administrators, and developers make sure every channel displays them properly. From the system perspective, however, there are three types of languages in Xperience that serve different purposes.
We'll talk about different types of languages in Xperience. Let's quickly describe them:
Fallback language – we already covered this in the previous article. It's a 'backup' language for the content you use in channels. If the content doesn't show in the new language variant (for example, because it wasn't published), the fallback takes its place.
Default language – when you open the Content hub for the first time, Xperience shows the content items in the Default language first. After you switch to a different language in channels, Xperience remembers the new language and rearranges content items in the Content hub, so you first see the items in the new language you worked with. For example, your Default language is English, so the content items you first see in the Content hub are in English. Then, you go to a website channel, switch to German, and work on the German language variant. When you go to the Content hub next time, Xperience remembers and shows content items in German first. The Default language doesn't influence the live website. It is also not a fallback for other languages – only the fallback languages you set count.
Primary language – the language in which the live website appears by default. The URL doesn't include the language identifier of the Primary language. For example, the Primary language of a website channel is English, and a language variant is French. The URLs then look like this:
You can set a different Primary language for each website channel in the Channel management application.
The Primary language applies only to website channels that use the language prefix URL format. Channels that serve each language from its own domain have no primary language.
When creating a new language variant of content, you must add the desired language to the Languages application. To do so, you need to be a system administrator or have appropriate permission. The next step is to set the language for the backend. Lastly, the developers need to ensure the content in the desired language displays correctly.
When you add a new language, you'll define the Language name used internally in Xperience and the Code name used in the URLs (more about URLs below). The Formatting culture drives how XbyK handles culture-related information, like time, dates, or number format.
The formatting culture values must be based on IETF or one of the ISO-639 standards.
You can also adjust an existing language in the application; just open it and change the requested value.
However, changing the language's Code name or setting another language as the default will change the URL. This means your developers need to redirect all original URLs to the new ones. See more in the Languages and URL section.
To remove an existing language, use the bin button next to the language.
If the system already contains a translated version of some content, you cannot delete the language. For example, the screenshot above shows there already are Czech and German variants of an English content item, so the Delete button is disabled. Don't forget to go through:
Before you delete the language, check if it's marked as the Default language or used as the Primary language of a channel. If so, make another language the Default language and the channel's Primary language.
When you create a new channel, you define a Primary language your content will focus on. This will be the main language of your channel, but you can create content in any other language listed in the Languages application.
It's important to remember, however, that Xperience, by default, does not limit the channel languages in which you can publish content. While creating a language, you cannot restrict the languages allowed for this channel.
Languages in Xperience are, by default, global. This means that when a language exists, editors can use it to translate content. Similarly, if a language has a fallback language, you cannot opt out of this behavior in a specific channel.
If your project needs to be more restrictive, developers can customize Xperience and introduce a per-channel language setting. For a practical example, look at the Kbank demo settings.
The global nature of languages in Xperience can impact other content objects besides content. When you delete a language, Xperience removes translated variants of consent agreements, taxonomy names, or title tags. So, when you decide to remove a language, proceed with caution.
As mentioned in the previous guide, a fallback language serves as a backup for content not published in the targeted multilingual variant.
Let's say you have a website in Spanish, and its fallback language is German. You also have English as a fallback for German. A visitor goes to the Spanish version of the website, and there is content that was not published in Spanish. Xperience shows the content in the fallback language, which is German. But if even the German version doesn't exist, it shows the next in line, English.
If there's a fallback, the website's URL will still appear as Spanish, even though some content shows in German or English.
Instead of one universal fallback language, you can set up a different fallback for each language, or create a fallback chain. For example, you can create a fallback chain of five languages where the content will show in its fallback language if one language doesn't work. And if that fallback language doesn't work, the content shows in that fallback language's fallback language. See the chain in the box below (however unrealistic). If the first one doesn't work, Xperience shows the content in the second one. If the second one doesn't work, it shows the third one, and so on.
Here is an example of the fallback chain:
German → Czech → French → Spanish → English
To change the fallback language, open the Languages application, open the language, and select its Fallback language. In our example, if German doesn't work, it'll show content in Czech. The following screenshot shows where to set up the fallback language.
Similarly to the previous step, set up the fallback language for Czech. Open the Czech language and set its Fallback language to French. Continue like this until you have the whole chain set up.
Suppose your company doesn't want a fallback language for a specific language variant. In that case, you can remove the fallback language.
Instead of choosing a Fallback language, remove it using the cross button.
But what if you don't define the fallback language, and the desired page doesn't exist in the target language? In that case, the server returns a 404 error, and the visitor sees a blank page unless your developers have configured a custom error page. For the developer setup, see Serve custom error pages.
URLs for pages in the primary language of a website channel don't include the language's Code name. For example, suppose English is set as the Primary language of the website channel. In that case, the URLs of pages in English will be domain.com/page, for example kbank.com/personal.
For pages in a non-primary language, Xperience inserts the language's Code name into the URL path after the site's root ('/'). For example, suppose English is set as the Primary language of the website channel. In that case, the URLs of pages in Spanish will be in the kbank.com/es/personal format.
As we mentioned before, the languages in Xperience are global and Kentico doesn't monitor changes in global objects. This means developers have to handle redirects of all pages indexed in the search engines from the old, now broken, URLs to the new ones.
You can add, adjust, or remove a fallback language. If a language has no fallback, visitors who open an untranslated page receive a 404 error. You can create a chain of fallbacks or set a different fallback for each language variant. There doesn't have to be just one universal fallback for everything; each language can have its own fallback. Xperience creates a code name for the language in the URL. This code name doesn't update automatically, so if you change it in settings, redirect the old pages.
In the following article, you can learn how to create a language variant of a page.
If you want to read more about multilingual websites from a developer's point of view, visit our Guides dedicated to this topic.