Globalization
Introduces the globalization and language management concept for the Optimizely platform, including Optimizely Content Management System (CMS) and Optimizely Customized Commerce.
Globalization occurs when you create and display website content in different languages and make the user interface display in other languages by localizing user-facing texts.
How does CMS know which language to display to visitors?
Optimizely Content Management System (CMS) enforces language visibility in the URL, in the path or the domain part of the URL, because:
- Search engines, such as Google, must be able to crawl a website and separate content.
- Users expect to cut and paste a link into an email and send it to someone who can click it to get the same content.
There are also technical reasons, such as output caching in .NET, and web browser caching on the client; these expect a single URL to render the same content to anonymous users.
Language concepts
CMS has three different language concepts, two defined by .NET (culture and uiCulture), and one is the CMS content language. See the .NET culture as System Language and uiCulture
as User Interface Language. Languages and language settings are expressed as Cultures (as defined by the .NET CultureInfo
object). A typical culture is EN-US, which defines the language as English (EN) with culturally defined specifics for the United States (US). Sometimes, you may define the language only, such as SV, which defines the neutral Swedish culture.
Terminology
- Culture – An instance of the
CultureInfo
class; the preferred way of passing language information in CMS. - Locale – Never explicitly used in CMS, except where other components require locale. In this case, the locale is read from the
LCID
property of the required culture, usuallyCultureInfo.CurrentCulture
which corresponds to the system language. - Language code – A string that defines the culture to use. See
CultureInfo.Name
for definition and possible values. If you cannot pass aCultureInfo
object, this is the alternative way of specifying language or culture. - Candidate match – Many language selection algorithms make use of candidate matches. If you have a language code
en-GB
, then language codeen
would be a candidate match. Another possible candidate match foren-GB
isen-US
. A candidate match is the first language code that matches the substring before the hyphen.
Language setting types
- System language – Used to control date/time formatting, sort order, and so on.
- User interface language – Controls the localized (translated) resources to display. Determines the language of the user interface and any other place where calls are made to retrieve and display localized texts.
- Content language – The preferred language when displaying content. A LanguageSelector eventually determines the actual content language and depends on the languages available for the content displayed because fallback or replacement languages may be applied on the website.
System language
The system language determines how listings are sorted, how to format date and time, and so on. Because these formatting rules are culturally dependent, the system language must not be a neutral culture.
The following rules determine the system language:
- If not in edit or admin user interface, use the content language.
- If a user is logged in and sets a preferred language, use the personalized language selection for this user.
- Use the setting from
GlobalizationOptions.CultureLanguageCode
. If culture is set to Auto, the language preferences from the web browser are used.
User interface language
The user interface language is used only to pull out localized texts in the web application. It defines most of the texts in the CMS user interface, but for a site visitor, the user interface language applies only to minor elements, such as text on buttons. Most information is usually content for a visitor, defined by the content language.
The following rules determine the user interface language:
- If not in edit or admin user interface, use the content language.
- If a user is logged in and sets a preferred language, use the personalized language selection for this user.
- Use the setting from
GlobalizationOptions.UICultureLanguageCode
. If culture is set to Auto, the language preferences from the web browser are used.
The preferred way to retrieve localized string resources in CMS is through the LocalizationService API. See Localization service.
Content language
The content language controls which language version of the displayed content. It can be a neutral culture or a specific culture.
The following rules determine the preferred content language:
- That language is used if you have defined the hostname to be associated with a specific language. The setting is specified under Manage Sites in the admin view.
- If there is a language segment in the URL (like
http://company.com/en/info
), that language is used (en). - If you are in the edit view and have selected a specific language site from the Sites section, that language is used.
- If the requests contain a query parameter or cookie named
epslanguage
, use the language defined by the query or cookie. - If the setting
GlobalizationSettingsOptions.UseBrowserLanguagePreferences
is true, then the language preference from the web browser is used. - Use the language mapped to wildcard host '*' if specified.
- Fetch the setting from the
GlobalizationSettingsOptions.UICultureLanguageCode
. - If nothing else is discovered, use the first enabled language branch defined in Admin or Language Branches, meaning it can be viewed as the default language.
Updated 6 months ago