Skip to content

Conversation

@shuuji3
Copy link
Member

@shuuji3 shuuji3 commented Feb 1, 2026

Previously, the translation script added new keys at the end of each object, causing key order differences between the original en.json and other locale files. This made it difficult to compare translations side-by-side (I usually do).

This PR refactors the sync logic. Instead of constructing a flattened object and applying 'add' and 'remove' operations independently, the new logic traverses the reference object and updates values in-place. This ensures that all locale files strictly maintain the same structure and key order as en.json.

This should not change the current behavior and output text (except reordering) but just to confirm, this is my understanding of the script's behavior:

  • without --fix: only removes extra keys that are not in en.json.
  • with --fix: fully synchronizes the locale with en.json (adds missing keys and removes extra ones)

@vercel
Copy link

vercel bot commented Feb 1, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
npmx.dev Ready Ready Preview, Comment Feb 1, 2026 10:12am
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
docs.npmx.dev Ignored Ignored Preview Feb 1, 2026 10:12am
npmx-lunaria Ignored Ignored Feb 1, 2026 10:12am

Request Review

@shuuji3 shuuji3 changed the title fix(scripts): simplify translation sync logic and maintain original order fix: simplify translation sync logic and maintain original order Feb 1, 2026
Copy link
Member

@danielroe danielroe left a comment

Choose a reason for hiding this comment

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

❤️

@danielroe danielroe added this pull request to the merge queue Feb 1, 2026
Merged via the queue into npmx-dev:main with commit ac82a5c Feb 1, 2026
14 of 15 checks passed
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