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.
Lookup
source → g.translate(source)| Source (key) | g.translate |
|---|
Interpolation & escape
'Hi {name}, you have {count} new messages''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.
| Phrase | Lang | Count |
|---|---|---|
| — | ||