Skip to content

feat(localization): add Urdu localization - #1374

Merged
tisfeng merged 14 commits into
tisfeng:devfrom
AlleyNawaz:feat/urdu-localization
Oct 26, 2026
Merged

tisfeng merged 14 commits into
tisfeng:devfrom
AlleyNawaz:feat/urdu-localization

Conversation

@AlleyNawaz

@AlleyNawaz AlleyNawaz commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

背景 / Context

Add an Urdu interface to Easydict through Settings → General → Language → اردو. Ready for review. The selected language now propagates to AppKit query windows and all SwiftUI hosting roots, including windows that are already open. Full application and visual verification of the new RTL implementation remains outstanding.

变更内容 / Changes

  • Provide 564 applicable main-catalog Urdu entries and four metadata entries, including the AppleScript permission description. Preserve existing source and other-language values. The explicitly nontranslatable %lld entry remains excluded.
  • Register ur in the language selector and Xcode regions. Retain the upstream dev integration already present at 5708742; the retired GitHub Models service/key and temperature text are absent, and the Bing Cookie label reflects its optional status.
  • Use one reactive locale/direction modifier for settings, menus, About/acknowledgements, OCR, CLI debug panels, screenshot windows, and the Apple Translation hosting root. Localized AppKit titles refresh on interface-language changes where supplied by the window owner.
  • Apply the selected direction to native query views on creation, language changes, and row/result refreshes. Mirror query controls, language selectors, service headers, result action bars, title bars, and native popup/main menus using semantic constraints and directional placement.
  • Keep translation/dictionary text direction independent. Preserve screenshot selection and OCR image coordinates; only interface controls and screenshot tips follow the interface direction. Do not reverse strings, images, or WebView content.
  • Preserve provider behavior, source/target language choices, dependencies, catalog contents, existing tests, and build settings. This update adds two production localization files and their project references.

关联 Issue / Linked Issues

Review feedback: RTL propagation and obsolete GitHub Models key concern.

验证 / Verification

Collapsed-result arrow follow-up (4b2f7722912f3f2744dace8bfbb98ecf4e4652f6):

  • Address the collapsed-arrow finding. Horizontally mirror the tinted collapsed glyph when the result view is RTL, and refresh it from the view's direction setter for already-open rows. Retain the expanded down arrow, LTR left arrow, light/dark tinting, shared assets, and button geometry.
  • Passed an AppKit compiler check of the exact extracted NSImage drawing expression with ARC, blocks, macOS 13 target, and warnings treated as errors. This does not establish full EZResultView compilation or pixel/GUI correctness. Reviewed the full correction and initialization, result/collapse, appearance, direction-change, and row-reuse paths; whitespace checks pass. No tests added or expanded.
  • Full workspace build and LocalizationTests attempts remain blocked locally by missing Xcode. Urdu/English switching in collapsed/expanded rows and light/dark appearances still need runtime verification. Current-head CI must complete independently; prior-head results below are historical.

Earlier Apple Translation compiler follow-up (bdbbc6c9c4d975a59a5c0ee9bd0a14c28cc1cacc):

  • CodeQL run #3177 failed while building head 1e88f2ef: Swift could not infer the lazy NSHostingController<some View> property in AppleTranslation.swift:130. The failure was reproduced locally using the actual Apple Translation files and localization sources; the earlier focused check had not included this integration.
  • Declare the stored controller as NSViewController, retaining the same hosting object, .interfaceLanguage() modifier, lazy lifetime, and attached/standalone window paths. No workflow or translation-service logic changes.
  • The same focused Swift 5 / macOS 13 compilation passes after the fix. Expanded module and Objective-C-header generation covering Apple Translation, shared localization, notification, and popup sources also passes. Review and whitespace checks pass. No tests were added or expanded.
  • Full workspace build and LocalizationTests attempts still stop locally because full Xcode is unavailable. The failed prior-head CI run is not treated as passing; checks for this new commit must complete independently. GUI, screenshots, and independent Urdu-review limitations below remain unchanged.

Earlier popup alignment follow-up (1e88f2efe12456b6eb5db5e9b5f4b5aa37c386b9):

  • Address the popup alignment finding in the shared native-popup helper. Refresh RTL menu sizing and subtract its width from the trigger's right edge, since AppKit places the menu's physical upper-left corner at the supplied point. Preserve the LTR origin and vertical spacing.
  • Passed focused Swift 5 type-checking of the actual shared localization, notification, and popup sources for arm64-apple-macosx13.0, whitespace checks, and review of the correction and all five callers. No tests were added or expanded.
  • Workspace build and LocalizationTests attempts again stop at the full-Xcode requirement. Actual popup placement, including screen-edge clamping, has not been visually verified. Existing runtime, screenshot, and independent Urdu-review limitations below still apply. Current CI is shown in the PR checks; previous-head results are not claimed for this commit.

Earlier full-window RTL update (7ea15d8de6726a4e3e13b358946d82d66291d6b3):

  • Passed Swift 5 type-checking and module/Objective-C-header generation for the actual shared localization, notification, and native-popup sources, targeting arm64-apple-macosx13.0 with real application headers. This is a focused compilation check, not a full app build.
  • Passed syntax parsing for all 13 changed Swift files, project plutil -lint, project-object scope checks, documentation-link checks, and git diff --check.
  • Confirmed both catalogs are byte-identical to the starting head, with 564/4 Urdu entries. Project changes only register the two new production files; existing build settings and tests are unchanged.
  • Completed agent review of the full update, hosting entry points, AppKit creation/refresh paths, semantic chrome constraints, popup/title handling, and coordinate boundaries. Platform inspection confirms semantic leading constraints mirror in AppKit; it does not establish the changed app's rendered behavior.

Earlier validation:

  • The maintainer's committed validation record at 5708742 reports five LocalizationTests passing under Xcode 27.2, including the regional-locale and mixed-text inputs. Those results precede this RTL update and are not claimed for the new head.
  • All five available CI checks for that prior head were successful when this update began. CI for the new head is reported in the PR checks; previous successes are not treated as validation of the new implementation.
  • Earlier standalone AppKit/CoreText inspection found glyphs and preserved text/selection ranges, but its selection export returned false. It did not establish working Easydict copy behavior and was not rerun for this update.

Unavailable/unverified for this update:

  • This machine has macOS 27.0.1, Command Line Tools, and Swift 6.4, with no full Xcode. Both workspace-build and LocalizationTests attempts stop at the Xcode requirement. No full application build or hosted-test pass is claimed for the RTL update.
  • No changed-app GUI, visual shaping, wrapping/clipping, cursor/copy, permission-dialog, language-switch, or light/dark checks have been completed. No independent fluent Urdu review has been obtained. Release/Archive, Intel, provider behavior, automatic detection accuracy, Urdu OCR, and installed speech voices remain unverified.

Remaining manual verification:

  1. Build Easydict.xcworkspace with the Easydict scheme and run xcodebuild test -workspace Easydict.xcworkspace -scheme Easydict -derivedDataPath <agent-dd> -only-testing:EasydictTests/LocalizationTests.
  2. On LTR macOS, switch English → Urdu → English. Inspect both already-open and newly opened main/floating/mini windows, settings, About/acknowledgements, OCR, screenshot tips, debug panels, and native menus. Check positions, spacing, clicks, long labels, and light/dark appearances.
  3. Verify mixed Urdu/English/URLs/numbers, selection, cursor movement, and copy output. Confirm translation-language selections remain stable, dictionary/translation content keeps its own direction, and screenshot/OCR boxes remain aligned to their images.
  4. Obtain fluent Urdu review and attach representative screenshots without personal data.

Review threads remain open for reviewer follow-up. The GitHub Models concern no longer applies to the integrated branch. The RTL propagation, popup-origin, and collapsed-arrow concerns have implementation fixes; runtime confirmation remains pending. No thread reply or resolution is claimed.

截图 / Screenshots

No screenshots of the changed application are available.

context: Urdu is already available as a translation language but is missing from the Easydict interface.

change: Translate 566 interface and four metadata entries, register ur, follow the interface language in SwiftUI layout, and use natural query paragraph alignment. Add focused localization regression coverage.

impact: Preserve existing locales and provider capabilities. Catalog audits and isolated language checks pass; full builds, hosted tests, app screenshots, copy behavior, and independent fluent Urdu review remain pending. Direction changes use Apple's semantic layout and natural paragraph alignment APIs.

References:
- Apple LayoutDirection: https://developer.apple.com/documentation/swiftui/layoutdirection
- Apple paragraph alignment: https://developer.apple.com/documentation/appkit/nsmutableparagraphstyle/alignment

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hello AlleyNawaz, Thank you for your first PR contribution 🎉 AlleyNawaz

context: The Urdu localization has been submitted as upstream draft PR tisfeng#1374 with full Xcode and app-level validation still pending.

change: Archive the completed execution plan and record the verified fork, PR, initial CI state, validation limitations, and remaining manual checks.

impact: Keep the contribution history reproducible without changing application code or claiming pending checks passed.

References:
- Easydict PR tisfeng#1374: tisfeng#1374
context: PR tisfeng#1374 conflicts with dev because its Urdu catalog still includes the retired GitHub Models entry.

