Import localizations error: "Two files will try to write translations to same path"

I have Xcode 13.3.1.

To export localizations file, I choose Export Localizations option in the Product menu, then I choose "MyApp Workspace..." option, and I choose a folder, then export. Two files are created en.xcloc and xx.xcloc, because my app supports two languages, English and XX.

Then I edit the exported xx.xcloc localizations file, then try to import the file to Xcode as I always do without any issue. However, this time I get the following error:

Two files will try to write translations to same path

MyApp/Other/Settings.bundle/en.lproj MyApp/Other/Settings.bundle/xx.lproj

Rename or move one of the files

What's going on here, and how should I solve this issue?

This might be something unexpected with how you have your project (and Settings.bundle within your project) configured or it may be a bug in Xcode. Could you please use Feedback Assistant to file this bug and attach an Xcode project + .xcloc with the issue reproducing? Thanks!

I have investigated this problem a little further.

  1. I exported using the "Product > Export Localizations... > MyApp Workspace..." option, then imported the xcloc file to the project without any touch. I got the same error.

  2. I exported using the "Product > Export Localizations... > MyApp..." option, then imported the xcloc file to the project without any touch. This time I didn't get the error above, instead, I got a warning window, full of "Empty Translations" and "Over-Localized Do not Translate" warnings.

Strangely, these warning are mostly about the "note" lines of the translations, that are written between /* and */ tags. These lines are coming from comment strings in the example code below:

NSLocalizedString("Hello!", comment: "Greeting in the welcome screen")

You aren't supposed to translate "Greeting in the welcome screen" here, but Xcode gives "Empty Translations" warnings about them. I wonder why.

Found the answer in another site quoting:

It might be because you have an NSLocalizedString with a tableName: parameter matching the name of a storyboard. In other words, if you have a Main.storyboard and NSLocalizedString(“Blah”, tableName: “Main”, comment: “...”) then you’ll probably get this error.

The full post on: https://www.wooji-juice.com/blog/random-dev-xcode-loc-export.html

Import localizations error: "Two files will try to write translations to same path"
 
 
Q