Duplicate localized resource "/Localizable.strings" found xcode 6.1 - ios

I am adding multiple languages to an iOS application from .xliff files. On the first import, all works as planned and everything comes is and works great. On the second, however, it will tell me:
Duplicate localized resource "XXX/Localizable.strings" found
It appears that it isn't grouping the files correctly, even though they are in the appropriate locations in finder.
Any ideas?

I couldn't get it to work properly but here is my work around:
I would import language 1, watch the files get added to the project and then remove references in the Xcode project (Note I didn't delete them from the disk). This makes it Xcode doesn't know they exist in the project but they are still there in the project folder in finder.
I did this for every language but the last one. The last language I clicked on the created localizable.strings file and click "Add files to the project" and added back all of the files I had previously removed the references.
I assume this is just some sort of bug but that is the only way I figured around they issue.

Related

Xcode says Infoplist.strings already exists when I import localizations

So I have a Xcode project and I've added a language for localization. I exported the xliff file, added the translation and imported it back into Xcode. Everything works fine.
Then, at a later point, I've added new strings so I need to update the translation. I repeat the process but when I import the localization now I get the following error message:
“InfoPlist.strings” couldn’t be moved to “nb.lproj” because an item
with the same name already exists.
The localization is not updated. Anyone know what's causing this? I tried to move InfoPlist.strings out of the nb.lproj directory but it didnt make any difference and no new InfoPlist.strings file was created.
Why cant Xcode just overwrite the file if it needs to be replaced?
Hopefully you already solved this, but I had the same problem; maybe this will help someone.
Ultimately, I used find . -name "InfoPlist.strings" in the workspace directory, and found that there were two other InfoPList.strings in addition to the one I had deleted.
Once I deleted them, my import worked again.
You probably just deleted the reference from Xcode. Go to the actual location of the file that you want to delete. In other words the location in finder. If the file is still there then manually delete it.
I came across some weird behaviour with localisation files a while back where Xcode would not ask if I wanted to delete the file reference or send to trash, it would just 'delete'. Later found out it was only deleting the reference in Xcode.

Is there any better way to rename an XCode project than the given one?

The given version is described here: How do I rename a project in Xcode 5?
But, as you can see from the following screenshot^, not everything gets renamed, and if one opens package contents, directory names etc. to try to manually change all the references, the project is broken afterwards, so you have to keep the old project name for sub directories etc., which granted is not a massive problem, but is intensely irritating, and I'm not enjoying being intensely irritated at work.
^ apologies for a screenshot, but there's too much information in it to transcribe to written text. Top two-thirds of screenshot is XCode project, bottom third a Finder window.
Renaming projects in xcode in one of the most annoying things in iOS development. I assume you want to rename your app. I faced this problem once and figured out a simple, clean way to do it.
Go back to the point where everything worked.
Open project in xcode and click on the project icon in the project structure( first file)
Go to the info tab
Search for Bundle Name. Most probably it will automatically be set to $(PRODUCT_NAME) which is a shell variable that will set your app name the same as the project name.
Set it to whatever you want your app name to be
Done
Notes :
If you use custom URL Schemes this might produce an error when redirecting.
ALWAYS git or some other SVN in your projects. This will come in handy in this kind of situations

Xcode: Framework Header File not found - Every time after new launch

Every time i open the project im working on, all header files of the frameworks are not linked. I have to manually add all frameworks reference so that xcode wouldn't give me the error that the header files is not found.
After quitting xcode and launching the project again, same thing.
If anyone could help it would be great ! its a huge pain in the ass tp link binary with libraries of all frameworks every time I launch the project.
Maybe its because of "spaces" in the names of the parent folders of the items that you added.
Check https://stackoverflow.com/a/25009037/1071320
I have tried this way which works for me
Create a group in Xcode
Drag the files inside the SDK to this folder
Build and Go!
N.B what i have tried earlier is drag the whole folder inside the SDK
As #Shumais Ul Haq mentioned. It looks like it is happening because of spaces in the containing folder. When the framework is dragged into the project that spaces are messing in Framework Search Paths. The way to fix it without changing a directory names is to escape a spaces in the framework search path by \ so instead of ../My Directory Name it will be ../My\ Directory\ Name

iOS: Localization gone wrong

I'm starting to get confused..I've wanted to finally add my translation file for all strings to my app according to ray wenderlich's tutorial. But somehow now everything got messed up. I removed now every localization again, which deleted my strings file, the storyboard etc. And now I have no localization language set in the project settings and I've copied all files back from the trash.
But my localized string (NSLocalizedString(..)) somehow don't load..or load something else. I've changed some of them to check if my strings file in the project explorer is actually used but it still uses the old strings and I have no idea from where..I've checked the project folder and there aren't any other files.
How can I set up everything again that it works? How can I set the strings file it should use? And how should I set up then the localization, with or without base language?
Edit: And in the simulator I cannot get my app running..it's showing only a black screen. Whereas on my iphone it still works (if I use my iphone from Xcode).
I guess I've deleted all my languages in project settings and now I cannot add any localization anymore :-(
Here's what I would try:
Check your project folder for any leftover .lproj folders / .strings file and delete
Clean / Build
Start localization from scratch following SmoothLocalize's Tutorial
This should delete all old files and create a new default localizable.strings, and then you can add more languages.

iOS localized images not showing up

I am localizing an app and while the process seems straight forward (I followed http://www.raywenderlich.com/2876/localization-tutorial-for-ios with minor adjustments for new Xcode interface), and worked for strings with no issues, I cannot get my localized images to show up.
In Xcode, I already have a set of images in the original language and clicked the "Localize..." button for each of them. Accepted the default selection of "English" and noted that all the images were moved into a new "en.lproj" folder. All these images are used by calling [UIImage imageNamed:#"image1"] within the code.
Then I collected all my localized, French versions of these images and placed them into a folder "fr.lproj" at the same level as the "en.lproj" Xcode created. File -> Add Files to "Project" and point it to that folder. At this point Xcode actually automatically detected that these are French localized files and the right side bar correctly identifies them as such when I select any of those files. Project info tab correctly shows the expected number of localized files for each language. Yet when I run the app with French language selected in the simulator, it shows me localized French text, but English versions of images.
Am I missing any steps that should have been performed, or should something be done differently?
This happens often due to caching. Make sure to
A) delete the app from the simulator. You can also "Reset content and settings" on the simulator, but that shouldn't normally be needed
B) run Project > Clean
Sometimes it is also necessary to
C) run Project > Clean Build Folder (use Ctrl key)
D) delete the Derived Data from your project. To do this, open Organizer and choose your Project. Sometimes you even have to do this manually, i.e. navigate in finder to the folder and delete all files and folders.
Usually, this should do it. Sometimes a little trick works as well to quickly refresh index and cache, especially precompiled headers - open the .pch file in your project, and "break" it (e.g. comment out a line) so that it fails to compile. This will trigger headers to recompile as well.
Hope this helps.
Image localization doesn't worked correctly for me when there are 2(or more) PREFERRED LANGUAGE ORDER in the simulator Settings.
I'm new to iOS localization so.. I don't know why it is working like that.
Anyways try to maintain only 1 PREFERRED LANGUAGE ORDER to resolve the issue.

Resources