question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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:open
  • Created 7 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
Rex-Appiercommented, Dec 18, 2020

PBXVariantGroup

Is this feature done or included in current stable build

1reaction
kronenthalercommented, Jan 9, 2017

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Adding files to variants created from ... - GitHub
A ComponentMetadataRule that derives a new variant and adds files to that variant should work with SNAPSHOT dependencies where the file's name ...
Read more >
Adding images to product variants - Shopify Help Center
While creating the variant, click Add image on the variant details page. Select a product image or click Add file to add a...
Read more >
Create and use variants - Figma Help Center
Add more variants to a component set · Select a component set and click in the toolbar. · Select a component set and...
Read more >
Add new or update existing variant and genotype info fields
--build BUILD Build version of the reference genome (e.g. hg18) of the input files, which should be the primary (used by default) or...
Read more >
Configure build variants | Android Developers
Alternatively, Android Studio can create the directories for you when you add a new file to your project for a specific build variant....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found