openfrog
openfrog

Reputation: 40755

How to correct the Xcode bug of creating lproj folders in the en.lproj folder?

I had a Localizable.strings file in my project for which I wanted to add more localizations.

So I went to the Project Settings and clicked the "+" to add languages. Somehow I cannot do that anymore on the right panel as there is no "+" button.

Xcode creates the cn.lproj folder inside the en.lproj folder in the file system which is messy but some other lproj folders such as de.lproj do get created where they belong.

How can I move an xx.lproj folder to where it belongs without breaking everything in Xcode? I am afraid leaving them where xcode is putting them can cause errors at run time because cn.lproj should not be a sub-folder of en.lproj.

Upvotes: 6

Views: 5226

Answers (3)

openfrog
openfrog

Reputation: 40755

As it turns out it's an Xcode bug, but fortunately it can be resolved.

First step is to backup your project. Then move the wrongfully placed lproj folders out of en.lproj and if you want, put all of them in a localized subfolder. Then delete all the link-broken files (red) from the Project Navigator. For the stacked files that have an arrow you will have to delete the root item. Do not choose "Move to Trash". Then make sure in the Project Settings you have all the localizations you want. Drag the "localized" sobfolder containing all the lproj folders into Xcode wherever you want it to be, and make sure it gets added to the current target (Add to target checkmark must be checked in the list). In my case everything was functional as expected after doing this. And as a nice side effect I got rid of these annoying stacked files with the arrow and instead have a very clear group structure consisting of a localized and several lproj folders which makes much more sense to me.

Upvotes: 3

Leo Chapiro
Leo Chapiro

Reputation: 13994

I think, you should have a folder en.lpoj for English. Now if you click "+" and choose xx as language you should get another one named "xx.lpoj" nearby of the old one (on the same level so to say) and NOT inside the en.lproj. So delete this wrong sub-folder and do it again ...

Upvotes: 0

Michael Dautermann
Michael Dautermann

Reputation: 89519

The correct way to add a localization would be through your Project Info pane in Xcode.

It looks like this:

Here's the most obvious way to add a localization via Xcode

I would think trying to do it any other way might be asking for trouble (or hassle).

Upvotes: 2

Related Questions