fix(i18n): banner/push follow the interface language even without a Settings change #118
Reference in New Issue
Block a user
Delete Branch "feature/banner-language-followup"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
A user who never changed the language in Settings stayed on the creation-time preferred_language seed after switching the device language: UI followed the device (ru) but the banner + out-of-app push (both server-resolved from preferred_language) stayed en. The on-adopt reconcile was gated on an explicit local choice (localeLocked); a system-guess locale was never pushed.
Reconcile preferred_language to the active interface locale on every adopt/link regardless of how it was chosen (persistLanguageToServer self-gates for guests / when equal). Banner + push are the only server-rendered language surfaces and both read preferred_language, so the whole interface stays consistent. Drops the now-dead localeLocked flag.
Stacked on #117 (bot welcome) — diff self-cleans once #117 merges. Review on the contour: open on an en device, switch to ru, reopen — banner should be ru.
The main bot answered /start with a single English line ("Tap to open Scrabble."). Localize it: Russian or English by the sender's reported Telegram language (Message.from.language_code, which the Bot API carries on the message itself — there is no separate user-update event — English fallback), with the longer welcome copy and a localized launch button ("Открыть «Эрудит»" / "Open “Erudite”"). The welcome links the game channel and the discussion chat by their public @username, resolved once at startup from the configured TELEGRAM_GAME_CHANNEL_ID / TELEGRAM_CHAT_ID via getChat and cached. A handle that is unset, private, or unreadable degrades to a generic noun ("the channel" / "our chat") rather than a dangling "@", so the paragraph always reads cleanly (the bot's info screen still lists the real links). Adds GameChannelID to bot.Config (wired from the existing config) for the channel handle. Tests: startText localization + handle embedding + per-slot generic fallback; handleStart language selection; resolveWelcomeHandles. README updated.