Developer docs

15. UI language packs

On this page

langpack.proto, all methods public (callable before login). Packs are scoped by client (default "televo-app"); a third-party client may host its own key set under its own name. Codes are lower-case BCP 47 with - (en, zh-hans, zh-hant, pt-br).

  • GetLanguages{client, include_unofficial} lists published packs with strings_count (keys in the en pack) and translated_count (keys the pack or its base_code chain covers). Unofficial (community) packs are listed only on request and MUST be labelled as such in the UI.
  • GetLangPack{client, lang_code} → LangPack{version, strings, sha256, language}: the pack’s own strings only. A pack with base_code inherits missing keys from that pack, recursively (depth ≤ 4), then from the client’s bundled strings, then English.
  • GetDifference{client, lang_code, from_version} → strings changed since from_version plus removed_keys. too_long (from 0, unknown/future version, or more than 100 versions behind): strings is the whole pack; replace the local copy.
  • GetStrings{client, lang_code, keys ≤ 200} for a handful of strings.
  • Update.langpack_updated{client, lang_code, version} is pushed (ephemeral, no gap recovery) to every connected non-bot session when a pack is published. Clients using that pack (or one inheriting from it) call GetDifference; others ignore it. On start a client calls GetDifference with its cached version anyway.

Integrity. sha256 = SHA-256 over the strings sorted by key (bytewise UTF-8), each encoded as key 0x00 value 0x00. After applying a difference the client recomputes it; a mismatch means “fetch the full pack”.

Strings are ICU MessageFormat in Flutter gen-l10n’s unescaped dialect: {name}, {n, plural, =1{…} one{…} other{…}}, {x, select, a{…} other{…}}; ' and # are literal; no offset:, no typed (number/date) arguments; nesting depth ≤ 4. The server validates every import (docs/I18N.md “Validation rules”); clients MUST validate again against their own bundled template and fall back to the bundled string for any string that fails or cannot be formatted — a pack must never be able to break or crash a client.

Links televo://setlanguage/<code> install a (community) pack.

15.1 Community language packs

Any user can translate the app and publish the result (docs/I18N.md “Community packs”).

  • PublishLangPack{client, slug, base_code, name, native_name, strings, dry_run}: the complete pack; the first publish creates it (slug [a-z0-9_]{3,32}, base_code an official published pack), later ones by the same author replace it as a new version. Strings are validated by exactly the rules of admin imports (placeholders, ICU syntax, CLDR plural categories of the base’s plural_code, lengths, controls/bidi, no markup or links that the English string doesn’t have). Problems come back in the response (LangPackStringProblem{key, rule, detail}), nothing is stored then; dry_run only checks. Quota LANGPACKS_TOO_MUCH: 3, Premium 10.
  • The pack gets a server-generated code <base_code>-c<7 chars> (e.g. de-c4k2m9qa), official = false, base_code = the base, so everything in §15 applies to it: GetLangPack, GetDifference, langpack_updated when the author republishes.
  • Unlisted by default: GetLanguages never lists it until an admin sets listed (then only with include_unofficial). It is reachable by link: televo://addlanguage/<slug> and https://<host>/addlanguage/<slug> → ResolveLangPack{slug} (public) → LangPackLanguage with code, author_name (clients show “by <author>” next to “unofficial”), link.
  • GetMyLangPacks, DeleteLangPack{slug}: deleting publishes an empty version (installers fall back to the base language) and frees the slug.
  • Report with ReportRequest.langpack_slug. A takedown publishes an empty version and hides the pack (taken_down).

Generated from docs/PROTOCOL.md in the Telvoro repository. Wire names such as televo.v1 are unchanged.