alunny / node-xcode

tools and utilities for working with xcode/ios projects
Apache License 2.0
225 stars 105 forks source link

addLocalizationVariantGroup results in 'undefined' comment #120

Open WarTech9 opened 7 years ago

WarTech9 commented 7 years ago

Adding localization variant groups always adds groups with comment "undefined". For example, I end up with a PBXBuildFile section entry like this:

 4815039DEE524DBD9A7F16E8 /* Localizable.strings in undefined */ = {isa = PBXBuildFile; fileRef = E651D27D6DE74EDFB6FCD625 /* Localizable.strings */; };

Looks like the cause of this is pbxProject.addLocalizationVariantGroup: line 1864

Here, the variant group object is created without a group. This object is then passed in to this.addToPbxBuildFileSection(localizationVariantGroup). This then passes the group into pbxBuildFileComment(file), which in turn calls longComment(file), which sets the comment for this entry. longComment returns f("%s in %s", file.basename, file.group) as file comment. Thus, not setting the group property when the variant group is created results in all variant groups being created with this method having undefined comment.

The group property in this case refers to the build phase. Since localized resources are always added to the 'Resources' build phase, setting that when the variant group is being created should fix this issue.

imhotep commented 7 years ago

@innovative1 Could you send a pull request for this?