📚 Product Knowledge
Multilingual Content
📖 Docs

Multilingual Content - Optimizely CMS 12

Exam Area: Area 1 – Product Knowledge (15%) Reference: https://docs.developers.optimizely.com/content-management-system/docs/multilingual-content


1. Overview

CMS 12 natively supports multilingual content. Each content item can have:


2. Language Branch Concepts

TermMeaning
Master languageThe language in which content is first created
Language branchA language version of a content item
TranslationCreating content in a secondary language
FallbackServing master language when translation is missing
Language selectorCode object specifying which language to load

3. Access Rights per Language

Access to edit/publish content can be restricted per language:

Admin → Languages → Swedish (sv)
  → Edit permissions:
       WebEditors: ✅ can edit Swedish content
       GermanEditors: ❌ cannot edit Swedish content
// Check if user can edit a specific language
var canEditSwedish = _contentAccessEvaluator.HasAccess(
    page,
    PrincipalInfo.CurrentPrincipal,
    AccessLevel.Edit,
    CultureInfo.GetCultureInfo("sv"));

4. Loading Language Versions in Code

// Option 1: Load a specific language version
var swedish = _contentLoader.Get<ArticlePage>(
    contentRef,
    new LanguageSelector("sv"));

// Option 2: Load with auto-fallback
var page = _contentLoader.Get<ArticlePage>(
    contentRef,
    new LanguageSelector("sv", enableFallback: true));

// Option 3: Load ALL language versions
var allVersions = _contentLoader.GetAllLanguageVersions(contentRef);

// Option 4: Use current thread culture
var current = _contentLoader.Get<ArticlePage>(
    contentRef,
    LanguageSelector.AutoDetect());

5. Creating a Translation in Code

// Create a Swedish translation of an existing page
public ContentReference CreateTranslation(
    ContentReference originalRef,
    string targetLanguage)
{
    // Get existing English version
    var original = _contentLoader.Get<ArticlePage>(
        originalRef,
        new LanguageSelector("en"));

    // Create writable clone for Swedish
    var swedishVersion = (ArticlePage)original.CreateWritableClone();

    // Set language
    swedishVersion.Language = CultureInfo.GetCultureInfo(targetLanguage);

    // Set translated content
    swedishVersion.Heading = "Om oss";  // Swedish heading

    // Save (creating new language branch)
    return _contentRepository.Save(
        swedishVersion,
        SaveAction.Publish,
        AccessLevel.NoAccess);
}

6. Language Fallback Configuration

{
  "EPiServer": {
    "CMS": {
      "LanguageFallbackEnabled": true
    }
  }
}
Fallback chain example:
  nb (Norwegian Bokmål)
    → no (Norwegian)
      → en (English)   ← master language

7. Translating Blocks

Shared blocks also support language branches:

Block: "Call to Action Button"
  en: "Book a Demo"    [Published]
  sv: "Boka Demo"      [Published]
  de: [Not created]    → falls back to en

8. Language in the Edit View

Edit View → Language picker (top toolbar)
  → Switch to Swedish
  → Page tree shows Swedish status badges per page
  → "Not translated" badge = this page has no Swedish version
  → "Add translation" button = create a new language branch

9. Exclude Property from Translation

// A property with CultureSpecific(false) has only one value
// regardless of language — e.g. a sort order or numeric ID
[CultureSpecific(false)]
[Display(Name = "Sort Order")]
public virtual int SortOrder { get; set; }

Review Questions

  1. What is a language branch? (A language-specific version of a content item)
  2. How do you load a content item in a specific language? (_contentLoader.Get<T>(ref, new LanguageSelector("sv")))
  3. What does [CultureSpecific(false)] do? (Makes the property shared across all language branches — not translated per language)
  4. Can language branches have independent publish states? (Yes — Swedish can be Published while German is Draft)
  5. How do you get all language versions of a content item? (_contentLoader.GetAllLanguageVersions(contentRef))