Is it possible to build localization into console apps, developed in SwiftUI in Xcode26. I have created a catalog, (.xcstrings file) with an English and fr-CA string. I have tried to display the French text without success. I am using the console app to test a package which also has English/French text. English text works fine in both package and the console main, but I cannot generate the French. From what I can discover so far it's not possible without bundling it as a .app, (console app). Looking for anyone who has crossed this bridge.
These two statements are at odds:
there is nothing special here
just a command line tool with a Localization.xcstrings file
Doing this is special because, in general, we don’t localise command-line tools on the Mac. Specifically, the traditional Unix-y way of localising command-line tools [1] is not standard practice on Apple platforms. Rather, Apple platforms use their own mechanism, based on the bundle structure. This mechanism is intended for GUI apps, and you have to jump through hoops to get it to work from the command line [2].
If you’re doing this just for testing, I recommend that you use Xcode’s testing infrastructure. It has options for overriding the language and region.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"
[1] Rooted in the LANG environment variable.
[2] If you do some spelunking you’ll find a bunch of info about how things actually work, for example, the AppleLanguages environment variable. However, these are considered implementation details, not API.