Skip to content

fix: package and load localized strings (rebased, from #56) - #71

Merged
momenbasel merged 3 commits into
mainfrom
maint/simplified-chinese-localization
Aug 12, 2026
Merged

fix: package and load localized strings (rebased, from #56)#71
momenbasel merged 3 commits into
mainfrom
maint/simplified-chinese-localization

Conversation

@momenbasel

Copy link
Copy Markdown
Owner

Maintainer rebuild of #56 by @ZHUOLIN0928, rebased onto current main with the one blocking review item fixed. Original PR could not be updated directly (maintainerCanModify is off) and had gone quiet, so this branch carries the contribution forward with credit.

Carried over from #56 (unchanged in substance)

  • Copy all .lproj directories into Contents/Resources in Scripts/build.sh so SwiftUI's implicit LocalizedStringKey lookup against Bundle.main actually finds the shipped tables.
  • Declare CFBundleLocalizations (en, zh-Hans, ja, de, es, fr, ar) in Resources/Info.plist.
  • LocalizedStringKey conversions for runtime-generated sidebar labels, picker tabs, status chips, badges, and shared components.
  • The complete Simplified Chinese runtime string table (302 entries).
  • Localization regression checks.

Changes in this rebuild

  • Fixed the blocking review item: EmptyStateView.subtitle receives already-resolved runtime messages (subtitle: error in WhatsAppView and AppleWatchView). It now translates known keys via an explicit Bundle.main.localizedString lookup and renders the result with Text(verbatim:), so a resolved message containing % tokens can never be format-mangled. Added a regression check pinning this.
  • Rebased over v1.4.0 and this week's merges: kept main's THIRD_PARTY_NOTICES.md copy and version stamping in build.sh (the .lproj loop sits after the binary copy, reading from the source tree); dropped fix: package and load localized strings #56's comment-only hunk in WhatsAppExporter.swift.

Verification

  • plutil -lint passes on all seven .strings tables; zh-Hans has 302 entries, no duplicate keys, no % tokens anywhere (audited mechanically).
  • swift build clean; all 152 regression checks pass on top of current main.
  • bash Scripts/build.sh produces a bundle with all seven root .lproj directories alongside the SPM resource bundle; the packaged zh-Hans table lints and carries all 302 entries.

Co-authored-by: ZHUOLIN0928 270883937+ZHUOLIN0928@users.noreply.github.com

Made with Cursor

ZHUOLIN0928 and others added 3 commits August 1, 2026 17:04
…calization

Co-authored-by: Cursor <cursoragent@cursor.com>

# Conflicts:
#	Scripts/build.sh
#	Sources/Phosphor/Services/WhatsAppExporter.swift
Copilot AI lite review requested due to automatic review settings August 12, 2026 05:39

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0ebe543d32

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread Resources/Info.plist
Comment on lines +11 to +15
<string>ja</string>
<string>de</string>
<string>es</string>
<string>fr</string>
<string>ar</string>

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Stop advertising localizations that cannot resolve UI keys

When a user selects Japanese, German, Spanish, French, or Arabic, the bundle now advertises that language even though those locale tables contain namespaced keys such as sidebar.devices, while the SwiftUI views request English literal keys such as Devices; the newly added literal-key entries exist only in zh-Hans. Those advertised language selections therefore fall back to English throughout the UI. Either add the runtime keys to every declared locale or declare only the locales actually wired to the views.

Useful? React with 👍 / 👎.

Picker("Date", selection: $dateFilter) {
ForEach(MessageDateFilter.allCases) { filter in
Text(filter.rawValue).tag(filter)
Text(LocalizedStringKey(filter.rawValue)).tag(filter)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Add translations for the localized date filters

Under Simplified Chinese, this lookup receives All Dates, Last 30 Days, This Year, or Custom Range, but none of those keys exists in the added zh-Hans table. Consequently every option in this newly localized picker still renders in English; add matching entries for all MessageDateFilter.rawValue values.

Useful? React with 👍 / 👎.

@momenbasel
momenbasel merged commit d7ebbd4 into main Aug 12, 2026
8 checks passed
@momenbasel

Copy link
Copy Markdown
Owner Author

Maintainer rebuild of #56 (Simplified Chinese localization), merged after verification.

Carries all translations from #56 unchanged, plus two fixes: Scripts/build.sh now packages .lproj bundles into the app (the table was previously never loaded at runtime), and EmptyStateView renders dynamic subtitles verbatim instead of format-reinterpreting them through LocalizedStringKey. Regression checks cover packaging and runtime label handling. Translation credit belongs to the #56 author.

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.

3 participants