Languages
ALIAS speaks your user's language in three places: what your product says (its name, its fields' labels, its contact consent), what the service says (its built-in consent and its refusals), and the words the clients bring (the redaction dialog, the Swift views, and a ready set for your own screens). English and Polish are built in. Your product's own words can be in any language you write them in.
What users write and what support answers aren't translated. A report arrives as written.
How the language travels
Your app tells the client its language. The client sends it as Accept-Language on every call, and the service answers in the best match:
| What | Comes in | Falls back to |
|---|---|---|
| The product's name, fields' labels and contact consent | the request's language, where the product has a translation for it | the words as written in the product |
| The built-in contact consent (when the product sets none) | English or Polish | English |
Refusals ({"error": "…"}) | English or Polish | English |
Only the language matters, not the region: pl-PL, pl_PL and pl are the same. With several languages (pl;q=0.9, de;q=0.8), the first the product has wins.
GET /api/v1/product says which language its words came in, as lang ("" means as written), and is sent with Vary: Accept-Language so caches keep each language apart.
Setting it in the client
Each client takes the device's language by default, so most apps set nothing.
| Client | Option | Default | None sent |
|---|---|---|---|
| TypeScript | new AliasClient({ …, lang: 'pl' }) | navigator.language (the browser's; Node 21+ has the system's) | lang: '' |
| Swift | AliasClient(…, language: "pl") | AliasClient.defaultLanguage: the app's preferred localization, else the user's first language | language: nil |
| Godot | alias.language = "pl" | OS.get_locale_language() | "" |
Set it to the language your app is shown in, not the system's, when the two differ. An app in English on a Polish phone should send en, or the consent text will be in a language the rest of the screen isn't.
In TypeScript and Swift the language is fixed for the client's life: when the user switches language in your app, make a new client (the identity is kept in the store, so nothing is lost). In Godot, set alias.language and call get_product() again.
The contact consent
Each language's consent text has its own version. The client sends back the version of the text it showed, and the service records that text, in that language, with the contact.
Show the consent from the product you fetched with the same language you send:
const alias = new AliasClient({ url, key, lang: appLanguage });
const p = await alias.getProduct(); // p.contact_consent in appLanguage, where it's translated
// show p.contact_consent.text whole, by the field, with an unticked checkbox
await alias.setContact('email', value, p.contact_consent);Don't mix languages: a Polish screen showing the English text, or sending the English version after showing Polish, records a consent to a text the user didn't read. When you change a translation, the next users agree to the new text, and earlier consents keep the text they were given.
Words for your own screens
Most apps draw their own Report a problem screen. Each client has the words it needs in English and Polish, with the same names everywhere: the screen's title and prompts, the contact field, Send and Sending, the statuses as the user sees them, You and Support, and "{n} new answers" in the language's plural forms.
import { wordsFor, plural } from 'alias-support';
const w = wordsFor(alias.lang, { reportTitle: 'Tell us what went wrong' }); // yours over the built-in ones
w.statuses[ticket.status]; // "W toku"
plural(3, w.newAnswers, alias.lang); // "3 nowe odpowiedzi"var words = AliasLabels(language: "pl") // the views take the client's language unless you pass labels
words.send = "Wyślij zgłoszenie"
words.newAnswers(3) // "3 nowe odpowiedzi"var w := alias.words() # AliasWords for alias.language, alias.labels over them
w["status_in_progress"] # "W toku"
alias.plural(3, "new_answers") # "3 nowe odpowiedzi"A language ALIAS hasn't gets English. To bring one, pass every word as overrides (labels in the redaction dialog and the Swift views, wordsFor(lang, …) in TypeScript, alias.labels in Godot) and give the plural forms in CLDR's order for that language: plural() picks the form with Intl.PluralRules, so any language's rules work in TypeScript. Swift and Godot know English and Polish rules; another language gets the English rule (one, other).
The redaction dialog has its own small set: openRedactor(image, { lang, labels }) in TypeScript, AliasRedactor.open(parent, image, language, labels) in Godot, AliasRedactorView with the labels in Swift.
Translating your product
On the panel: Products → Translations adds a language by its code (pl, de, pt: two or three letters) with the product's name, each field's label and the consent text. Anything left empty is as written. In the configuration file, the same is [product.i18n.<code>]:
[[product]]
id = "atlas"
name = "Atlas"
contact = "optional"
contact_consent = "Atlas support may use this to reach you about your reports."
[product.i18n.pl]
contact_consent = "Wsparcie Atlasa może użyć tego kontaktu, aby odezwać się w sprawie Twoich zgłoszeń."
fields = { region = "Region", build = "Wersja" }Write the product's words in your app's main language, and translate into the languages your app ships in. A user whose app asks for a language the product has no translation for sees the words as written.
Telemetry
The service doesn't record the user's language. If support needs it (to answer in it), send it in your telemetry, for example { "locale": "pl-PL" }. Support sees it with the report.
A checklist
- Pass the language your app is shown in (or leave the default if it follows the device).
- Show the consent from
getProduct()in that language, and send that consent back. - Use the built-in words, or your own over them, for statuses and counts, so they match the rest of ALIAS.
- Make a new client when the user switches language (TypeScript, Swift).
- Translate the product's name, fields and consent into each language your app ships in.