Build packages / CI (push) Blocked by required conditions
Build packages / Version (push) Waiting to run
CI / Web (format, types, tests, bundles) (push) Blocked by required conditions
CI / ShellCheck (push) Blocked by required conditions
CI / ucode static checks (push) Blocked by required conditions
CI / ucode compiles and tests pass (OpenWrt 24.10) (push) Blocked by required conditions
CI / ucode compiles and tests pass (OpenWrt 25.12) (push) Blocked by required conditions
- Russian translation. The admin pages, the LuCI menu and the router's messages (errors, Health checks, update steps, the service log) come in Russian with the new luci-i18n-dawnline-ru package, released beside the app. LuCI shows it when its language is Russian, or "auto" with a Russian browser - The translation installs with install.sh when LuCI is in Russian (or with --lang ru), follows every Dawnline update and rollback, and can be added or removed in Components → Dawnline → Translation - The portal speaks the visitor's language: it opens in the system's language and switches between English and Russian in place, from the language pill beside its QR code. It carries its own translation and needs no package - Set-up steps quote the apps' own menus word for word, in Russian too: AmneziaVPN is "+ → Insert → Continue" (it has no "Add server"), and the Mac and Windows menus of WireGuard and AmneziaWG have their real names - Questions in the portal (Reconnect, Remove) read from the left edge and close with Cancel, without × - Numbers, sizes and dates follow the page's language. A server that can't start says why in one sentence; event details and service log lines read as whole sentences - README in Russian (README_ru.md). rules/i18n.md: how strings are written and translated; CI checks the catalogs (npm run i18n:check)
13 KiB
13 KiB
Translations (admin UI, portal, backend messages)
Dawnline is written in English and translated through gettext catalogs. Russian is the first translation. Read with frontend.md (and backend.md for messages the router sends).
The rule
- What is added is localized in the same change. A new page, section, control, toast, error, check or log line in the admin UI, the portal or the backend comes with its strings wrapped (
_(),N_(),plural(),L_()) and translated in everyru.po. Not "later": CI refuses a catalog with an untranslated string. - What is removed leaves nothing behind. Deleting or rewording text deletes its old entries:
npm run i18ndrops every entry no code uses any more, andnpm run i18n:check(CI) fails while a catalog still holds one. No dead entries, no hand-kept leftovers, no commented-out translations: the catalogs follow the code, as the code followscode-standards.md("Delete, don't deprecate"). - Every change to visible text is checked in Russian too: the wording against the glossary below, the layout at narrow widths (Russian runs longer).
How it fits together
- Admin UI (LuCI). Every visible string goes through LuCI's globals
_()andN_(). The catalog ispackage/luci-app-dawnline/po/ru/dawnline.po; luci.mk compiles it with po2lmo into the separate packageluci-i18n-dawnline-ru(/usr/lib/lua/luci/i18n/dawnline.ru.lmo, plus the uci-defaults that adds Russian to LuCI's languages). LuCI loads it when the page language is Russian (luci.main.lang, orautowith a Russian browser). Without the package everything stays English. The LuCI menu titles (menu.d) are in the same catalog. - Portal. Not LuCI: it carries its own catalog (
web/src/portal/i18n/ru.po, made into a lookup table at build time and bundled intoportal.js), so it speaks Russian on every router, with or without the admin's package.portal/i18n.tsinstalls_()/N_()with LuCI's meaning, opens in the visitor's kept choice or the browser's language, and the language menu in the breadcrumb switches it in place. The demo's own strings are inweb/src/portal/demo/i18n/. - Shared code (
web/src/shared) runs in both and is in both catalogs. - Backend messages (ucode:
die()texts, health checks, endpoint verdicts, the updater's phases) go through_()/N_()fromdawnline.i18nand are in thedawnlinecatalog too. The admin page sends its language with every RPC call (lang, added byweb/src/admin/api.tsand stripped byrpcd/ucode/luci.dawnline), the updater gets it from the job's start (DAWNLINE_LANG), the portal's CGI fromAccept-Language(the portal's fetch sends the visitor's choice).dawnline.i18nreads LuCI's catalog throughluci.core, so the backend speaks Russian whereluci-i18n-dawnline-ruis installed; the portal page translates what reaches it in English fromportal.uc,devices.uc,core.ucandawg.ucwith its own catalog. The agent's and the CLI's terminal output stay English. Text the backend stores and shows later is stored as a code (or, for service log lines, asL_()templates) and put into words when it is read. - Delivery. The release has
luci-i18n-dawnline-ru-<version>.{ipk,apk}next to the app.install.shadds it when LuCI is in Russian (its setting, orluci-i18n-base-ruinstalled) or with--lang ru; the updater installs it with every Dawnline update when it is installed; Components → Dawnline → Translation adds or removes it. LuCI reads a language's catalogs once per web server process, so each of these restarts uhttpd afterwards. - Collecting.
npm run i18n(inweb/) reads the code and rewrites the.pottemplates and the.pofiles: new strings are added untranslated, gone ones removed, translations kept (and reused across catalogs).npm run i18n:check(CI) fails when a catalog is out of date, a string is untranslated, or a translation lost a placeholder. After changing visible text: runnpm run i18n, translate the new entries in eachru.po, commit the catalogs with the code.
Writing strings
- Every visible string is wrapped: text, buttons, headings, toasts, errors, tooltips (
title),aria-label,placeholder,alt, the page title, confirm dialogs, CSV headers. Not wrapped: product and protocol names standing alone (Dawnline, AmneziaWG, WireGuard, OpenWrt, LuCI), ids, keys, paths, commands, package names, CSS classes, URLs, values sent to the router, log/event ids,consoleoutput. - Literals only.
_('Save'), never_(label)or_(`Hello ${name}`): the extractor cannot collect them and fails. Placeholders%s(or%d) are filled withfmt()fromshared/i18n.ts:fmt(_('Removed %s'), name). - Whole sentences. Never glue a sentence from pieces (
'Removed ' + name + ' from ' + circle, or_('ends') + ' ' + date): word order and case endings differ. One msgid per sentence with placeholders. Pieces joined by separators (PC · 10.0.0.2 · online) are separate facts and stay separate strings. - Elements inside a sentence (a link, a
<b>):fill(_('Install it in %s'), link)returns the children forE()/h(). The link text is its own_(). - Counts go through
plural(n, '%s device', '%s devices')(number formatted, both forms literals) orN_(n, 'Device', 'Devices')when the number is not in the text. Nevern === 1 ? … : …or`${n} devices`: Russian has three forms (1 устройство, 2 устройства, 5 устройств), and 21 takes the singular. Use them even where English always has the plural. - Numbers and dates in the page's language:
num(n)(2,000 / 2 000),num(v, 1)for one decimal,bytes(),fmtDay(),toLocaleDateString(locale(), …). Never a hard-coded'en-GB'ortoFixed()for shown numbers. - Text is made when it is drawn, inside functions, never at module level in the portal and the shared code (the portal changes language in place; the extractor refuses it there). A table of labels becomes a function:
kindLabel(k)inshared/format.ts. - Context when one English word means two things:
_('Off', 'state')vs_('Off', 'switch'). Use it only for real clashes. - Whitespace and line breaks are not part of a msgid: no leading/trailing spaces, no double spaces, no
\n(LuCI squeezes whitespace before the lookup; po2lmo cannot carry newlines). Put spacing in the markup or the separator. - Keep the English as it is when wrapping, except to turn a glued sentence into one with placeholders.
- Other apps' labels (the menus of AmneziaVPN, WireGuard and AmneziaWG in set-up steps) are quoted word for word, with a context of their own (
_('Create from QR code', 'WireGuard app')), and translated with the app's own Russian from its sources (English where the app has no Russian). Where they come from is noted inportal/setup.ts. - Messages from the router arrive in the page's language already (admin) or are translated with
routerText()(portal): never glue them into a sentence of the page's own; ask the backend for a whole sentence instead.
Writing backend messages
import { _, N_ } from 'dawnline.i18n';and wrap literals only:die(_('Backup not found.')),die(sprintf(_('Download failed: %s'), asset)),sprintf(N_(n, '%d device', '%d devices'), n). Placeholders%sand%donly, filled after the lookup._()inside functions only: rpcd keeps the modules loaded and the language changes with each call (the extractor refuses module-level calls).- Wrap what a person reads in LuCI or the portal; leave ids, status values, command lines and sentinels alone.
- Messages a portal visitor can get belong in
portal.ucordevices.ucand are best static sentences: the page can translate those without the package. - Service log lines (
slog()and the watchdog's problem/back/what texts) are written once, in English, by processes with no language (the agent), and read later. Mark their words withL_()instead of_():slog('awg', 'up', sprintf(L_('updated · %s → %s'), a, b), null, L_('System packages')).L_returns the English; the extractor collects it into the catalog and intoweb/src/admin/events/log-templates.ts, and the admin page matches each line against those templates and translates it (logText()inevents/model.ts), values and nested templates included. Keep a template's English when you touch it (lines already in logs match it), and give the Russian the agreement its subject needs; a translation may start with «:» to go on after the subject («Сервер Home: AmneziaWG не работает»).
Russian
Write like a careful Russian product (Telegram, Яндекс), not a word-for-word translation.
- Tone: polite and short, «вы» in lower case. Buttons and menu items are verbs in the infinitive (perfective where it fits): «Сохранить», «Удалить», «Скопировать», «Добавить устройство», «Изменить»; «Отмена» for Cancel, «Закрыть», «Готово», «Назад», «Далее».
- States in forms that fit any person: «На паузе» (not «Приостановлен/а»), «Доступ закончился», «В сети» / «Не в сети». Prefer constructions without gender; when unavoidable, masculine as the neutral form.
- Typography: «ёлочки» for quotes, «ё» where it belongs (ещё, всё, истёк), the ellipsis character «…». No em dashes (—): where a dash is needed, a plain one with spaces ( - ), or a colon or a comma (the catalog check refuses «—»). Ranges keep the en dash (1–32, 07:00–23:00). Numbers with a space before units: «1,5 ГБ», «20 Мбит/с».
- Units: Б, КБ, МБ, ГБ, ТБ; бит/с, кбит/с, Мбит/с, Гбит/с; «5 мин назад», «3 ч назад», «2 дн. назад»; «2 д 5 ч», «5 ч 12 мин», «12 мин».
- Length: Russian runs ~20–30% longer. Keep buttons, pills, tabs and segmented controls short (abbreviate or rephrase), and check the layout in the browser at narrow widths.
- Product and technical names stay as they are: Dawnline, AmneziaWG, AmneziaVPN, WireGuard, OpenWrt, LuCI, GitHub, Cloudflare, Let's Encrypt, DDNS, DNS, MTU, UDP, TCP, IPv4/IPv6, NAT, CGNAT, LAN, WAN, QR-код, opkg/apk.
Glossary
| English | Russian |
|---|---|
| server | сервер |
| person / people (the page) | человек / люди («Люди»); Add person — «Добавить человека» |
| device | устройство |
| circle | круг |
| access | доступ |
| home network | домашняя сеть |
| internet | интернет |
| home network + internet | домашняя сеть и интернет |
| portal, personal link, personal page | портал, личная ссылка, личная страница |
| invite (card) | приглашение (карточка приглашения) |
| disguise; Off / Balanced / Maximum | маскировка; Выкл. / Сбалансированная / Максимальная |
| data limit | лимит трафика |
| usage, traffic | трафик |
| end date; ends in 3 days | дата окончания; закончится через 3 дня |
| allowed hours; outside allowed hours | часы доступа; вне часов доступа |
| pause / resume; paused | приостановить / возобновить; на паузе |
| online / offline; last seen 12 min ago | в сети / не в сети; «В сети 12 мин назад» (not «Было в сети») |
| set up a device; setup | настроить устройство; настройка |
| app | приложение |
| key, public key, private key | ключ, публичный ключ, приватный ключ |
| configuration file (.conf) | файл конфигурации (.conf) |
| endpoint, public address | адрес сервера, публичный адрес |
| port, port forward | порт, проброс порта |
| tunnel | туннель |
| handshake | рукопожатие |
| router | роутер |
| firewall, zone | межсетевой экран, зона |
| interface, network | интерфейс, сеть |
| certificate | сертификат |
| Overview / Servers / People / Activity | Обзор / Серверы / Люди / События |
| Diagnostics / Health / Logs | Диагностика / Состояние / Журналы |
| Settings / Components / Updates | Настройки / Компоненты / Обновления |
| backup, restore | резервная копия, восстановить |
| check (health), fix | проверка, исправить |
| What's new | Что нового |
| Advanced | Дополнительно |
| watchdog | автовосстановление |
| places (map) | места |
| Copied | Скопировано |
| Undo | Отменить |