Repository navigation
Interface in Chinese and English, following the account, the device or the system - #5
Merged
Merged
Conversation
Every string the app shows comes from one Strings interface in core with a Chinese and an English implementation, so a missing translation does not compile. LanguageSettings picks the language: the signed-in account's choice, then the choice made on this device (remembered), then the system's language (first supported one, English otherwise). A new account starts with the language in use when it registered. A picker sits in the library menu, the libraries list and the account sheet. Until the server stores the account's language, it is kept on this device per account; IvyApp marks where it will be sent and read. Requests carry Accept-Language. Dates and relative times follow the language; the sync node is still preselected by the system's region. The editor page gets setLanguage for its placeholder and formatting words. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NZ7eDkNbqLj8z7BEXeW8wW
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NZ7eDkNbqLj8z7BEXeW8wW
User.language (from /me and sign-in) comes first when a synced library is
open; "" means not set and falls back to this device's choice, then the
system. Choosing in settings while signed in sends PATCH /me {language}
("follow the system" clears it); a change made offline is kept as pending,
wins over the server's older value and is sent on the next open or return
to the foreground. Registration sends the language in use.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NZ7eDkNbqLj8z7BEXeW8wW
…nguage callback The shared editor now follows <html lang>, which setLanguage sets, so its link, task and completion words follow the interface too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NZ7eDkNbqLj8z7BEXeW8wW
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NZ7eDkNbqLj8z7BEXeW8wW
The in-app updater merged from main showed Chinese only; its dialog, about sheet, toasts and installer messages now come from Strings in both languages. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NZ7eDkNbqLj8z7BEXeW8wW
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.
Summary
The app now speaks 简体中文 and English, and the account's language is wired to the server's new language API (ivynote#36, guide §界面语言).
Which language is used
User.languageis set: the account's language, the same on every device.Server integration
POST /auth/registersendslanguagewith the language in use at sign-up.PATCH /me {language}. "Follow the system" clears it ("").Accept-Language.Implementation
core/…/Strings.ktis oneStringsinterface withZhStringsandEnStrings, so a missing translation does not compile. Core messages (errors, validation, shelf labels, regions, media filters) readL10n.s.LocalStrings, a static composition local, so a language change recomposes everything below it.LanguageSettings(core) resolves the language and keeps the pending changes.OpenLibraryfeeds itUser.languageand pushes pending changes throughSessionStore.pushLanguage.ivy.setLanguage, which localizes its placeholder and formatting words. It also sets<html lang>, which the shared editor follows. The bundle is rebuilt from ivynotemain.Testing
./gradlew :core:test: newLanguageTestcovering resolution, persistence, account priority, pending and pushed changes, and English plurals. NewApiClientTestcases cover the register body,PATCH /meandAccept-Language.Generated by Claude Code