Fix i18n string interpolation for device name (#9806)

Use a separate translatable string for "Media stored on another device"
instead of interpolating a translated fragment into another string.
This allows translators to properly handle the complete sentence for
languages with different grammar structures.

https://claude.ai/code/session_01TJMLcXE9HHneEXMEBJqL4u

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Samuel Newman
2026-02-01 10:08:28 +02:00
committed by GitHub
parent ab98130295
commit 864af57fd9
+15 -17
View File
@@ -45,23 +45,17 @@ export function DraftItem({
mediaExistsOnOtherDevice || mediaExistsOnOtherDevice ||
draft.meta.hasQuotes draft.meta.hasQuotes
const deviceName = useMemo(() => { const isUnknownDevice = useMemo(() => {
const raw = draft.draft.deviceName const raw = draft.draft.deviceName
let name = raw
switch (raw) { switch (raw) {
case device.FALLBACK_IOS: case device.FALLBACK_IOS:
case device.FALLBACK_ANDROID: case device.FALLBACK_ANDROID:
case device.FALLBACK_WEB: case device.FALLBACK_WEB:
name = _( return true
msg({ default:
message: `another device`, return false
comment: `Prefixed with "This media is stored on...". Example: "This media is stored on another device"`,
}),
)
break
} }
return name }, [draft])
}, [_, draft])
const handleDelete = useCallback(() => { const handleDelete = useCallback(() => {
onDelete(draft) onDelete(draft)
@@ -115,12 +109,16 @@ export function DraftItem({
{mediaExistsOnOtherDevice && ( {mediaExistsOnOtherDevice && (
<DraftMetadataTag <DraftMetadataTag
icon={WarningIcon} icon={WarningIcon}
text={_( text={
msg({ isUnknownDevice
message: `Media stored on ${deviceName}`, ? _(msg`Media stored on another device`)
comment: `This media is stored on... Example: "This media is stored on John's iPhone"`, : _(
}), msg({
)} message: `Media stored on ${draft.draft.deviceName}`,
comment: `Example: "Media stored on John's iPhone"`,
}),
)
}
/> />
)} )}
{mediaIsMissing && ( {mediaIsMissing && (