kelvinhokk / cordova-plugin-localization-strings

Cordova Plugin for Localization of Strings on the App
MIT License
119 stars 106 forks source link

Duplicate entries in Xcode Resources for localisation files #14

Closed Menardi closed 6 years ago

Menardi commented 7 years ago

When building for iOS, as well as copying translations to the correct folder, they need to be added as Resources in the Xcode project. The plugin does this correctly, but it seems to be adding them to Resources each time -- it should only do this the first time. The result is duplicate entries in Resources, which causes builds to fail with an error like:

error: failed to remove /Users/x/Library/Developer/Xcode/DerivedData/app_id/Build/Products/Debug-iphoneos/AppName.appex/de.lproj/Localizable.strings: “Localizable.strings” couldn’t be removed.

Below is a screenshot showing the duplicates in Xcode. In this case there are two sets, but I have seen up to four. screen shot 2017-09-05 at 18 26 09

I guess the fix here is to check if the file exists in Resources already before adding it. Is that possible with the current set up?

kelvinhokk commented 6 years ago

Hi Menardi, did you do multiple cordova prepare?

For now, you might have to cordova clean before you build. My build script typically drops

  1. cordova platform remove {platform}
  2. cordova platform add {platform}
  3. cordova build {platform}.
chriswep commented 6 years ago

I also ran into this (i think). However for me the Cordova build crashes if i don't remove InfoPlists.strings from the Xcode Project before. Removing the platform before every build is no option for me.

As a workaround i delete the files via my build script before building now, which does the job.

Menardi commented 6 years ago

Apologies for the delay in replying here! I typically do a cordova build ios when I've made JS changes so they get copied over to the platforms folder. Removing and re-adding the platform is no good for me, as I have to make quite a few manual changes to the Xcode project for my build.

As a workaround at the moment, I uninstall the plugin after the first build. As a I don't typically make changes to my translations files, this is doable.

kelvinhokk commented 6 years ago

I am encountering this issue with the latest Cordova 7.1.0 and cordova-iOS 4.5.3, even after removing platform and adding platform again.

Will be updating this plugin soon.

cvaliere commented 6 years ago

@kelvinhokk do you plan to solve the issue this week?

if not, we'll look into it, as we need it to be solved

thanks!

kelvinhokk commented 6 years ago

I've tested and committed a fix which I believe should solve this issue.

cvaliere commented 6 years ago

thank you, it seems to work!