Morten Sæther

← Blog

Content Snippets & Localization

#16 · 22 May 2026

Reusable content blocks, and portals that work in more than one language

Two related problems here. First, the same text is scattered across fifteen pages and legal wants it changed. Second, your portal needs to work in Norwegian and English, and probably German next quarter.

Content snippets fix the first: one place to edit, everywhere updates. Localisation fixes the second, and it’s more than running text through a translator - dates, currency, address formats and reading direction all vary, and getting those wrong reads as carelessness to the people you’re trying to serve.

Step by step

1. Organise your snippets before you have a hundred of them

<!-- Content Snippet Categories and Naming Conventions -->

<!-- Navigation and UI Elements -->
{{ snippets['nav.main.home'] }}                 <!-- "Home" -->
{{ snippets['nav.main.products'] }}             <!-- "Products" -->
{{ snippets['nav.main.support'] }}              <!-- "Support" -->
{{ snippets['nav.breadcrumb.separator'] }}      <!-- " > " -->

<!-- Form Labels and Messages -->
{{ snippets['form.label.first-name'] }}         <!-- "First Name" -->
{{ snippets['form.label.email-required'] }}     <!-- "Email Address *" -->
{{ snippets['form.validation.email-invalid'] }} <!-- "Please enter a valid email address" -->
{{ snippets['form.success.contact-submitted'] }}<!-- "Thank you! Your message has been sent." -->

<!-- Business Content -->
{{ snippets['content.company.tagline'] }}       <!-- "Your trusted technology partner" -->
{{ snippets['content.legal.privacy-notice'] }}  <!-- Privacy policy snippet -->
{{ snippets['content.support.business-hours'] }}<!-- "Monday-Friday, 9 AM - 5 PM EST" -->

<!-- Error Messages and System Notifications -->
{{ snippets['error.access-denied'] }}           <!-- "Access denied. Please contact support." -->
{{ snippets['error.session-expired'] }}         <!-- "Your session has expired. Please log in again." -->
{{ snippets['notification.maintenance-mode'] }} <!-- Maintenance notification -->

<!-- Marketing and Promotional Content -->
{{ snippets['promo.current.banner'] }}          <!-- Current promotional banner -->
{{ snippets['cta.newsletter.signup'] }}         <!-- Newsletter signup call-to-action -->
{{ snippets['testimonial.featured.quote'] }}    <!-- Featured customer testimonial -->

Snippets with variables, so one snippet handles several contexts:

<!-- Parameterized Snippets for Flexible Content -->

<!-- Snippet: 'welcome-message-personalized' -->
<!-- Content: "Welcome back, {name}! You have {count} new {items}." -->

<!-- new_notifications is a fetchxml result; see the web templates post -->
{% assign notification_count = new_notifications.results.entities.size %}
{% if notification_count == 1 %}
    {% assign items_word = snippets['word.notification.singular'] | default: 'notification' %}
{% else %}
    {% assign items_word = snippets['word.notification.plural'] | default: 'notifications' %}
{% endif %}

{% assign personalized_message = snippets['welcome-message-personalized']
   | replace: '{name}', user.fullname
   | replace: '{count}', notification_count
   | replace: '{items}', items_word %}

<div class="welcome-banner">
    {{ personalized_message }}
</div>

<!-- Snippet: 'product-availability-notice' -->
<!-- Content: "Only {quantity} left in stock for {product}! Order by {date} for {shipping}." -->

{% for product in featured_products.results.entities %}
    {% assign availability_notice = snippets['product-availability-notice']
       | replace: '{quantity}', product.cr5f3_stockquantity
       | replace: '{product}', product.name
       | replace: '{date}', shipping_cutoff_date
       | replace: '{shipping}', shipping_method %}

    <div class="product-notice">{{ availability_notice }}</div>
{% endfor %}

Plural forms are a snippet per form, not a filter; Liquid in Power Pages has no pluralize. And a snippet is the one place where the content editor gets to write HTML on purpose, so the replaced values are the part to think about - user.fullname is escaped by default, Dataverse text you pull in yourself is not.

And a management layer once the collection grows:

<!-- Contextual Content Based on User Role -->
{% if user.roles contains 'Premium Customer' %}
    <div class="premium-notice">
        {{ snippets['content.premium.welcome-message'] }}
    </div>
{% elsif user.roles contains 'Trial User' %}
    <div class="trial-notice">
        {{ snippets['content.trial.upgrade-prompt'] }}
    </div>
{% endif %}

<!-- Region-Specific Content, keyed on the contact's country -->
{% assign user_region = user.address1_country | default: 'US' | downcase %}
{% assign region_snippet_key = 'content.region.' | append: user_region %}

