Skip to content

Add localization catalog, helpers and en/zh Localizable.strings for app & widget#1

Open
waffensam wants to merge 1 commit intomainfrom
codex/add-localized-string-resources-for-codexbar
Open

Add localization catalog, helpers and en/zh Localizable.strings for app & widget#1
waffensam wants to merge 1 commit intomainfrom
codex/add-localized-string-resources-for-codexbar

Conversation

@waffensam
Copy link
Owner

Motivation

  • Centralize all user-facing strings to avoid continued use of bare literals and to provide a single source of truth for App and Widget text.
  • Ensure localized resources are packaged by SwiftPM and that English is kept as the development baseline with zh-Hans provided as a Simplified Chinese translation.
  • Make it easy for SwiftUI/AppKit call sites to use typed helpers (LocalizedStringResource/String(localized:)-style access) and to add further keys by domain.

Description

  • Add LocalizationCatalog in Sources/CodexBarCore/LocalizationCatalog.swift which defines namespaced keys and English fallbacks (e.g. menu.settings, preferences.general.title, alert.login.codex_missing_cli.title, widget.empty.open_app).
  • Add target-specific helpers AppStrings (Sources/CodexBar/AppStrings.swift) and WidgetStrings (Sources/CodexBarWidget/WidgetStrings.swift) that expose string(_:), text(_:), formatted(_:) and resource(_:) convenience methods for app and widget usage.
  • Add English and Simplified Chinese Localizable.strings under Sources/CodexBar/Resources/{en,zh-Hans}.lproj and equivalent files under Sources/CodexBarWidget/Resources/, and update Package.swift to set defaultLocalization: "en" and to process widget resources (resources: [.process("Resources")]) so SwiftPM will include them.
  • Migrate existing literal strings in Sources/CodexBar/PreferencesDisplayPane.swift, Sources/CodexBar/StatusItemController+Actions.swift (Codex login alerts), and Sources/CodexBarWidget/* (empty states, metrics, and intent titles/descriptions) to the new helpers, and add Tests/CodexBarTests/LocalizationCatalogTests.swift to assert English baseline resolution.

Testing

  • git diff --check was run and passed with no whitespace errors.
  • pnpm check was attempted but failed due to an HTTP 403 when the environment tried to download tooling (SwiftFormat), so lint tooling did not complete.
  • swiftformat Sources Tests and swiftlint --strict were not executed successfully in this environment because those binaries are not available.
  • swift build and ./Scripts/compile_and_run.sh were attempted but failed because SwiftPM could not fetch external dependencies in this environment (HTTP 403), so an end-to-end build/test run could not be completed here.

Codex Task

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant