Locales / Multi-Lang Content
Zesty.io Supports multiple locales/languages for each content item
When a Zesty.io Content Instance is created, it uses English as the default language. It is possible to add more languages to a Zesty.io Content Instance. Multi-lang content is premium feature of Zesty.io, reach out to your account manager to learn more.

Adding Multi-lang Content

The API must be used to add additional locales/languages to a Content Instance.
Note: adding a language makes that language's relative pages available in preview, to have a added language be accessible to the live production domain, you need to activate the language
post
https://8-XYZ-XYZXYZ.api.zesty.io
/v1/env/langs/
Adding a Language

What happens when a new language is added?

When a new language is created, Zesty.io's API will automate a process to duplicate all content into a language specific version of that content. The default language is content is copied into the new language version (it is not automatically translated). For example, if you had an english about page (url /about/), and added Spanish with the locale of Mexico, a new content items would be created with the URL /es-mx/about/ and the content item would be pre-filled with the default language content. These means you would have a Spanish placeholder content item with english words in it to start. All copied new language pages start at version one (with default language content pre-filler) and have their own version control.
The default language can only be chosen at the creation of a content instance. Talk to a Zesty.io support tech for help doing this.

How to Activate a language

Languages are added "non-active" meaning they are not accessible via the published website. It is setup that way so developers can add a language and prepare all the content by updates and publishing without affecting the live website. Once a language is ready to go live, it must be activated.
put
https://8-XYZ-XYZXYZ.api.zesty.io
/v1/env/langs/fr-FR?action=activate
Activating a Language

How Does Web Engine Handle Multi-lang/Multi-Locale Content

When Web Engine detects there are multiple languages on a Content Instance it will add specific code that is read by browsers, screen readers, and search engines to direct users to different languages/locales of the content it serves.
For example purposes, let's use the domain www.acme.com, and assume it has two languages, English (en-us) and Spanish (es-mx).
Server Headers Appended for Locale/Multi-lang, per MDN Specs****
Server headers served when accessing https://www.acme.com/about/
1
Content-Language: en-us
Copied!
HTML Appended for Locale/Multi-lang, per Google Specs****
Head and HTML additions on page https://www.acme.com/about/
1
<html lang="en-us">
2
<head>
3
<title>About Acme, Inc</title>
4
<link rel="alternate" hreflang="en-us"
5
href="https://www.acme.com/about/" />
6
<link rel="alternate" hreflang="es-mx"
7
href="https://www.acme.com/es-mx/about/" />
8
<link rel="alternate" hreflang="x-default"
9
href="https://www.acme.com/about/" />
10
</head>
Copied!
XML Sitemap
Auto-generated sitemap gets additional language qualifiers and pointers.
Served at https://www.acme.com/sitemap.xml
1
<?xml version="1.0" encoding="UTF-8"?>
2
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
3
xmlns:xhtml="http://www.w3.org/1999/xhtml">
4
<url>
5
<loc>http://www.example.com/english/page.html</loc>
6
<xhtml:link
7
rel="alternate"
8
hreflang="de"
9
href="http://www.example.com/deutsch/page.html"/>
10
<xhtml:link
11
rel="alternate"
12
hreflang="de-ch"
13
href="http://www.example.com/schweiz-deutsch/page.html"/>
14
<xhtml:link
15
rel="alternate"
16
hreflang="en"
17
href="http://www.example.com/english/page.html"/>
18
</url>
Copied!

Accessing Multi-Lang Locales with Parsley

Accessing the current language using Parsley is done by calling
    {{instance.current_lang.code}}
    {{instance.current_lang.id}}
    {{instance.current_lang.name}}
1
<!-- to access them globally with javascript, add this to the top of the loader file-->
2
<script>
3
CURRENT_LANG_ID = '{{instance.current_lang.id}}'; // 1
4
CURRENT_LANG_NAME = '{{instance.current_lang.name)}}'; // English (United States)
5
CURRENT_LANG_CODE = '{{instance.current_lang.code)}}'; // en-us
6
</script>
7
<!-- this method is useful to array filter out locale content when using headless endpoint with client side javascript-->
Copied!
Parsley can be used to iterate through available languages. {{each langs as lang}} give you access to
    {{lang.code}} string e.g. en-US , es-MX
    {{lang.default}} Boolean 1 or 0, 1 is true
    {{lang.name}} string e.g. English (United States), Spanish (Mexico)