{% if snippets[region_snippet_key] %}
    <div class="region-specific-content">
        {{ snippets[region_snippet_key] }}
    </div>
{% endif %}

Build the key in an assign first, then index snippets with it. A filter chain inside the square brackets doesn’t parse.

2. Set up for multiple languages

Site structure first. Languages are enabled per website in the Portal Management app (Website > Supported Languages), each with a publishing state and one of them set as default. From then on, every web page gets a localized child per language, and every content snippet has a Content Snippet Language: {{ snippets['nav.main.home'] }} returns the version for the language the visitor is browsing in, without the template doing anything. The language code sits in the URL, and the built-in Languages Dropdown web template renders the switcher in the header.

What the template sees is the language object:

<!-- The current language -->
{{ language.code }}      <!-- en-US, nb-NO, de-DE -->
{{ language.name }}      <!-- Display name of the language -->
{{ language.url }}       <!-- Current URL prefixed with the language code -->

<html lang="{{ language.code | default: 'en-US' }}">

<!-- Per-language markup, when a snippet isn't enough -->
{% case language.code %}
    {% when 'nb-NO' %}
        <p>{{ snippets['content.legal.notice'] }} <a href="/personvern/">Personvern</a></p>
    {% when 'de-DE' %}
        <p>{{ snippets['content.legal.notice'] }} <a href="/datenschutz/">Datenschutz</a></p>
    {% else %}
        <p>{{ snippets['content.legal.notice'] }} <a href="/privacy/">Privacy</a></p>
{% endcase %}

Fallbacks are a web template, not a capture block; capture stores rendered text, it doesn’t take parameters. A web template named Snippet With Fallback:

{% comment %} Snippet With Fallback: parameters key, fallback {% endcomment %}
{{ snippets[key] | default: fallback }}

<!-- Usage -->
{% include 'Snippet With Fallback' key: 'nav.main.home', fallback: 'Home' %}

Then how translations get managed over time. Each language version of a snippet is its own record in Content > Content Snippets, filtered by Content Snippet Language, and the same goes for localized web pages and web link sets. There is no translation status in Liquid; the tracking is a list you keep, and the thing worth adding to the template is a staging-only marker so missing versions are visible:

{% assign show_missing = settings['Localization/ShowMissing'] | boolean | default: false %}

{% unless snippets['content.support.business-hours'] %}
    {% if show_missing %}
        <span class="missing-translation">[content.support.business-hours: {{ language.code }}]</span>
    {% endif %}
{% endunless %}

The hard part isn’t the first translation. It’s the fourth change to the English source that nobody propagated.

3. Adapt, don’t just translate

<!-- Date and Time Formatting (.NET format strings, chosen per language) -->
{% case language.code %}
    {% when 'en-US' %}
        {% assign date_format = 'MM/dd/yyyy' %}
        {% assign time_format = 'h:mm tt' %}
    {% when 'en-GB' %}
        {% assign date_format = 'dd/MM/yyyy' %}
        {% assign time_format = 'HH:mm' %}
    {% when 'de-DE' %}
        {% assign date_format = 'dd.MM.yyyy' %}
        {% assign time_format = 'HH:mm' %}
    {% when 'nb-NO' %}
        {% assign date_format = 'dd.MM.yyyy' %}
        {% assign time_format = 'HH:mm' %}
    {% else %}
        {% assign date_format = 'MMMM dd, yyyy' %}
        {% assign time_format = 'h:mm tt' %}
{% endcase %}

<div class="event-listing">
    {% for event in upcoming_events.results.entities %}
        <div class="event-card">
            <h4>{{ event.cr5f3_name | escape }}</h4>
            <div class="event-datetime">
                {{ event.cr5f3_starttime | date: date_format }}
                {{ snippets['word.at'] | default: 'at' }}
                {{ event.cr5f3_starttime | date: time_format }}
            </div>
        </div>
    {% endfor %}
</div>

<!-- Currency: symbol and position from snippets, the number from the record -->
{% assign currency_symbol = snippets['format.currency.symbol'] | default: '$' %}
{% assign currency_after = snippets['format.currency.after'] | boolean | default: false %}

<div class="pricing-table">
    {% for plan in subscription_plans.results.entities %}
        <div class="pricing-card">
            <h4>{{ plan.cr5f3_name | escape }}</h4>
            <div class="price">
                {% if currency_after %}
                    {{ plan.cr5f3_price | round: 2 }} {{ currency_symbol }}
                {% else %}
                    {{ currency_symbol }}{{ plan.cr5f3_price | round: 2 }}
                {% endif %}
                <span class="price-period">{{ snippets['pricing.period'] }}</span>
            </div>
        </div>
    {% endfor %}
</div>

