Key highlights
- Translated book pages: each book page carries a language and links to the page it was translated from.
- The visitor's language: the site is translated into the language a visitor picks.
Every Core dna product, release by release, newest first. Each product ships on its own schedule.
Book Translations and Site Language
Book pages can be translated, and visitors can switch between the language versions. The site's language now follows the visitor's choice.
Book pages can now have translated versions. With localisation switched on, each book page has a Language and a Source: the page it was translated from. The Books listing gains a Languages column with a flag for every language version of a page, so you can move between translations from the list, and visitors can switch between the linked versions on the site.
{* Links to every language version of this book page *}
{foreach $page->getOtherLanguageVersions() as $lcid => $version}
<a href="{$version->getFullPath()}" hreflang="{$lcid}">{$lcid}</a>
{/foreach}
{# Links to every language version of this book page #}
{% for lcid, version in page.getOtherLanguageVersions() %}
<a href="{{ version.getFullPath() }}" hreflang="{{ lcid }}">{{ lcid }}</a>
{% endfor %}
The language a site is translated into now follows the visitor's own choice. When a visitor picks a language, for example with a language switcher in your theme, the site is translated into that language instead of the admin default. The choice is kept in the cdna_locale cookie as a two-letter language code, which the theme sets in the browser:
// The visitor picked German
document.cookie = 'cdna_locale=de; path=/';
location.reload();
Was this page helpful?
Your answer goes to the docs team.