Get started with languages and translations

  • Updated

Optimizely Configured Commerce integrates multi-language and translation capabilities directly into its content management system (CMS). These tools let site administrators define the website display language for users and create unique content by language code, device type, and user persona. This functionality supports Unicode languages, except languages with right-to-left presentation (such as Hebrew and Arabic).

Database collation is only important for non-Unicode datatypes (char, varchar). Because Configured Commerce supports Unicode, database collation is not a concern.

Storefront implications

Storefront users may view the site in any language marked live under the website's Languages tab. When an anonymous user browses the site, the site automatically displays that user's default browser language code, if available. If that language is not available on the site, the website's default language is displayed.

When logged in, users see the language compatible with the language code defined in their Admin Console user record. The user's language is only used when impersonating the user. Optimizely assumes the user will select the language they prefer on the site before signing in and does not change their selected language.

Users may change the displayed language with the Language Selector menu on the website's header. This selection is saved in the browser's cookie, and the language is used each time the user views the site with that browser.

If no translation is available within the selected language for a section of text, text from the website's default language is displayed. This same hierarchy exists for content properties related to persona and device type.

In Configured Commerce, home pages for multi-language sites have unique URLs. The language code displays at the end of the home page URL for each language.

The date and price format on the storefront depends on the user's selected language. For example, if the date is March 1, 2024 and the price is 59,940 US dollars, the date and price would display as follows for each selected language:

  • fr-ca – 01/03/2024 and $59 940,00
  • en-us – 03/01/2024 and $59,940.00

Hreflang attribute for SEO

For multi-language sites, the URL tags for storefront webpages, sitemaps, and pages themselves contain the hreflang attribute. This attribute identifies the specific language on the page for search engines, thus enabling search engines to serve relevant language results to users searching in that language. If a translated URL is present, then it is used in place of the parameter ?setcontextlanguagecode=.

The value of the hreflang attribute automatically populates based on the Language Code field on the Administration > Languages page. See Create a new language.

URL example for a sitemap

<url>
  <loc>https://commerce.local.com/Catalog/TestCategoryBoost2
  <lastmod>2018-01-23T15:24:12+00:00</lastmod>
  <changefreq>monthly</changefreq>
  <priority>0.8</priority>
  <xhtml:link rel="alternate" hreflang="es-mx" href="https://commerce.local.com/Catalog/TestCategoryBoost2?setcontextlanguagecode=es-mx" />
  <xhtml:link rel="alternate" hreflang="en-us" href="https://commerce.local.com/Catalog/TestCategoryBoost2?setcontextlanguagecode=en-gb" />
  <xhtml:link rel="alternate" hreflang="fr-fr" href="https://commerce.local.com/Catalogue/TestCategoryBoost2?setcontextlanguagecode=fr-ca" />
</url>

URL example for a content page

<url>
  <loc>https://commerce.local.com/ContactUs</loc>
  <lastmod>2016-04-14T21:57:02+00:00</lastmod>
  <changefreq>monthly</changefreq>
  <priority>0.5</priority>
  <xhtml:link rel="alternate" hreflang="es-mx" href="https://commerce.local.com/ContactUs?setcontextlanguagecode=es-mx" />
  <xhtml:link rel="alternate" hreflang="en-us" href="https://commerce.local.com/ContactUs?setcontextlanguagecode=en-gb" />
  <xhtml:link rel="alternate" hreflang="fr-fr" href="https://commerce.local.com/ContactUs?setcontextlanguagecode=fr-ca" />
</url>

Translations

Configured Commerce has options for managing translations:

  • Admin Translation setting – For the Admin Console itself. This lets console users set their default language and provides a debug mode to preview translations.
  • Field translations – For individual fields found on commerce objects, such as products, promotions, or categories. For example, providing a translation for the product title of a particular product.
  • Translation dictionary – For things such as messages, attributes, attribute values, units of measure, and labels. For example, providing a translation for the unit of measure of each.

Generally stated, field translations are more granular in nature and are orientated toward individual records, whereas the translation dictionary is more global in nature and provides translations for text that is shared across the website.

See Translate Spire CMS into other languages for information and a list of supported languages.