Repository navigation
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this changes, and why
Adds first-class UI localization and a complete Russian translation.
internal/i18n:?lang=, cookie, configured default andAccept-Language;1 форма,2 формы,5 форм).DEFAULT_LANGUAGEsetting:auto(browser),en, orru.autois thedefault, so a Russian browser gets Russian without configuration. A typo is
refused at startup rather than silently treated as English.
EN/RU) in the admin sidebar, login page and OAuthconsent page. The preference is stored in a
dsforms_langcookie, and thepublic
/languageroute validates its return path withurlsafe.RelativePath, so it cannot become an open redirect..T/.Plural; handler-generatedflash messages, inline errors, validation text, scope descriptions, spam-rule
labels, dates and relative ages are translated too.
Russian login-page test. Documented
DEFAULT_LANGUAGEindocs/configuration.md,.env.exampleandREADME.md.The approach keeps English as the source language: a missing translation falls
back to readable English instead of an opaque key such as
forms.new.subtitle.A test walks every template and handler
T(...)call and fails when a requestedkey has no Russian entry.
How it was verified
go test -race -count=1 ./... && go vet ./... && gofmt -l .go test -race -count=1 ./...passes for every package.go vet ./...is clean,and
gofmt -l .produces no output.For the manual run I built the binary, started it against a temporary SQLite
database on
127.0.0.1:18080, and requested/admin/loginwithAccept-Language: ru-RU,ru;q=0.9. I saw the Russian login page(
Войти,Имя пользователя), signed in as the default admin, and confirmed thedashboard and sidebar rendered in Russian (
Главная,Заявки). The languageswitcher and its cookie flow were exercised by the route-level test as well.
Tests
The catalogue coverage guard was watched failing: removing the
Formsentryproduced a failure naming all four templates that request it
(
access_fields.html,base.html,dashboard.html), proving it walks the realfiles rather than one known phrase. Restoring the entry made the test pass again.
The guard is deliberately shape-based: every
T(...)call in every template andhandler file is checked, so a new untranslated screen is covered automatically.
Anything a reviewer should push on
a useful fallback, but changing an English sentence silently orphans its
Russian translation. The coverage test catches a missing key, not a renamed
one whose old translation is now dead.
bodies and the quarantine digest remain English; waitlist confirmation and
broadcast text are operator-authored. If email should follow the UI language,
that needs a separate decision about which language an account-less
notification uses.
are displayed inline. They are not template strings and need either translated
error values or a translation layer over store errors.
for a self-hosted single-operator deployment, but it does not follow an account
across devices.
DEFAULT_LANGUAGE=autois the default. Russian browsers switchautomatically, but deployments that expect a fixed English UI may want to set
DEFAULT_LANGUAGE=enexplicitly.