Language strategies

Something we have seen at every customer (at least with a multi-lingual / multi-country website) the last years is a challenge on how to handle different languages in your CMS. You will be surprised how many strategies are possible and what kind of decisions you can be made. In this blog post I like to share some default strategies and thoughts about how to setup a multi-lingual / multi-country website.

Countries, Cultures, Languages

I like to start with an explanation of the basics. When you are familiar with CulturInfo in .net you can define such an object with a name. dotNet is using RFC-4646 which basically is a combination of:

Countries; https://en.wikipedia.org/wiki/ISO_3166-1 (alpha2)
Languages; https://en.wikipedia.org/wiki/ISO_639-1

Below an example how you can define a CultureInfo. The first is a "neutral culture", say language only. The second is an actual culture which is part of a country (or region).

//linqpad
void Main()
{
	var language = new CultureInfo("nl");
	var culture = new CultureInfo("nl-BE");
	
	//culture names
	language.EnglishName.Dump();
	culture.EnglishName.Dump();

	//countries / regions
	
	//var unknown = new RegionInfo(language.LCID);
	// results in an Exception "Culture .. is a neutral culture;"
	
	var belgium = new RegionInfo(culture.LCID);
	belgium.Name.Dump();
}

When setting up a website in whatever CMS system you like, you have to be aware that languages are not countries and vice versa and that a combination of these is a region specific culture.

Markets

When doing Episerver commerce you are going to see an extra concept named Markets. Markets can be per country, per continent, per language, per city, or whatever you define yourself.

Multiple markets can have the need to be served in the same language or every market can have their own or multiple language(s). Be aware to never mix the concepts of markets, languages and cultures. A language can be a market in the definition of your functional design (fe. the dutch market), but from a technical perspective it never is. We have seen market name conventions like "NL-BE" and than things like new CultureInfo(Market.Name) but don’t go that route (or your love for spaghetti is that great that you like to create code like that as well 😉 ).

Different use cases have different needs

The first thing you have to think about is what / who am I going to serve? Multiple brands, in multiple countries with multiple languages. Or one brand within one country with a single language? Different customers, different end users, different needs. I have tried to create a simplified flowchart that hopefully is helpful to consult your customer.

Always keep in mind to set the right master language and never use the default "en" language for a different language like "nl", "fr" etc.

Fallback strategies

As you already can see the flowchart is helping you with consulting the right direction but there are also situations where it’s somewhere between "yes" or "no" like the grey marked situation. Therefor you have to know about a very simple but powerfull feature in Episerver called fallback languages. Fallback languages does give you all the power to show a default language / culture variation of your content when it’s not available in the visiting culture. F.e. you are going to use neutral cultures as a default but sometimes you have an extra need for a specific culture (in all other cases you fallback on the "default" neutral culture)

Side note; keep in mind that Commerce doesn’t have fallbacks by default. When enabling a culture a saved copy of each catalog item is created. You need to publish it in (manually or via automated processes). Every item has to be available in every supported culture. When not available it fallsback on the master language. If you like to have the concept of fallback cultures available in Episerver commerce there are a couple of routes / hacks you can follow. Feel free to contact us or share your thoughts on this.