Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SwiftUI: XCode Preview not showing localized strings

In the current XCode version (14.3), localized strings are not shown in preview, instead the key is shown. They show in Simulator and on device though. Can someone confirm this behaviour or am I missing a setting or so?

Example Localized.strings (de): "price" = "Preis";

Code:

Text("price")

Preview*:
price

Simulator / device:
Preis

*) For the preview I am using:

ContentView()
        .environment(\.locale, .init(identifier: "de"))

as described here: https://developer.apple.com/documentation/xcode/previewing-localizations

like image 447
Lilly Avatar asked Sep 17 '25 21:09

Lilly


1 Answers

I got the same issue and I fixed it by cleaning the build folder. Command+Shift+K or via the menu bar: Product -> Clean Build Folder

like image 130
Syl.H Avatar answered Sep 19 '25 15:09

Syl.H