change: Remove github_models to match upstream while preserving every remaining locale value.

impact: Catalog audits and the isolated language check pass. Full Xcode builds, hosted tests, app runtime checks, screenshots, and independent Urdu review remain unavailable.

References:
- Easydict PR tisfeng#1374: tisfeng#1374
@AlleyNawaz
AlleyNawaz marked this pull request as ready for review October 24, 2026 10:38
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review 🔄 Running since 2026-10-26T17:47:35.904730Z df5b272 New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@Issues-translate-bot

Copy link
Copy Markdown

Bot automatically translated this content.


法典审查摘要

此评论显示了针对此拉取请求的最新法典审查活动。

评论 状态 提交 审查触发器
📝 代码审查 🔄 **自 2026-10-24T10:38:11.148711Z 开始运行** 3d1d9f9 草案标记为准备就绪
ℹ️ 关于 GitHub 中的 Codex

您的团队已设置 Codex 来审查此存储库中的拉取请求。 当您

  • 打开拉取请求以供审核
  • 将草稿标记为就绪
  • 评论“@​codex review”或“@​codex security review”。

当任何审查正在进行时,Codex 会以 👀 做出反应,如果有建议则进行评论,并在所有审查结束且没有发现结果时以 👍 做出反应。

</详情>

context: PR tisfeng#1374 is ready for review after the catalog conflict fix was pushed.

change: Update the existing history and archive the continued plan with verified PR status, validation evidence, and CI observations.

impact: Preserve the original contribution record and explicitly retain unavailable Xcode, runtime, screenshot, and independent Urdu review checks.

References:
- Easydict PR tisfeng#1374: tisfeng#1374

@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: 3d1d9f9911

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread Easydict/App/Localizable.xcstrings Resolved
Comment thread Easydict/App/EasydictApp.swift Resolved
AlleyNawaz and others added 4 commits October 24, 2026 16:01
context: Automated review of PR tisfeng#1374 found that the standalone branch still references github_models and that RTL overrides cover only settings and menus.

change: Restore the original legacy catalog entry without an Urdu edit and record the actual window-layout scope in the task history and plan.

impact: Preserve standalone service labels and a clean dev merge. Full AppKit and hosted-window RTL mirroring remains an explicit limitation requiring implementation and runtime verification.

References:
- Easydict PR tisfeng#1374: tisfeng#1374
- Legacy catalog review: tisfeng#1374 (comment)
- RTL scope review: tisfeng#1374 (comment)
背景:PR tisfeng#1374 的 Urdu 资源与 dev 删除温度设置的改动冲突。

变更:合入最新 dev,删除退役文案,同步可选 Cookie 标签并补齐测试桥接配置。

影响:LocalizationTests 的 5 个测试通过;保留已知 RTL 范围限制,未 push。

----------------------------------------------------------------------

fix(localization): resolve Urdu branch conflicts with dev

context: Urdu resources in PR tisfeng#1374 conflict with temperature removal on dev.

change: Merge latest dev, remove retired text, update the optional Cookie label and fix test bridging.

impact: All 5 LocalizationTests pass; retain the known RTL scope limitation without pushing.

References:
- Easydict PR tisfeng#1374: tisfeng#1374
context: Review of PR tisfeng#1374 found that selecting Urdu left AppKit query windows and other hosted roots using the system layout direction.

change: Share reactive locale and direction handling across hosting roots and mirror native query controls, toolbars, title bars, and menus. Preserve independent result-content direction and screenshot/OCR coordinates.

impact: The shared localization module type-checks for macOS 13, and syntax, project, scope, and whitespace checks pass. Full application builds, hosted tests, GUI checks, screenshots, and independent Urdu review remain unavailable for this update.

References:
- Easydict PR tisfeng#1374: tisfeng#1374
- RTL propagation review: tisfeng#1374 (comment)
- Apple Auto Layout Guide: https://developer.apple.com/library/archive/documentation/UserExperience/Conceptual/AutolayoutPG/WorkingwithSimpleConstraints.html

@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: 7ea15d8de6

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

context: Review of PR tisfeng#1374 found that Urdu popups used the trigger's right edge as the menu's upper-left origin.

change: Update RTL menu sizing and subtract the menu width from the trigger's right edge in the shared popup helper.

impact: Language, model, and quick-action menus use a right-aligned origin. Focused type-checking passes; full builds, hosted tests, and visual checks remain unavailable.

References:
- Popup alignment review: tisfeng#1374 (comment)
- Apple popup positioning: https://developer.apple.com/documentation/appkit/nsmenu/popup(positioning:at:in:)
- Apple menu size: https://developer.apple.com/documentation/appkit/nsmenu/size

