Adding files to variants
See original GitHub issue(I know this is not really a bug report, but I don’t know where else to ask questions - I’m happy to convert this into a wiki page as an example usage though)
Hello and thank you for maintaining this project. At Mozilla we are trying to use this for the following use case:
We have a product called Focus at https://github.com/mozilla-mobile/focus which currently is English only.
We localize the product by exporting an en.XLIFF
file to our localization volunteers and we get back XLIFF files for other locales. To import these we run xcodebuild -importLocalizations -localizationPath l10n/nl.xliff
for example. This spits out .strings files in the proper .lproj directories.
The problem is that xcodebuild
only generates the files. It does not actually add them to the project.
This is where pbxproj
comes in. I’d like to use it to find for example the PBXVariantGroup
for Localizable.strings
and then add a PBXFileReference
reference for it.lproj/Localizable.strings
to it.
However, we are lost in the complexity of both the Xcode projects and the pbxproj API.
My question to you is if we can get some help to find out how to do this. I’m happy to turn the end result in some reusable code that anyoen can use. Or a blog post or a wiki page.
🧀
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (3 by maintainers)
Top GitHub Comments
Is this feature done or included in current stable build
Thanks for the files, i took a look at the way Xcode imports the files, and i saw some funny behaviors when importing the .xliff file with the Editor > Import localization menu.
Note to self: so far, this is what i manage to gather: - special folder .lproj - has to add all items under the .lproj folder into the PBXFileReference section - create if not exist a PBXVariantGroup with the name of the file under .lproj - get the PBXVariantGroup created (or existing) and add the fileRef’s id as a children - add the PBXVariantGroup in the buildFile section as a resource build phase of the target
I will try to tackle this this week/weekend.