remove unneccesary custom types from translations batch15#96605
Conversation
…ccesary-custom-types-from-translations-batch15_at2
|
Hey, I noticed you changed If you want to automatically generate translations for other locales, an Expensify employee will have to:
Alternatively, if you are an external contributor, you can run the translation script locally with your own OpenAI API key. To learn more, try running: npx ts-node ./scripts/generateTranslations.ts --helpTypically, you'd want to translate only what you changed by running |
|
@mjasikowski Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
|
please don't review yet, pr was created automatically being open and it has triggered the review, sorry! |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 78e7d53c9f
ℹ️ 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".
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
|
@codex review |
|
Codex Review: Didn't find any major issues. 🚀 Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
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". |
| description: "Choose a plan that's right for you.", | ||
| subscriptionLink: 'Learn more', | ||
| lockedPlanDescription: ({count, annualSubscriptionEndDate}: WorkspaceLockedPlanTypeParams) => ({ | ||
| lockedPlanDescription: ({count}: {count: number}, annualSubscriptionEndDate: string) => ({ |
There was a problem hiding this comment.
object type left here on purpose, lockedPlanDescription returns PluralForm which requires an object with count as first param.
| function getRemovedFromApprovalChainMessage(translate: LocalizedTranslate, submittersNames: string[]) { | ||
| return translate('workspaceActions.removedFromApprovalWorkflow', {submittersNames, count: submittersNames.length}); | ||
| // PluralForm reads parameters[0].count; Object.assign keeps the names array and attaches count without a type assertion. | ||
| return translate('workspaceActions.removedFromApprovalWorkflow', Object.assign([...submittersNames], {count: submittersNames.length})); |
There was a problem hiding this comment.
This works, and I see it's how it was done before too. But since we're refactoring these signatures anyway, maybe we could unify on the lockedPlanDescription shape — ({count}: {count: number}, submittersNames: string[]) — so the translation receives the count directly and this call site doesn't need the Object.assign trick. Feels more consistent.
| // `phraseArgs` is an open list but `translate` accepts only the params shape for the | ||
| // given key; the cast is safe because callers always pass params matching `validationError`. | ||
| // eslint-disable-next-line @typescript-eslint/naming-convention, @typescript-eslint/no-unsafe-type-assertion | ||
| messages={{0: (translate as (key: TranslationPaths, ...args: unknown[]) => string)(errorData.validationError, ...errorData.phraseArgs)}} |
There was a problem hiding this comment.
NAB: this cast block is duplicated here and in AvatarWithImagePicker. Since validateAvatarImage produces a closed set of errorKey/errorArgs pairs, ValidationResult could be a discriminated union ({errorKey: K; errorArgs: TranslationParameters<K>}), making this a plain translate(errorKey, ...errorArgs) with no cast.
| <Header | ||
| title={title} | ||
| subtitle={stepCounter ? translate('stepCounter', stepCounter) : subtitle} | ||
| subtitle={stepCounter ? translate('stepCounter', stepCounter.step, stepCounter.total, stepCounter.text) : subtitle} |
There was a problem hiding this comment.
NAB: the translate('stepCounter', stepCounter.step, stepCounter.total, stepCounter.text) expression is now duplicated (progress-bar label + subtitle). Worth computing once so the two spots can't drift.
|
I left a few NAB, but overall it looks good to me. LGTM 🚀 |
Explanation of Change
Continue the work of removing unnecessary custom types from translations. Last PR:
#84399.
Fixed Issues
$ #76429
PROPOSAL: #76429 (comment)
Tests
Testing every modified component is not necessary since the changes are all related to types only, and TypeScript already checks types and enforces correct parameter usage.
Below is an example place where the changes can be observed in the UI.
1.3.1 Upload small resolution photo (below 80x80) and verify that error message is visible correctly.
3.2 Upload wrong format image (e.g webp) and verify that error message is visible correctly.
2.Offline tests
N/A
QA Steps
Same as tests.
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, 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.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
MacOS: Chrome / Safari
Screen.Recording.2026-07-21.at.12.46.11.mov
Screen.Recording.2026-07-21.at.12.54.30.mov