Repository navigation
Conversation
The mobile Internalization badge read row.artifactType, a localized string snapshotted when rows are built, so it kept the old wording after a runtime language change. Read artifactType strings at the point of use. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
3a54290 to
9308911
Compare
There was a problem hiding this comment.
Note
Copilot was unable to complete this review at the selected tier due to model policy or plan restrictions.
🟢 Approval recommended
The change is narrowly scoped to sourcing the Linked badge label from selector-derived localization at render time, addressing the runtime language-switch bug with no review evidence of remaining issues.
No open issues 🎉
What changed in this PR
Fixes a mobile Internalization localization bug where the Linked resource badge stayed in the old language after a runtime language change because it was sourced from a snapshotted, already-localized row field.
Changes:
- Read artifact-type localization strings at render time via
useSelector(artifactTypeSelector, shallowEqual). - Render the Linked badge using
at.linkedinstead ofrow.artifactTypeso it updates immediately on language switch.
| File | Description |
|---|---|
| web/src/components/PassageDetail/Internalization/PassageDetailsArtifactsMobile.tsx | Updates the Linked badge label to use selector-derived artifact-type strings at render time so it reflects runtime language changes instead of a localized row snapshot. |
Review effort: Balanced
| ? t.general | ||
| : row.artifactTypeSlug === ArtifactTypeSlug.SharedResource | ||
| ? row.artifactType | ||
| ? at.linked |
There was a problem hiding this comment.
what is at.linked? That name means nothing to me - certainly doesn't sound like a localized version of the artifact.
| ? t.general | ||
| : row.artifactTypeSlug === ArtifactTypeSlug.SharedResource | ||
| ? row.artifactType | ||
| ? at.linked |
There was a problem hiding this comment.
Can we get rid of row.artifactType entirely? This is the localized string? Do we also store the id?
There was a problem hiding this comment.
Oh...I see we store the artifactTypeSlug above. Duh. So we should get rid of row.artifactType.
There was a problem hiding this comment.
Done, with some related refactoring
There was a problem hiding this comment.
Note
Copilot was unable to complete this review at the selected tier due to model policy or plan restrictions.
🟡 Changes recommended
Outstanding review findings include unsafe type escapes (as any) and a potentially unsafe localization lookup cast/fallback that could yield non-string values or mishandle empty translations, so these issues should be addressed before approval.
2 open issues
Review effort: Balanced
| export const useLocalizedArtifactType = () => { | ||
| const t: IArtifactTypeStrings = useSelector(stringSelector, shallowEqual); | ||
| return (val: string): string => | ||
| (t as unknown as Record<string, string | undefined>)[val] || val; | ||
| }; |
| onDelete={onDelete} | ||
| /> | ||
| ), | ||
| } as any |
Use the shared artifactTypeSelector in useLocalizedArtifactType and guard the lookup so only non-empty strings are returned. Drop the unneeded slug cast in PassageDetailItem and the leftover `as any` in SortableItem. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>




Summary
The mobile Internalization resource list drew its Linked badge from
row.artifactType— a localized string snapshotted when the row was built. After a runtime language change the rows are not rebuilt, so the badge kept showing the old language's wording.The component now reads the
artifactTypestrings itself viauseSelector(artifactTypeSelector, shallowEqual)and usesat.linked. This follows the TT-6225 rule indocs/ai/localization.md: read strings at the point of use, never from a snapshot.row.isGeneralResourceandrow.artifactTypeSlugcarry no language, so they are still read from the row.Changes
PassageDetailsArtifactsMobile.tsx— addartifactTypeSelector/IArtifactTypeStrings, useat.linkedintypeBadge.Test plan
🤖 Generated with Claude Code