Publish in more than one language

Skip this page if your site has one language. Otherwise you write each item once in the default language and add translations beside it; every other language is published under its own prefix, such as /hi/articles/pricing-guide. The full reference is Languages.

Add the languages

  1. Open Settings, then Localization.

  2. Under Add a language, pick each language (or Other (enter a code)), and set the order they appear in. A code that a page already has as its address, such as pay for an app's /pay, is not accepted.

  3. Check which one is the Default: the language you write in. Its pages keep URLs with no prefix. Choose it before you publish, not after.

  4. Press Save Languages.

Translate

  1. Content type names. Edit each type under Content types and fill in the language tabs: the plural and singular name, the description and the custom field labels. They appear on the public list page and in headings such as "Back to Articles".

  2. Items. In the editor, switch to a language tab and translate. Empty fields fall back to the default language. The URL, cover image, tags and dates are shared by all languages, and Save as draft and Publish apply to every language at once.

  3. Fixed template text, such as "Read more": mark it in your templates, header and footer with data-arc-t="read_more", leaving the default wording inside, and add the key to that language's strings file in your site folder, for example src/custom/site/strings/hi.json. Your keys are merged over Arc CMS's (public/_site/strings/hi.json), so write only the keys you add or reword. A missing key shows the default wording.

The <arc-language-switcher> element in the site header becomes links to the page's other languages, and disappears on a single-language site.

After changing templates or a strings file, deploy the website with npm run deploy, choosing Website or Everything. The deploy publishes every page again afterwards, so they pick up the new text. Publishing reads the strings from the live site, so publishing an item or using Republish website before the deploy still uses the old text.

Write a strings file

A strings file is one JSON object of "key": "text" pairs, one file per language, named after the language code: src/custom/site/strings/hi.json, src/custom/site/strings/fr.json. In your HTML, mark each text with its key and leave the default wording inside:

<a href="/articles"><i class="fas fa-book"></i> <span data-arc-t="nav_articles">Articles</span></a>
<input type="search" placeholder="Search" data-arc-t-attr="placeholder:search_placeholder">
{
  "nav_articles": "लेख",
  "search_placeholder": "खोजें"
}

What stays in one language

Removing a language stops new pages being published for it. Pages already published in that language stay online until the item is republished or unpublished.

Next

Let visitors search your pages: Add search.