UTM icon indicating copy to clipboard operation
UTM copied to clipboard

l10n: two translations drop the substituted value (German resize dialog, zh-HK remote error)

Open leogrox opened this issue 2 months ago • 3 comments

Describe the issue

Two translations carry a format specifier that doesn't match the key, so the value is never substituted. Both are in v5.0.5.

1. German: the resize confirmation loses the size (Platform/de.lproj/Localizable.strings)

"…Would you like to resize to %@ GiB?" = "…Möchten Sie die Größe auf $@ GiB ändern?";

A $ where the % belongs. VMConfigAppleDriveDetailsView.swift:73 and VMConfigDriveDetailsView.swift:140 interpolate the target size into that alert, so a German user gets a literal $@ in the dialog that confirms a destructive, possibly data-losing resize. The one number they need to check before agreeing is the one they can't see. Present since at least 2022.

2. zh-HK: the remote error loses the VM id (Platform/zh-HK.lproj/Localizable.strings)

"Cannot find VM with ID: %@" = "無法透過此 ID 找到虛擬機:";

The placeholder is gone, so UTMRemoteServer.swift:970 reports "cannot find" without naming the machine it couldn't find.

How I found them

I compared the specifiers in every key against its translation across all 14 languages (503 strings carry at least one specifier) and these were the only two mismatches. I also checked for the dangerous variant, a translation that reorders specifiers of different types without positional markers (%1$@), which would misread the arguments at runtime: there are none.

Worth noting for the record: nothing here was found by running the app. The strings above are read from the repository and verified against the v5.0.5 tag.

Configuration

  • UTM Version: v5.0.5 (also present in the current main, 9d00a54)
  • macOS Version: n/a, static defect in the shipped resources
  • Mac Chip: n/a

Fix

Two characters: restore %@ in the German string, append %@ to the zh-HK one. I have it ready and I'm happy to open the PR, but your AI contribution guidelines ask for a human to reproduce the bug and observe the fix, and I can't do that here yet. Say the word if you'd rather take the PR anyway or just fix it directly.


Analysis assisted by Claude (claude-opus-5).

leogrox avatar Sep 20 '26 05:09 leogrox

Thanks for pointing out that. I've made a fix this for zh-HK in #7887.

(I don't speak German, so sorry for not covering the first one.)

FYI: https://github.com/utmapp/UTM/pull/7887/changes#diff-e69c3e590fb93906cd82dc93bdac53a8b7223ae481a3779225f7f1b90ae69c97R242

changanmoon avatar Sep 20 '26 07:09 changanmoon

Thanks for taking the zh-HK one.

The German fix needs no German. It's a $ where the % belongs, in Platform/de.lproj/Localizable.strings (the resize confirmation):

-"…resize to %@ GiB?" = "…Möchten Sie die Größe auf $@ GiB ändern?";
+"…resize to %@ GiB?" = "…Möchten Sie die Größe auf %@ GiB ändern?";

The rest of the sentence is untouched, so it doesn't need a German speaker to review it either. Feel free to fold it into #7887, otherwise I can send it as its own PR, whichever you prefer.

leogrox avatar Sep 20 '26 10:09 leogrox

The rest of the sentence is untouched, so it doesn't need a German speaker to review it either. Feel free to fold it into #7887, otherwise I can send it as its own PR, whichever you prefer.

Personally, I am not sure if containing an unrelated commit in one PR is welcomed by the project maintainer, even though CONTRIBUTING.md points out (this can be found in the AI Contribution Guidelines, I wonder if it applies to humans as well):

Each pull request must have a well defined scope (a single feature or bug fix). Do not submit large PRs containing multiple features/bug fixes.

Maybe I can create another PR to fix that. (FYI: #7892)

changanmoon avatar Sep 20 '26 13:09 changanmoon