Repository navigation
feat(settings): add app language override - #567
Conversation
|
Thanks for this, and for the careful write-up. An app language override is a reasonable idea, and we would like to look at it properly. Two things are needed first. 1. Proof on screen. For a change that users see, we ask for screenshots or a short recording in the PR, taken from a build of the branch:
2. Merge CI for a fork needs a maintainer's approval. We will approve the run once the branch merges cleanly and we have read the diff. |
d3225c6 to
5a23127
Compare
|
Rebased onto develop ( |
|
Thanks for the quick rebase and the screenshots. The branch merges cleanly now and the proof covers most of what we asked for: the new row in light and dark, the open list, the Restart Now sheet and the pane after a restart in 简体中文. Three things before we go further:
Once these are in we will read the rest of the diff properly and approve the CI run. Thanks for translating the new strings into all locales, that part is exactly what we ask for. |
|
All three points are in ( 1. Back to "follow macOS". Added: the picker on 跟随系统 after the override was removed, and the pane showing the system language again. Two new PNGs ( 2. Both schemes. The table is in the description too. One note: the suite only passes with an English test host. With the host in 简体中文, 35 assertions fail in this scheme — and also on 3. Restart Now. Now the same shape as For the sandbox: I tried it in a sandboxed test app with the same entitlements. The helper starts, but |
tieubao
left a comment
There was a problem hiding this comment.
Thanks, this is close, and the tests pass on our side too (803 in the Hidden Bar scheme, LocaleCoverageTests included). I approved the CI run. Before merge:
- The "back to follow macOS" screenshots are byte-identical to the earlier system pair, and your Mac runs in Chinese, so they cannot show a change. Please set the override to Japanese, pick "follow macOS", restart, and show the pane back in Chinese.
- The after-restart screenshot shows strings that are not in this branch (
点击菜单栏空白处,敏感应用), so it predates the rebase. Please retake it. - The CHANGELOG entry sits under v1.13.3, which is already released. Please add an
## Unreleasedheading above it. - Please drop
appLanguageand read the app's ownAppleLanguagesonly (LanguagePreferences.swift:26and:49). Otherwise a change in the macOS per-app language panel leaves this picker showing the old value.
Smaller, optional: skip the restart sheet when the pick changes nothing (PreferencesViewController.swift:142), and reuse AppStoreMigration.relaunch(at:) instead of a second copy of the relaunch script.
- General › Language: follow macOS or pick any localization the build ships. The choice is stored as CFBundle's AppleLanguages key, so it takes effect after a restart; macOS's per-app language panel writes the same value. - Keep a separate appLanguage key so "follow the system" stays distinguishable from the global AppleLanguages domain, and read a per-app choice macOS stored in the app's own domain. - Translate the new row in all 13 locales and add LanguagePreferencesTests; extend the every-locale key check. Co-authored-by: CommandCodeBot <noreply@commandcode.ai>
Rendered from a Debug-Direct build of this branch on macOS 27.2.1: the General Language row in light and dark, set to 简体中文 and to follow the system. Co-authored-by: CommandCodeBot <noreply@commandcode.ai>
Captured on macOS 27.2.1: the open language list (each language under its own name), the Restart Now prompt after a choice, and the General pane after restarting in Simplified Chinese. Co-authored-by: CommandCodeBot <noreply@commandcode.ai>
… the sandbox - AppRelaunch now waits for this process to exit (kill -0 loop) instead of sleeping a fixed second, and quits only after the helper started; a helper that cannot start leaves the app open. - The App Store build is sandboxed and its sandbox denies the kill -0 probe, so Restart Now is offered in the direct build only; the caption still tells both builds that the choice takes effect after a restart. - Cover the helper arguments and the build gate, and add the Japanese and back-to-follow-system screenshots. Co-authored-by: CommandCodeBot <noreply@commandcode.ai>
…the relaunch - Drop appLanguage: the row now reads and writes CFBundle's AppleLanguages in the app's own domain, so a change made in the macOS per-app language panel shows up here too. The read uses persistentDomain, never a plain lookup, which would fall back to the global domain and turn "follow the system" into the system language. - Skip the restart sheet when the picked language is the stored one. - AppStoreMigration.relaunch(at:) now calls AppRelaunch, so the app has one reload script. - Move the CHANGELOG entry under a new Unreleased heading; v1.13.3 is released. Co-authored-by: CommandCodeBot <noreply@commandcode.ai>
fbfc982 to
7ac11a5
Compare
…h script - Drop appLanguage: the row reads and writes CFBundle's AppleLanguages in the app's own domain, so a language picked in the macOS per-app panel shows up here too. The read uses persistentDomain, never a plain lookup, which would fall back to the global domain and turn "follow the system" into the system language. - Ask for a restart only when the pick differs from what is stored. - AppStoreMigration.relaunch(at:) calls AppRelaunch, so the app has one reload script. - Move the CHANGELOG entry under a new Unreleased heading; v1.13.3 is released. - Re-render the UI proof from this branch: picker on 简体中文, override set to Japanese, and the override removed (back to the system language, Chinese), plus the whole General pane after a restart. Co-authored-by: CommandCodeBot <noreply@commandcode.ai>
|
All four points are in ( 1. Back to "follow macOS". Regenerated from this branch. I set the override to Japanese, rendered, then removed the override and launched again: the Japanese pair and the follow-system pair now differ (and I deleted the earlier duplicate 2. After-restart screenshot. Retaken. The old one was from the installed build; the new 3. CHANGELOG. Moved under a new 4. Optional items, both done. Picking the stored language no longer opens the sheet ( Both schemes, One thing I want to flag rather than hide: the suite passes only with an English test host. On a host set to 简体中文, 35 assertions fail in the Hidden Bar scheme, on |
…-567 # Conflicts: # CHANGELOG.md
|
Thanks, all four are in, and the two optional points too. Reading only the app's own
One small note for later, not blocking: if macOS stores a region-qualified code such as |
What and why
Adds Settings › General › App language: follow macOS, or pick any localization the build ships. The list shows each language under its own name (English, 简体中文, 日本語, …), so the right row is findable while the app is in another language. The choice is stored as CFBundle's
AppleLanguageskey and takes effect after a restart; the row explains that and offers Restart Now in the direct build.macOS already follows the system language, but it cannot help a bilingual user or someone whose system language is not the language they want for this app. The app had no override of its own.
How it was tested
scripts/test.sh --serial(both schemes, full suite, macOS 27.2.1):LocaleCoverageTests(keys, translations, placeholders) passes.LanguagePreferencesTestscovers native names, theAppleLanguageswrite/remove round trip, reading only the app's own domain, the General pane write path, the relaunch helper's arguments, the build gate, and "same pick, no restart".plutil -lint hidden/*.lproj/*.strings: OK.One environment note: the suite only passes with an English test host. With the host in 简体中文, 35 assertions fail in the Hidden Bar scheme — and also on
developwithout this PR — because several tests compare against English literals (ArrivalsPromptTests,PalettePanelTests,PresentationViewsTests, …). No layout assertion fails there: the clipping test reports zero "needs X pt" / "runs past the width" lines. I left those tests alone; happy to fix them in a separate PR.Restart Now
Same shape as
AppStoreMigration.relaunch(at:): a/bin/shhelper pollskill -0on this process and only then runsopen, so the new instance does not race the old one and quit as a duplicate.NSApp.terminateruns only after the helper started; a helper that cannot start leaves the app open instead of quitting with nothing to reopen it. The migration now calls the sameAppRelaunch, so there is one reload script in the app.Tried in the sandboxed App Store build: the helper starts, but the sandbox answers
kill -0withOperation not permitted(sleepandopenboth work, exit 0), so the wait cannot work there. Restart Now is therefore offered in the direct build only; the "Takes effect after Hidden Bar restarts." caption stays in both builds. Picking the language already stored now does nothing, so no sheet appears for a no-op.UI proof
Every image below is drawn by a Debug-Direct build of this branch:
SettingsSnapshotrenders the window into a bitmap, so the app was launched fresh for each state and no screen-recording permission is needed. Hidden Bar has no light/dark switch: the light and dark images are the same window under the system's light and dark appearance, as the PR template asks. The test Mac's system language is Simplified Chinese.Picker on 简体中文
Override set to Japanese: the whole pane is Japanese
Back to "follow macOS": the override removed, launched again, pane back in the system language (Chinese) and the picker on 跟随系统
The whole General pane after launching with Simplified Chinese, showing this branch's strings
The open list and the Restart prompt