Key Concepts › Localization
Overview
Every Tjjar storefront speaks Arabic and English, and Arabic is the default. This page is how the storefront decides which one a page is in, and what that means for your theme.
How the language is chosen
In order:
?locale=aror?locale=enin the address. An explicit choice always wins.- The browser's languages, in the order it lists them — the first that is Arabic or English.
- Arabic.
Your theme does not choose. It reads the result:
| Value | Example |
|---|---|
request.locale | ar |
request.direction | rtl |
request.other_locale | en |
request.other_locale_url | /?locale=en — for a switch |
Addresses
The Arabic page has no parameter: https://elite.tjjar.shop/ is the Arabic homepage, and
https://elite.tjjar.shop/?locale=en the English one. {% wajha_head %} tells search engines
the two are the same page in two languages, and names the Arabic one as the default.
A language switch should always name the language it switches to. That is what
request.other_locale_url does — a link to / alone would send an English-speaking browser
straight back to English:
<a href="{{ request.other_locale_url }}" lang="{{ request.other_locale }}"
hreflang="{{ request.other_locale }}">{{ t.nav.other_language }}</a>
Three things to get right
- Direction — lay out with logical CSS properties so the page mirrors. See RTL & Arabic.
- Numbers and money — Latin digits in Arabic, and never compute with an amount. See Money, Dates & Numerals.
- Your strings — in
locales/ar.jsonandlocales/en.json, with the same keys. See Translation Files.