I am developing an iOS application where most of the source code is in targets/modules within local SwiftPM package. This package is imported by a Xcode project that contains the app target.
I am trying to find a way to export all the localizable data in the standard XLIFF format. The option "Export Localizations" in the Xcode editor is not available for SwiftPM packages. When I generate a corresponding Xcode project with swift package generate-xcodeproj
it does not contain any localization data, it seems a bug, also the 'generate-xcodeproj' option as reported by the swift tool as: "is no longer needed and will be deprecated soon"
.
Right now the only idea I have is to copy the localizations in a empty Xcode project and export them from there, is there any better way?
Xcode 14 has added support for exporting SwiftPM localizations, see the release notes:
You can now export local Swift packages for localization.
Xcode generates a single localizations catalog for all projects and Swift packages contained in a project or workspace.
You can also use xcodebuild -importLocalizations and xcodebuild -exportLocalizations to export or import a Swift package. (56355281)