Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 573
openfrog Avatar asked Oct 06 '22 07:10

openfrog


1 Answers

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.

like image 185
openfrog Avatar answered Oct 12 '22 22:10

openfrog