Hi,
This is a tricky one. As for Xcode 15.1 I did not find any way to do it semi-automatically like for Info.plist file. The sync seems not possible for Settings.bundle or Root.strings.
But you can use string catalog for Settings.bundle manually. You just need to do some additional work.
What I did is as follows:
In my Resources folder (where I also have the whole Settings.bundle) I've added Root.xcstrings file manually (all languages, keys and strings). Because it will not be populated automatically as InfoPlist.xcstrings I had to manually copy all keys and strings from the original Root.plist. Please remember to NOT add Root.xcstrings to any target because it will trigger automatic stringfile compilation and you will find Root.strings inside your *.lproj folders in your final build. You don't want Root.strings in the top-level *.lproj but inside Settings.bundle.
Next, I've added a custom build phase to manually trigger xcstrings compilation with xcstringstool compile
command like this:
#!/bin/bash
SETTINGS_BUNDLE="$CODESIGNING_FOLDER_PATH/Settings.bundle"
SETTINGS_XCSTRINGS="$SRCROOT/My App/Resources/Root.xcstrings"
xcstringstool compile "$SETTINGS_XCSTRINGS" --output-directory "$SETTINGS_BUNDLE"
This phase has to be added after Copy Bundle Resources
.
As you can see, the generated Root.strings file lands in the build folder ($CODESIGNING_FOLDER_PATH
) not in the source code. You don't need to commit them to your repo.
Next, I'll try to make an automatic sync Root.plist with my Root.xcstrings. I don't know how to extract all localizable texts from the Root.plist yet. I'll work on this. This way we could have the same functionality as for any swift files or storyboard/xib files.
It's a shame Apple did not give us automatic use of string catalog for Settings.bundle but at least it's possible to use it.