Parsley example usage for each looping through langs
1
{{each langs as lang}}
2
{{if {lang.default} == 1}}
3
{{$path = / }}
4
{{else}}
5
{{$path = /{lang.code}/ }}
6
{{end-if}}
7
<a class="navbar-item" href="{{$path}}">
8
<span class="icon mr-2">
9
<img src="https://4q6k83l9.media.zestyio.com/{{lang.code}}.png?width=32" alt="{{lang.name}} flag"/>
10
</span>
11
<span>
12
{{lang.name}}
13
</span>
14
</a>
15
{{end-each}}
Copied!

List of Languages Zesty.io Supports

Each language has an associated code, that code is used in the API to create a new language for a Content Instance.
Code
Language
af
Afrikaans
af-ZA
Afrikaans (South Africa)
ar
Arabic
ar-AE
Arabic (U.A.E.)
ar-BH
Arabic (Bahrain)
ar-DZ
Arabic (Algeria)
ar-EG
Arabic (Egypt)
ar-IQ
Arabic (Iraq)
ar-JO
Arabic (Jordan)
ar-KW
Arabic (Kuwait)
ar-LB
Arabic (Lebanon)
ar-LY
Arabic (Libya)
ar-MA
Arabic (Morocco)
ar-OM
Arabic (Oman)
ar-QA
Arabic (Qatar)
ar-SA
Arabic (Saudi Arabia)
ar-SY
Arabic (Syria)
ar-TN
Arabic (Tunisia)
ar-YE
Arabic (Yemen)
az
Azeri (Latin)
az-AZ
Azeri (Azerbaijan)
be
Belarusian
be-BY
Belarusian (Belarus)
bg
Bulgarian
bg-BG
Bulgarian (Bulgaria)
bs-BA
Bosnian (Bosnia and Herzegovina)
ca
Catalan
ca-ES
Catalan (Spain)
cs
Czech
cs-CZ
Czech (Czech Republic)
cy
Welsh
cy-GB
Welsh (United Kingdom)
da
Danish
da-DK
Danish (Denmark)
de
German
de-AT
German (Austria)
de-CH
German (Switzerland)
de-DE
German (Germany)
de-LI
German (Liechtenstein)
de-LU
German (Luxembourg)
dv
Divehi
dv-MV
Divehi (Maldives)
el
Greek
el-GR
Greek (Greece)
en
English
en-AU
English (Australia)
en-BZ
English (Belize)
en-CA
English (Canada)
en-CB
English (Caribbean)
en-GB
English (United Kingdom)
en-IE
English (Ireland)
en-JM
English (Jamaica)
en-NZ
English (New Zealand)
en-PH
English (Republic of the Philippines)
en-TT
English (Trinidad and Tobago)
en-US
English (United States)
en-ZA
English (South Africa)
en-ZW
English (Zimbabwe)
eo
Esperanto
es
Spanish
es-AR
Spanish (Argentina)
es-BO
Spanish (Bolivia)
es-CL
Spanish (Chile)
es-CO
Spanish (Colombia)
es-CR
Spanish (Costa Rica)
es-DO
Spanish (Dominican Republic)
es-EC
Spanish (Ecuador)
es-ES
Spanish (Spain)
es-GT
Spanish (Guatemala)
es-HN
Spanish (Honduras)
es-MX
Spanish (Mexico)
es-NI
Spanish (Nicaragua)
es-PA
Spanish (Panama)
es-PE
Spanish (Peru)
es-PR
Spanish (Puerto Rico)
es-PY
Spanish (Paraguay)
es-SV
Spanish (El Salvador)
es-UY
Spanish (Uruguay)
es-VE
Spanish (Venezuela)
et
Estonian
et-EE
Estonian (Estonia)
eu
Basque
eu-ES
Basque (Spain)
fa
Farsi
fa-IR
Farsi (Iran)
fi
Finnish
fi-FI
Finnish (Finland)
fo
Faroese
fo-FO
Faroese (Faroe Islands)
fr
French
fr-BE
French (Belgium)
fr-CA
French (Canada)
fr-CH
French (Switzerland)
fr-FR
French (France)
fr-LU
French (Luxembourg)
fr-MC
French (Principality of Monaco)
gl
Galician
gl-ES
Galician (Spain)
gu
Gujarati
gu-IN
Gujarati (India)
he
Hebrew
he-IL
Hebrew (Israel)
hi
Hindi
hi-IN
Hindi (India)
hr
Croatian
hr-BA
Croatian (Bosnia and Herzegovina)
hr-HR
Croatian (Croatia)
hu
Hungarian
hu-HU
Hungarian (Hungary)
hy
Armenian
hy-AM
Armenian (Armenia)
id
Indonesian
id-ID
Indonesian (Indonesia)
is
Icelandic
is-IS
Icelandic (Iceland)
it
Italian
it-CH
Italian (Switzerland)
it-IT
Italian (Italy)
ja
Japanese
ja-JP
Japanese (Japan)
ka
Georgian
ka-GE
Georgian (Georgia)
kk
Kazakh
kk-KZ
Kazakh (Kazakhstan)
kn
Kannada
kn-IN
Kannada (India)
ko
Korean
ko-KR
Korean (Korea)
kok
Konkani
kok-IN
Konkani (India)
ky
Kyrgyz
ky-KG
Kyrgyz (Kyrgyzstan)
lt
Lithuanian
lt-LT
Lithuanian (Lithuania)
lv
Latvian
lv-LV
Latvian (Latvia)
mi
Maori
mi-NZ
Maori (New Zealand)
mk
FYRO Macedonian
mk-MK
FYRO Macedonian (Former Yugoslav Republic of Macedonia)
mn
Mongolian
mn-MN
Mongolian (Mongolia)
mr
Marathi
mr-IN
Marathi (India)
ms
Malay
ms-BN
Malay (Brunei Darussalam)
ms-MY
Malay (Malaysia)
mt
Maltese
mt-MT
Maltese (Malta)
nb
Norwegian (Bokm?l)
nb-NO
Norwegian (Bokm?l) (Norway)
nl
Dutch
nl-BE
Dutch (Belgium)
nl-NL
Dutch (Netherlands)
nn-NO
Norwegian (Nynorsk) (Norway)
ns
Northern Sotho
ns-ZA
Northern Sotho (South Africa)
pa
Punjabi
pa-IN
Punjabi (India)
pl
Polish
pl-PL
Polish (Poland)
ps
Pashto
ps-AR
Pashto (Afghanistan)
pt
Portuguese
pt-BR
Portuguese (Brazil)
pt-PT
Portuguese (Portugal)
qu
Quechua
qu-BO
Quechua (Bolivia)
qu-EC
Quechua (Ecuador)
qu-PE
Quechua (Peru)
ro
Romanian
ro-RO
Romanian (Romania)
ru
Russian
ru-RU
Russian (Russia)
sa
Sanskrit
sa-IN
Sanskrit (India)
se
Sami (Northern)
se-FI
Sami (Finland)
se-NO
Sami (Norway)
se-SE
Sami (Sweden)
sk
Slovak
sk-SK
Slovak (Slovakia)
sl
Slovenian
sl-SI
Slovenian (Slovenia)
sq
Albanian
sq-AL
Albanian (Albania)
sr-BA
Serbian (Bosnia and Herzegovina)
sr-SP
Serbian (Serbia and Montenegro)
sv
Swedish
sv-FI
Swedish (Finland)
sv-SE
Swedish (Sweden)
sw
Swahili
sw-KE
Swahili (Kenya)
syr
Syriac
syr-SY
Syriac (Syria)
ta
Tamil
ta-IN
Tamil (India)
te
Telugu
te-IN
Telugu (India)
th
Thai
th-TH
Thai (Thailand)
tl
Tagalog
tl-PH
Tagalog (Philippines)
tn
Tswana
tn-ZA
Tswana (South Africa)
tr
Turkish
tr-TR
Turkish (Turkey)
tt
Tatar
tt-RU
Tatar (Russia)
ts
Tsonga
uk
Ukrainian
uk-UA
Ukrainian (Ukraine)
ur
Urdu
ur-PK
Urdu (Islamic Republic of Pakistan)
uz
Uzbek (Latin)
uz-UZ
Uzbek (Latin) (Uzbekistan)
vi
Vietnamese
vi-VN
Vietnamese (Viet Nam)
xh
Xhosa
xh-ZA
Xhosa (South Africa)
zh
Chinese
zh-CN
Chinese (S)
zh-HK
Chinese (Hong Kong)
zh-MO
Chinese (Macau)
zh-SG
Chinese (Singapore)
zh-TW
Chinese (T)
zu
Zulu
zu-ZA
Zulu (South Africa)
Last modified 1mo ago