Empty localized strings cause localization key to be rendered instead

Originator:dan
Number:rdar://FB9733883 Date Originated:2021/11/01
Status:Open Resolved:
Product:SwiftUI Framework Product Version:
Classification: Reproducible:
 
When using the iOS localization mechanism, an empty translation for a given key will result in the key itself being rendered in a SwiftUI Text() structure.

Given the following Localizable.strings:
“test1” = “foo”;
“test2” = “”;

And the following SwiftUI code:
VStack {
    Text(“test1”)
    Text(“test2”)
    Text(“test3”)
}

The expected output is:
foo

test3

Explanation:
foo – correct translation for “test1”
<empty> – correct translation for “test2”
test3 – no translation available so correct fallback for “test3”

Actual output:
foo
test2
test3

In this, the “test2” is unexpected, because a translation has been provided for that key.

This is reproducible on iOS 14.5 and 15.0 in the simulator, and in 15.1 on a real device. However, this appears to not have been an issue on a real device running 14.8.

Happy to provide any more necessary information.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!