<!-- Address layout: the signed-in contact's own address, laid out per language -->
<div class="contact-info">
    {% case language.code %}
        {% when 'en-US' %}
            <address>
                {{ user.address1_line1 | escape }}<br>
                {{ user.address1_city | escape }}, {{ user.address1_stateorprovince | escape }} {{ user.address1_postalcode | escape }}<br>
                {{ user.address1_country | escape }}
            </address>
        {% when 'en-GB' %}
            <address>
                {{ user.address1_line1 | escape }}<br>
                {{ user.address1_city | escape }}<br>
                {{ user.address1_postalcode | escape }}<br>
                {{ user.address1_country | escape }}
            </address>
        {% else %}
            <address>
                {{ user.address1_line1 | escape }}<br>
                {{ user.address1_postalcode | escape }} {{ user.address1_city | escape }}<br>
                {{ user.address1_country | escape }}
            </address>
    {% endcase %}
</div>

The date filter takes .NET format strings, so dd.MM.yyyy and HH:mm, not the strftime codes from Jekyll. Thousands separators and decimal commas have no filter in Power Pages Liquid; round gives you the number, and the separator convention is one more thing the snippet per language carries.

Dates, currencies, number formats, name order, address layout. Norwegians write 19.08.2026 and Americans read that as nonsense.

4. Personalise on top of it

<!-- What the template actually knows about the visitor -->
{% assign user_region = user.address1_country | default: 'US' | downcase %}
{% assign greeting_key = 'welcome.greeting.' | append: user_region %}

<div class="personalized-dashboard">
    <div class="welcome-section">
        {% assign welcome_template = snippets[greeting_key] | default: snippets['welcome.greeting'] %}
        {% assign time_format = 'HH:mm' %} <!-- or pick it per language as in step 3 -->
        {% assign local_time = now | date: time_format %}
        {% assign personalized_welcome = welcome_template
           | replace: '{name}', user.firstname
           | replace: '{city}', user.address1_city
           | replace: '{local_time}', local_time %}

        <h1>{{ personalized_welcome }}</h1>
    </div>

    <!-- Region-Specific Services and Offers -->
    <div class="regional-services">
        <h2>{{ snippets['services.regional.header'] }}</h2>

        {% fetchxml services %}
        <fetch>
          <entity name="cr5f3_service">
            <attribute name="cr5f3_serviceid"></attribute>
            <attribute name="cr5f3_name"></attribute>
            <attribute name="cr5f3_description"></attribute>
            <attribute name="cr5f3_supportphone"></attribute>
            <filter type="and">
              <condition attribute="cr5f3_country" operator="eq" value="{{ user.address1_country | xml_escape }}"></condition>
            </filter>
          </entity>
        </fetch>
        {% endfetchxml %}

        {% for service in services.results.entities %}
            <div class="service-card">
                <h4>{{ service.cr5f3_name | escape }}</h4>
                <p>{{ service.cr5f3_description | escape }}</p>

                {% if service.cr5f3_supportphone %}
                    <p>{{ snippets['contact.phone'] }}: {{ service.cr5f3_supportphone | escape }}</p>
                {% endif %}
            </div>
        {% endfor %}
    </div>
</div>

The data behind this is a custom table with one row per service and country, and the description is a localized column or a separate row per language, whichever your editors prefer. The template only picks rows and prints them. The region and language signals are the contact’s address and the language object; there is no profile, weather or segment data in Power Pages unless you store it on the contact yourself.

5. Automate the workflow

The workflow lives outside Liquid. Snippets, localized pages and web link sets are Dataverse records in the Portal Management app, so a review step is a flag or a status column you add there, and the export for a translator is a view over those records. What the template can do is make the state visible:

<!-- Staging-only: list the snippets this page uses and which ones are missing -->
{% assign show_missing = settings['Localization/ShowMissing'] | boolean | default: false %}
{% assign page_snippets = 'nav.main.home,nav.main.products,content.company.tagline,pricing.period' | split: ',' %}

{% if show_missing %}
    <ul class="translation-check">
        {% for key in page_snippets %}
            <li>
                {{ key }} ({{ language.code }}):
                {% if snippets[key] %}
                    <span class="translation-ok">ok</span>
                {% else %}
                    <span class="translation-missing">missing</span>
                {% endif %}
            </li>
        {% endfor %}
    </ul>
{% endif %}

Turn the site setting on in staging, walk the pages in each language, turn it off in production. The notification to translators when the English source changes is a cloud flow on the content snippet table, which is the part I’d automate first.

What this looks like in practice

A multilingual product page:

{% extends 'Layout' %}

{% block title %}{{ snippets['site.name'] }}{% endblock %}

{% block content %}
{% assign product_id = request.params.id %}
{% assign product = entities.product[product_id] %}

