Fix translation bot flattening plural keys in incremental path - #95104
Draft
roryabraham wants to merge 6 commits into
Draft
Fix translation bot flattening plural keys in incremental path#95104roryabraham wants to merge 6 commits into
roryabraham wants to merge 6 commits into
Conversation
Add unit tests for buildDotNotationPath on function-wrapped plural translation keys. Strings changed inside one/other must map to the parent key (e.g. codingRules), not a nested leaf path. Co-authored-by: Cursor <cursoragent@cursor.com>
When building dot-notation paths for incremental translation, stop at
function-valued properties so plural keys like codingRules keep their
(params) => ({one, other}) wrapper instead of flattening to leaf paths.
Co-authored-by: Cursor <cursoragent@cursor.com>
Add integration tests that simulate incremental injection for plural keys. Collapsed parent paths must preserve the arrow wrapper; separate leaf paths produce the flattened structure that broke TranslationDeepObject typing. Co-authored-by: Cursor <cursoragent@cursor.com>
Drop descendant translation paths after diff classification so incremental injection keeps function-valued plural keys intact instead of injecting one/other leaf paths separately. Co-authored-by: Cursor <cursoragent@cursor.com>
Use English fixtures for spellcheck, narrow PropertyAssignment types for typecheck, and add a prefix lookalike case for removeDescendantPaths. Co-authored-by: Cursor <cursoragent@cursor.com>
Use assertDefined guards instead of type assertions and escape template literal fixtures to satisfy no-template-curly-in-string. Co-authored-by: Cursor <cursoragent@cursor.com>
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.
Explanation of Change
The incremental translation path was registering plural keys at leaf paths like
codingRules.otherinstead of the parent function-valued keycodingRules. That causedinjectDeepObjectValueto rebuild a plain{one, other}object and drop the(params) => (...)wrapper.This PR collapses dot-notation paths at function-valued properties in
buildDotNotationPath, and removes descendant paths after diff classification so only the parent plural key is injected.Fixed Issues
$ #94343
PROPOSAL: #94343 (comment)
Tests
npm test -- tests/unit/scripts/TSCompilerUtils.test.tsand confirm all 6 tests pass.buildDotNotationPathreturnspolicyCopyChangeLog.codingRules(notcodingRules.other) for strings inside plural forms.Offline tests
N/A – translation script unit tests only.
QA Steps
Same as tests.
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)Avatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
N/A – translation script change only.
Android: mWeb Chrome
N/A – translation script change only.
iOS: Native
N/A – translation script change only.
iOS: mWeb Safari
N/A – translation script change only.
MacOS: Chrome / Safari
N/A – translation script change only.