@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: 1e88f2efe1

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

context: PR tisfeng#1374's CodeQL build failed because Swift could not infer the stored hosting controller type after applying the interface language modifier.

change: Declare the controller as NSViewController while retaining its hosting implementation and localization modifier.

impact: The original error is reproduced and corrected in focused compilation of the actual Apple Translation and localization sources. Module and header emission pass; full build and runtime verification remain pending.

References:
- Failed CodeQL build: https://github.com/tisfeng/Easydict/actions/runs/40199943735

@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: bdbbc6c9c4

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

context: Review of PR tisfeng#1374 found that collapsed result arrows retained their left-pointing image after the button moved to the left in Urdu.

change: Mirror the tinted collapsed glyph for RTL and refresh it when the result view's layout direction changes. Retain the expanded arrow and shared assets.

impact: Existing rows update their arrow on language changes and preserve appearance refreshes. The extracted drawing expression compiles against AppKit; full builds, hosted tests, and runtime checks remain unavailable locally.

References:
- Collapsed arrow review: tisfeng#1374 (comment)
- Apple dynamic image drawing: https://developer.apple.com/documentation/appkit/nsimage/init(size:flipped:drawinghandler:)
- Apple affine scaling: https://developer.apple.com/documentation/foundation/nsaffinetransform/scalex(by:yby:)

@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: 4b2f772291

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread Easydict/App/EasydictApp.swift Resolved
背景:PR tisfeng#1374 的全界面 RTL 处理改变了既有布局,用户要求仅适配翻译结果。

变更:撤回窗口和设置的方向注入,在 EZWordResultView 的专用文本控件中逐段适配方向,代码块保持 LTR。

影响:保留 Urdu 文案及原操作布局;Debug 构建和现有 28 项测试通过,未进行 GUI 验证。

----------------------------------------------------------------------

fix(result): restore UI layout and scope text direction to results

context: Full-interface RTL handling in PR tisfeng#1374 changed the existing layout; the user requested direction support only for translation results.

change: Remove window and settings direction overrides and adapt paragraphs in a dedicated EZWordResultView text control, keeping code blocks LTR.

impact: Preserve Urdu strings and the original control layout; the Debug build and 28 existing tests pass, with GUI validation pending.

References:
- PR tisfeng#1374: tisfeng#1374
背景:用户实测发现上一版自然对齐仍使 Urdu 正文靠左,未达到 PR tisfeng#1374 的结果排版目标。

变更:依据 AppKit 对齐契约,按每段首个强方向字符明确设置方向及左右对齐,代码块保持 LTR。

影响:仅改变结果正文排版,保留其他 UI;Debug 构建和现有 28 项测试通过,GUI 尚未验证。

----------------------------------------------------------------------

fix(result): explicitly align translation paragraphs by content direction

context: User screenshots show that natural alignment still left-aligns Urdu, missing the result layout goal for PR tisfeng#1374.

change: Follow the AppKit alignment contract and explicitly set direction and alignment from each paragraph's first strong character, keeping code blocks LTR.

impact: Change only result text layout and preserve other UI; the Debug build and 28 existing tests pass, with GUI validation pending.

References:
- PR tisfeng#1374: tisfeng#1374
- AppKit alignment: https://developer.apple.com/documentation/appkit/nstextalignment/natural
背景:语言修饰器的格式与项目规范不一致。

变更:补充 MARK 分区,并统一闭包返回类型的写法。

影响:仅调整代码格式,不改变运行行为。

----------------------------------------------------------------------

style(localization): format the interface language modifier

context: The language modifier formatting differs from project conventions.

change: Add MARK sections and normalize closure return type syntax.

impact: Adjust formatting without changing runtime behavior.
tisfeng
tisfeng previously approved these changes Oct 26, 2026
@tisfeng
tisfeng enabled auto-merge (squash) October 26, 2026 17:51
@tisfeng
tisfeng merged commit be3b012 into tisfeng:dev Oct 26, 2026
5 checks passed
@tisfeng

tisfeng commented Oct 27, 2026

Copy link
Copy Markdown
Owner

This change has been released in Easydict 2.26.0 beta.

Please update to the latest version. To receive beta updates, open Easydict Settings → General and enable “Include Beta versions”.

https://github.com/tisfeng/Easydict/releases/tag/2.26.0

@Issues-translate-bot

Copy link
Copy Markdown

Bot automatically translated this content.


此更改已在 Easydict 2.26.0 beta 中发布。

请更新至最新版本。 要接收测试版更新,请打开 Easydict 设置 → 常规并启用“包括测试版”。

https://github.com/tisfeng/Easydict/releases/tag/2.26.0

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