Skip to content

fix(launcher): 按首选语言识别应用本地化名称 - #3

Merged
DCjanus merged 2 commits into
mainfrom
fix/app-localization-foundation
Oct 16, 2026
Merged

DCjanus merged 2 commits into
mainfrom
fix/app-localization-foundation

Conversation

@DCjanus

@DCjanus DCjanus commented Sep 17, 2026 •

Copy link
Copy Markdown
Member

Related issue

abue-ammar#753

What changed

  • 启动器现在根据用户的首选语言,从应用实际提供的本地化资源中选择显示名称。
  • 简体中文环境可以同时识别系统应用常见的 zh_CN 和第三方应用常见的 zh-Hans,其他带文字系统或地区的语言也按同一规则回退。
  • 首选语言对应的名称用于展示,英文等其他本地化名称继续作为搜索别名。

实现上先收集 InfoPlist.loctable 与 .lproj 中实际存在的本地化标识,再由 Foundation 在同一语言和文字系统内排序,避免为具体语言维护特例。

Memory footprint

扫描未缓存的应用 bundle 时构造一个短生命周期的本地化标识列表,不新增长期状态。

Leak-tested: 不适用;未改变对象生命周期或 UI 生命周期。

Drawbacks

每次未缓存的 bundle 扫描会枚举 Resources 顶层目录以发现 .lproj 文件夹。

Tests & validation

  • 覆盖 zh_CN loctable、zh-Hans.lproj、带文字系统的开发语言、不支持的首选语言,以及区域语言回退。
  • 整合态全量测试中本功能的 app-name-test 通过;Debug 构建成功。

@DCjanus DCjanus changed the title fix(launcher): resolve app localizations with Foundation fix(launcher): 使用 Foundation 解析应用本地化 Sep 17, 2026
@DCjanus DCjanus changed the title fix(launcher): 使用 Foundation 解析应用本地化 fix(launcher): 按首选语言识别应用本地化名称 Sep 17, 2026
@DCjanus
DCjanus added this pull request to stack #5 September 17, 2026 07:19
@DCjanus
DCjanus force-pushed the fix/app-localization-foundation branch from cd68b9a to d1e0cde Compare September 17, 2026 08:01
@DCjanus
DCjanus removed this pull request from stack #5 September 17, 2026 08:03
@DCjanus
DCjanus changed the base branch from main to ci/validate-fork September 17, 2026 08:03
@DCjanus
DCjanus added this pull request to stack #7 September 17, 2026 08:03
@DCjanus
DCjanus force-pushed the fix/app-localization-foundation branch from d1e0cde to da2b10e Compare September 18, 2026 03:39
@DCjanus
DCjanus force-pushed the fix/app-localization-foundation branch from da2b10e to 4ed53b2 Compare September 18, 2026 03:45
@DCjanus
DCjanus removed this pull request from stack #7 September 18, 2026 04:10
@DCjanus
DCjanus added this pull request to stack #9 September 18, 2026 04:10
DCjanus pushed a commit that referenced this pull request Sep 18, 2026
@DCjanus
DCjanus force-pushed the fix/app-localization-foundation branch from 4ed53b2 to 56da29f Compare September 18, 2026 20:47
@DCjanus
DCjanus removed this pull request from stack #9 September 18, 2026 20:51
@DCjanus
DCjanus force-pushed the fix/app-localization-foundation branch 2 times, most recently from bda4c4f to 52581d1 Compare September 23, 2026 03:46
@DCjanus
DCjanus added this pull request to stack #10 September 23, 2026 03:47
@DCjanus
DCjanus force-pushed the fix/app-localization-foundation branch from 52581d1 to 3ef660c Compare September 23, 2026 09:24
@DCjanus
DCjanus force-pushed the fix/app-localization-foundation branch from 3ef660c to 370cde5 Compare September 28, 2026 04:05
@DCjanus
DCjanus force-pushed the fix/app-localization-foundation branch from 510b4b3 to 5ca0765 Compare September 29, 2026 16:07
@DCjanus
DCjanus force-pushed the fix/app-localization-foundation branch from 5ca0765 to 09ee98f Compare September 29, 2026 17:30
@DCjanus
DCjanus force-pushed the fix/app-localization-foundation branch 3 times, most recently from d14db88 to 3db92b0 Compare October 4, 2026 05:09
@DCjanus
DCjanus removed this pull request from stack #10 October 5, 2026 04:12
@DCjanus
DCjanus force-pushed the fix/app-localization-foundation branch from 3db92b0 to 8a63e32 Compare October 5, 2026 04:13
@DCjanus
DCjanus added this pull request to stack #12 October 5, 2026 04:16
@DCjanus
DCjanus force-pushed the fix/app-localization-foundation branch from 8a63e32 to dc05ae4 Compare October 5, 2026 04:34
abue-ammar#753

App-name lookup now gathers the localization codes that actually exist
in `InfoPlist.loctable` and `.lproj` folders, then uses Foundation's
bundle localization selection to rank them for the user's preferred
languages. This lets `zh-Hans-CN` select either `zh_CN` or `zh-Hans`
without maintaining language-specific expansion rules.

Candidates are limited to the same language and script; Foundation
decides regional fallbacks such as `es-MX` to `es_419`. The bundle's
development localization participates in the same ranking so an
untranslated base name stays at the position of the language it is
written in. English remains indexed as a search alias.

This builds a short list of localization identifiers while an app bundle
is scanned and adds no retained state. Runtime memory was not
re-measured for this fork-only fix.

Leak-tested: Not applicable; no long-lived allocation or UI lifecycle
changes.

Each uncached bundle scan enumerates its top-level Resources directory
to discover `.lproj` folders.

- Covers system-style `zh_CN` loctables, third-party `zh-Hans.lproj`
bundles, script-bearing development regions, unsupported leading
preferences, and Foundation's `es-MX` to `es_419` fallback.
- The full 73-harness suite and lint pass on the fork's macOS 26 GitHub
Actions runner.
@DCjanus
DCjanus force-pushed the fix/app-localization-foundation branch from dc05ae4 to 56772e2 Compare October 9, 2026 02:08
Base automatically changed from ci/validate-fork to main October 16, 2026 06:57
@DCjanus
DCjanus merged commit 56772e2 into main Oct 16, 2026
3 of 4 checks passed
@DCjanus
DCjanus deleted the fix/app-localization-foundation branch October 16, 2026 06:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant