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.
Localization in Swift macOS console Apps.
Just to clarify, "console" is Apple's UI for viewing data from the "unified logging system" and crash reports.
If you want to localize a command-line tool using Apple's localization framework, then you must bundle it in an app. But you can directly run the executable in Contents/MacOS and it will run in the current localization. You can even supply:
-AppleLanguages "(fr)"
on the command line to force a specific language.
All of this might only work if you are actually running a full user session and running the app in Terminal. If you are logging in remotely or something, all bets are off. That's a different environment and sometimes these things won't work.
Some Apple command-line tools get around this by linking to bundled frameworks that are, themselves, localized. I guess you could to that too.
by console, I am referring to a command line tool. My intention was to use the command line tool to test a package I am working on, as the eventual target will be a window app, I may abandon my efforts to localize my command line tool. I am using Swift Testing to unit test the package. I was hoping to hear from someone who had actually done this already.