Skip to content

feat: add Arabic localization parity checker - #6

Open
MoElnaggar14 wants to merge 3 commits into
Abdo-codes:mainfrom
MoElnaggar14:feat/arabic-localization-parity-checker
Open

feat: add Arabic localization parity checker#6
MoElnaggar14 wants to merge 3 commits into
Abdo-codes:mainfrom
MoElnaggar14:feat/arabic-localization-parity-checker

Conversation

@MoElnaggar14

Copy link
Copy Markdown
Contributor

Summary

  • add check-localization-parity.py for English/Arabic .strings, .stringsdict, and .xcstrings resources
  • detect missing keys, empty Arabic values, untranslated Arabic, placeholder mismatches, Arabic text in English resources, and bidi risks when Arabic starts with placeholders
  • add parity checker examples docs
  • wire the checker into SKILL.md, the localization checklist, and README

Verification

  • python3 -m py_compile apple-arabic-localization/scripts/check-localization-parity.py
  • apple-arabic-localization/scripts/check-localization-parity.py .
  • verified against a temporary EN/AR fixture that produced expected missing-key, placeholder, untranslated, and bidi findings
  • git diff --cached --check

@Abdo-codes

Copy link
Copy Markdown
Owner

@codex review

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

ℹ️ 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 on lines +108 to +110
unit = localized.get("stringUnit", {})
if isinstance(unit, dict):
value = str(unit.get("value", ""))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Parse plural xcstrings variants before flagging empty values

Handle localized entries that store text under variations (common for pluralized .xcstrings) instead of only stringUnit.value; the current parser leaves such entries as empty strings, so compare_entries raises Empty ar value even when valid Arabic plural translations exist. This produces false errors and can block parity checks on correctly localized catalogs.

Useful? React with 👍 / 👎.

Comment on lines +175 to +176
if key == "__parse_error__":
findings.append(Finding("error", source, key, target_value or base_value))

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 Surface parse failures when only one locale fails to parse

Report parse errors directly even when only one side has __parse_error__; currently that sentinel is only handled in the shared-key loop, so a malformed target file is emitted as Missing ar key plus Extra ar key instead of a parse-failure error message. This obscures the real root cause and makes troubleshooting harder when a single locale file is invalid.

Useful? React with 👍 / 👎.

@MoElnaggar14

Copy link
Copy Markdown
Contributor Author

@codex review

@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: 38c4766fbf

ℹ️ 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 on lines +117 to +119
localizations = payload.get("localizations", {})
if not isinstance(localizations, dict) or locale not in localizations:
continue

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Read implicit source entries from string catalogs

When an .xcstrings file uses the standard sourceLanguage representation, source-language strings are stored as catalog keys and commonly have no localizations.en entry. Skipping every key without an explicit base localization makes the English side empty, so a broken Arabic translation is reported only as an extra-key warning and the checker exits successfully without comparing placeholders or values.

Useful? React with 👍 / 👎.

Comment thread apple-arabic-localization/scripts/check-localization-parity.py Outdated
Comment thread apple-arabic-localization/scripts/check-localization-parity.py Outdated
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.

2 participants