i18n tests

g.translate: language switch, {var} interpolation + escape, submit-for-translation

i18n — g.translate, one language file per language

Interface strings go through g.translate(text, vars). The source (English) string is the key; the base language returns it as-is, other languages look it up in the loaded file and fall back to the source when missing. Placeholders are {var}; double the braces ({{ }}) to print a literal brace. The language is resolved server-side (here from the genus-lang cookie) — switching sets the cookie and reloads.

Current language:
en = no file (identity) · ro = file loaded · fr/de/es = no file → fallback + submit

Lookup

source → g.translate(source)
Source (key)g.translate

Interpolation & escape

Interpolated 'Hi {name}, you have {count} new messages'
Escaped 'Use {{name}} to show a literal placeholder, e.g. {name}'

Submit for translation — g.settings.submitForTranslation

When a string is missing for a non-base language and submitForTranslation is on, genus POSTs it once (deduped) to g.settings.translationEndpoint. Type a phrase and translate it — on ro/fr/de/es a missing phrase gets registered below (on en nothing is submitted). The mock endpoint is server/api/examples-demo/system/translations/register.js.

Result:
Registered for translation (from /examples-demo/system/translations/list)
PhraseLangCount