{% case language.code %}
    {% when 'en-US' %}
        {% assign date_format = 'MM/dd/yyyy' %}
    {% when 'en-GB' %}
        {% assign date_format = 'dd/MM/yyyy' %}
    {% else %}
        {% assign date_format = 'dd.MM.yyyy' %}
{% endcase %}

{% assign currency_symbol = snippets['format.currency.symbol'] | default: '$' %}
{% assign currency_after = snippets['format.currency.after'] | boolean | default: false %}

{% unless product %}
    <div class="empty-state">
        <h2>{{ snippets['product.not.found'] }}</h2>
        <a href="/products/">{{ snippets['nav.main.products'] }}</a>
    </div>
{% else %}

<div class="product-detail-page">
    <!-- Breadcrumb Navigation -->
    <nav class="breadcrumb" aria-label="{{ snippets['nav.breadcrumb.label'] }}">
        <a href="/">{{ snippets['nav.main.home'] }}</a>
        {{ snippets['nav.breadcrumb.separator'] }}
        <a href="/products/">{{ snippets['nav.main.products'] }}</a>
        {{ snippets['nav.breadcrumb.separator'] }}
        <span class="current">{{ product.name | escape }}</span>
    </nav>

    <div class="product-grid">
        <div class="product-details">
            <h1>{{ product.name | escape }}</h1>
            <p class="product-number">{{ snippets['product.number'] }}: {{ product.productnumber | escape }}</p>

            <!-- Localized Description: the record carries one column per language -->
            <div class="product-description">
                {% case language.code %}
                    {% when 'nb-NO' %}
                        {{ product.cr5f3_description_nb | default: product.description | escape | newline_to_br }}
                    {% when 'de-DE' %}
                        {{ product.cr5f3_description_de | default: product.description | escape | newline_to_br }}
                    {% else %}
                        {{ product.description | escape | newline_to_br }}
                {% endcase %}
            </div>

            <!-- Price -->
            <div class="pricing-section">
                <div class="price-display">
                    {% if currency_after %}
                        {{ product.price | round: 2 }} {{ currency_symbol }}
                    {% else %}
                        {{ currency_symbol }}{{ product.price | round: 2 }}
                    {% endif %}
                </div>
                <div class="tax-info">{{ snippets['product.tax.info'] }}</div>
            </div>

            <!-- Availability -->
            <div class="availability-section">
                {% if product.cr5f3_stockquantity > 0 %}
                    <div class="in-stock">
                        <span class="status-icon">✓</span>
                        {{ snippets['product.in.stock'] }}
                        {% if product.cr5f3_stockquantity < 10 %}
                            ({{ snippets['product.low.stock'] | replace: '{count}', product.cr5f3_stockquantity }})
                        {% endif %}
                    </div>
                    <div class="shipping-info">
                        {{ snippets['product.shipping.standard'] }}
                        {{ product.cr5f3_availablefrom | date: date_format }}
                    </div>
                {% else %}
                    <div class="out-of-stock">
                        <span class="status-icon">✗</span>
                        {{ snippets['product.out.of.stock'] }}
                    </div>
                {% endif %}
            </div>

            <!-- Order: a basic form on its own page, the product ID carried in the query string -->
            <div class="purchase-section">
                {% if product.cr5f3_stockquantity > 0 %}
                    <a href="/orders/new/?productid={{ product.id }}" class="btn btn-primary btn-large add-to-cart-btn">
                        {{ snippets['product.add.to.cart'] }}
                    </a>
                {% else %}
                    <a href="/products/notify/?productid={{ product.id }}" class="btn btn-outline-primary btn-large notify-btn">
                        {{ snippets['product.notify.available'] }}
                    </a>
                {% endif %}
            </div>
        </div>
    </div>
</div>

{% endunless %}
{% endblock %}

Every label is a snippet looked up by its plain name; the language is picked by the platform. The only places the template branches on language.code are the date format and which description column to read, and that is about as much per-language logic as a template should have.

How to make a mess and fix it

  1. Missing translations - have a fallback, and track translation status so you know what’s stale
  2. Formatting looking wrong to locals - test dates, currency and addresses per region
  3. Slow with localisation on - cache localised content, don’t load snippets one at a time
  4. Translations drifting out of sync - that’s a workflow problem, fix it with process
  5. SEO - hreflang tags and localised URLs, or search engines will pick one and ignore the rest

A word on governance

Multilingual content needs process or it rots. Review before publish, especially for anything legal. Get a native speaker to check quality rather than trusting a machine. Notify translators automatically when the source changes. Keep version history so you can see what changed when. And audit the performance impact periodically.

Wrapping up

Snippets and localisation are how a portal scales to more content and more audiences without the maintenance load growing with it. Build the architecture up front, adapt beyond the words, and put a workflow around keeping it current.

Next: site settings and configuration - the global switches that affect everything.