Repository navigation
Optimize label translation to skip already-translated labels - #80
Merged
Merged
Conversation
The translate script skipped docs/<language>/labels.json whenever it was newer than the English labels.json, so the home, footer and 404 text added under the existing nav labels was never translated without --force. It now translates just the labels a translation is missing, keeping the ones already there, and still translates everything again with --force or when the English file has been edited since. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YMDJWsX8SQrGwpxLydExuZ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This change optimizes the documentation translation process by only translating newly added labels, rather than re-translating the entire labels file on every run. Previously, all labels were sent for translation each time, even if they hadn't changed.
Key Changes
translateLabels()function to accept anexistingparameter containing previously translated labels, allowing the function to skip re-translating unchanged labelscountMissingLabels()helper function to count how many labels need translation, enabling better user feedback--forceflag still triggers a full re-translationImplementation Details
collect()andrebuild()functions now traverse both the current labels and existing translations in parallel, comparing keys at each levelhttps://claude.ai/code/session_01YMDJWsX8SQrGwpxLydExuZ