This repository was archived by the owner on Sep 27, 2026. It is now read-only.
Repository navigation
Internationalisation
Syed Ahmer Shah edited this page Sep 27, 2026
·
1 revision
GleanGrid ships in English, Urdu (RTL), Arabic (RTL), Hindi, Russian, Chinese, Spanish and French.
- Dictionaries live in
resources/js/i18n/<locale>.jsas nested objects. - English is bundled; every other language is its own chunk, fetched once — before the first paint for returning visitors, or when the switcher is used (
lib/i18n.js). -
useT()returnst(key, params, fallback); placeholders use:namesyntax:t('farmers.eyebrow', { count: 11 })→ "11 growers". -
useFormat()gives locale-aware numbers, currency, dates, times, weekday names and relative time. -
<html lang dir>is set server-side from the session/user locale (SetLocalemiddleware), so RTL layouts render correctly on first paint. Components use logical properties (ms-*,pe-*,start-*) andrtl-flipfor directional icons. - Each script gets suitable fonts (Noto Nastaliq Urdu, Reem Kufi, Tiro Devanagari, Noto Serif SC…), loaded only when that language is chosen.
- Policy pages are published in English as the governing version and say so in other languages.
- Add the key to
en.js. - Add the same key, with the same
:placeholders, to the seven other files. - Use it:
t('section.key').
- Create
resources/js/i18n/<code>.jsby copyingen.jsand translating. - Register a loader in
lib/i18n.js(and optional fonts inlocaleFonts). - Add the locale to
config/gleangrid.php → localeswith its native name anddir. - Test the switcher, RTL (if applicable), dates and currency.
GleanGrid · MIT licence · Live site · Report a security issue · Built in Hyderabad, Sindh