Internationalization
Summary
Neura localizes its own interface strings, the ~14
texts the components render themselves: the date picker's
footer buttons and aria-labels, dismiss/loading labels,
empty-state defaults. Month names, weekday names, and the
first day of the week come from the browser's Intl
data, so every language works there without a
translation file. 42 locale packs ship built in:
every EU official language, the Nordics, and the most-used
world languages (see the list below); anything else registers
a ~14-key pack.
Application text is deliberately out of scope: on
server-rendered pages that belongs to the server's own
resource bundles. The date input format also stays
ISO (YYYY-MM-DD): it's a data contract, not a
display string.
Locale selection
| Source | Notes |
|---|---|
Neura.i18n({ locale: 'cs' }) | Explicit: wins over everything. Set it before components render; existing DOM is not re-rendered. |
<html lang="cs"> | The normal server-rendered path: the server sets one attribute and Neura follows. |
| (neither) | English. |
Locale codes are case-insensitive, and regional codes fall
back to their base language: cs-CZ uses the
cs pack (an exact regional pack, if registered,
wins). Neura.i18n({ locale: null }) clears an
explicit locale and returns to <html lang>
detection.
Examples
Switch locale, then open the date picker or spawn a flag; new components render in the chosen language:
Note what the flag demo shows: its title and body are
application content: the demo script translates them
itself, keyed off Neura.i18n().locale, exactly
as a real app would. The only flag string Neura itself
localizes is the close button's aria-label
("Dismiss" / "Zavřít"; inspect the × to see it).
JavaScript API
Neura.i18n({ locale: 'cs' }); // switch locale (before rendering)
Neura.i18n(); // → { locale, messages }
Neura.i18n({ messages: { today: 'Nyní' } }); // override single keys
Neura.i18n.locales(); // → the built-in locale codes
// Add a language - partial packs fall back to English per key:
Neura.i18n.register('de', {
today: 'Heute', clear: 'Löschen', dismiss: 'Schließen',
chooseDate: 'Datum wählen', prevMonth: 'Voriger Monat',
nextMonth: 'Nächster Monat', hour: 'Stunde', minute: 'Minute',
clearSelection: 'Auswahl löschen', searchOptions: 'Optionen durchsuchen',
noMatches: 'Keine Treffer', noEntries: 'Keine Einträge',
loading: 'Laden', resizeSidebar: 'Seitenleiste anpassen',
});
Neura.i18n({ locale: 'de' });
Built-in locales
en (fallback catalog) plus 42 packs (every EU
official language, the Nordics, and the most-used world
languages):
ar Arabic ·
bg Bulgarian ·
bn Bengali ·
cs Czech ·
da Danish ·
de German ·
el Greek ·
es Spanish ·
et Estonian ·
fa Persian ·
fi Finnish ·
fr French ·
ga Irish ·
he Hebrew ·
hi Hindi ·
hr Croatian ·
hu Hungarian ·
id Indonesian ·
is Icelandic ·
it Italian ·
ja Japanese ·
ko Korean ·
lt Lithuanian ·
lv Latvian ·
mt Maltese ·
nb Norwegian Bokmål (also no) ·
nl Dutch ·
pl Polish ·
pt Portuguese ·
ro Romanian ·
ru Russian ·
sk Slovak ·
sl Slovenian ·
sr Serbian (Cyrillic) ·
sv Swedish ·
th Thai ·
tr Turkish ·
uk Ukrainian ·
ur Urdu ·
vi Vietnamese ·
zh Chinese (Simplified) ·
zh-Hant Chinese (Traditional, also
zh-TW/zh-HK/zh-MO)
One caveat: the packs are machine-translated standard UI
vocabulary awaiting native-speaker review. Serbian ships in
Cyrillic; register a sr-Latn pack if you prefer
latinica.
Right-to-left (RTL) layout
Neura fully supports RTL: set dir="rtl" on
<html> (or any subtree) and everything
mirrors: layout and components (CSS logical properties),
popover alignment, drag directions, and keyboard semantics
(horizontal arrows follow visual direction in tabs
and the date-picker grid, per ARIA practice). Combined with
the ar, fa, he, and
ur packs, those languages are supported end to
end. Try it live: the RTL button in the top
bar flips this whole docs site.
String catalog
| Key | English | Czech (built in) | Used by |
|---|---|---|---|
today | Today | Dnes | date picker |
clear | Clear | Vymazat | date picker |
chooseDate | Choose date | Vyberte datum | date picker (aria) |
prevMonth / nextMonth | Previous/Next month | Předchozí/Další měsíc | date picker (aria) |
hour / minute | Hour / Minute | Hodina / Minuta | date picker (aria) |
dismiss | Dismiss | Zavřít | flags, banners (aria) |
loading | Loading | Načítání | spinner (aria), RESTful table |
clearSelection | Clear selection | Vymazat výběr | select (aria) |
searchOptions | Search options | Hledat možnosti | select (aria) |
noMatches | No matches | Žádné shody | select |
noEntries | No entries | Žádné záznamy | RESTful table |
resizeSidebar | Resize sidebar | Změnit šířku panelu | sidebar (aria) |
What Intl covers automatically
For the active locale the date picker derives month names,
short weekday names, and the first day of the week from
Intl.DateTimeFormat / Intl.Locale
(no dictionary involved). A per-instance
Neura.datePicker(input, {locale}) option still
overrides the global locale where needed.
Easter eggs 🖖
To prove Neura.i18n.register() handles anything
with a BCP-47 code, this page registers three extra locales:
Klingon (tlh, a real ISO 639-2
code; vocabulary after Okrand) and Sumerian
(sux, reconstructed from attested roots;
the previous/next month labels honor the Sumerian
conception that the past lies before you,
igi, and the future behind,
egir), and Hobbitish
(x-hobbit: Westron has no ISO code, so it
demonstrates a private-use BCP-47 tag; and since
Tolkien rendered Westron as English, the pack is proper
Shire-speech). Pick them in the locale dropdown above.
None of them ship in the library bundle, and Intl
has no calendar data for them, so month names fall back -
exactly the graceful degradation a custom locale gets. The
Shire Reckoning (Afteryule, Solmath, Rethe…) must wait for
a custom-month-names date-picker option.
AUI compatibility
Independent of AJS.I18n: the shim's
AJS.I18n.getText continues to serve legacy
consumer code with its own keys; Neura.i18n is
only about Neura's built-in strings. No aui-*
surface involved.