iOS localized images don't appear to be localized - ios

This is one of those silly simple problems, that is so simple I can't figure out what is causing the problem.
I localized 80 or so images by clicking the image, the localization button and clicking the languages french and chinese and the folders were created. [FYI our app already has string localization implemented and working]. I then copied the translated images into their respective folders.
Now I can click the image's left arrow drop down, then click the french and chinese image and I see a french and chinese version of the image. I then restart the simulator, then change the language to french and run my app and the strings are all in french, but the images I localized are still in english [same with when i try chinese].
Additional info:
my images are in their respective en.lproj, etc folders with no images in the base folder.
When I check "Copy Bundle Resources" the images are shown to exist in the base folder; their is only 1 image referenced per resource; ie. it doesn't explicitly show all different language images.
I've tried ios 5.1 and 6, and both retina and not retina.

It sounds like you have everything set up correctly. I'd recommend testing on an actual iOS device.
In my experience, the simulator is pretty glitchy when it comes to localization. Here are some workarounds, none will work 100% of the time unfortunately:
Set the locale of your Mac to the same locale as inside the simulator
Reset using iOS Simulator -> Reset Content and Settings…
Clear the Derived Data in Organizer -> Projects -> Derived Data
Use Product -> Clean before you rebuild
Submit a bug report about it!

For localization, it's best to test on a device.
Try deleting your app from the device. Do a clean. Then run again. This forces Xcode to copy everything over again, including your new files. Whenever you modify settings bundles or resources, deleting and re-building is best.

Related

How to change localisation from storyboard to strings file

TLDR: Xcode generated storyboards for each language, however I want the "old"(?) *.strings files. How?
I am currently in the process of localising my storyboards. After I enabled everything, Xcode generated another storyboard alongside the original (english) one for me to localise. I was surprised, I expected a Localizable.strings file, like the apple documentation still states as of April 3, 2021:
For storyboard and XIB interfaces, select the user interface files (files with a .storyboard or .xib filename extension). Xcode adds a strings file to the localization folder that contains the text to translate, as well as comments that describe the user interface components. For example, if you add German to an iOS app that uses storyboards, LaunchScreen.storyboard becomes a group containing a LaunchScreen.storyboard (Base) and LaunchScreen.strings (German) file.
I searched around the internet, in apple developer forums, watched both WWDC18 and 19 talks about localisation in Xcode, but did not find a single mention of translated storyboards.
After the initial translation, which works great due to the simplicity of just filling everything in, it gets frustrating however, since every layout change needs to be repeated for every language. This can't be intended, there must be a better way, right? Sadly, I didn't find anything. Even a hint to a piece of documentation regarding these storyboard copies would be greatly appreciated. Thanks!
There are some screenshots of the possibility to convert these two formats via a dropdown, like the third picture in this post. However for me, there is no dropdown next to the language item when I click the storyboard, neither on the group, nor individual base or localised ones:
Is this a bug or am I missing something here? I am using macOS Big Sur 11.2.3 with Xcode 12.4 (12D4e).
Turns out, you need to use the Base Localization feature, the dropdown then appears and you can convert existing storyboards to *.strings files.

Localization not working on ipad but working on iphone

I have 2 storyboards each with 2 StoryboardName.string (English and French) and a separate Localize.string that contains the string for the view controllers.
When I run the app on an iPhone it's picking the localization files correctly, but on the iPad it keeps the declared values in the storyboard without useing the values fron the files.
I have tried to delete and install the app multiple time, also I have tried to set a parameter from the scheme configuration, I checked the id's from the localization file to be in the storyboard (and they are). Nothing work...
I modified the localization files but the iPad it's not picking the changes.
How can I force the iPad to chose/use a localization file?
see the target is properly set or not on right side window
The problem was that an " was missing from the storyboard.string files and xcode was not throwing an error. Also I have changed in the scheme at option the application language and the application region.
Helpful tutorial:
http://rshankar.com/internationalization-and-localization-of-apps-in-xcode-6-and-swift/

Xcode 6: iOS doesn't use storyboard localizations

since I upgraded my Xcode project to Xcode 6, my storyboard localizations don't work.
I have:
A base localization as storyboard file (which is basically English)
Four string files: English, German, French and Japanese
Until Xcode 5 those worked without any problems.
But since Xcode 6 I have the following situation:
The application only uses the labels used in the base file when running on a device/simulator
BUT my Localizable.strings file, which I have in different languages for all non-storyboard related localizations, works perfect. (So in the end I have a mixture of languages while running on a device)
Since Xcode 6 there is the possibility to see the localizations as a preview screen in the assistant editor. Everything works there.
So: the only thing that doesn't work is the localization of the storyboard while running
Does anyone else have the same problem and is there a solution?
Update: With Xcode 6.1 GM the localization on the actual device is correct now but the simulator is English only, even if I choose another language in the simulator.
I am experiencing the samen problem. I have been struggling for hours getting my localized storyboard to work in Xcode 6.0, until I read your question. Then I tried the second GM of Xcode 6.1. There, my UILabels were localized properly on the device (not in the simulator). However, my UITextView did not get localized, which took me another 30 minutes to figure out.
Hopefully, this will be fixed soon.
I thought I had the same problem as I couldn't see any of my translated texts appearing in the simulator. I tried using a dummy new project and it worked which made me not so sure about what the problem was.
Then I decided to use a dedicated editor for the translation. After exporting, translating the files via the editor and importing them, I could see the correct texts in the iOS simulator. So I guess that it was the way I edited them manually which caused the issue.
FYI, the tool I used is https://poeditor.com
I've been experiencing the same issue. The solution is: you need to clean (shift-cmd-k) a project first, then you build and run it.
Try to switch localization files to “interface builder storyboard” instead of “localizable strings”. For some reason in my project Storyboard.storyboard works, but Storyboard.strings doesn’t. Probably xcode bug.

Localized English launch image is not used

Somehow I can't seem to get my localized launch image to work.
In the root of my project folder I have a localized Default#2x.png with both an English and a Dutch version.
Somehow the Dutch version is shown in all situations.
I have other localised files that work all right (Root.strings, Localizable.strings, InfoPlist.strings) when using English language.
I've looked up several related questions, but found no answer. Tried deleting the file all together en adding them again. After localizing the file I added the right picture to the right folder using 'Show in Finder' on the English version.
Other answers suggest that there's another copy of Default#2x.png somewhere that's in the way, but I can't seem to find one.
When I look at my project folder in Finder, some folders seem recursive (repeat themselves) though.
Any help is appreciated.
Launch images can not be localized. See the app programming guide:
All launch images (...) must reside in the top level of your app's bundle directory.

NSLocalizedString returns text that is defined nowhere

OK, I am officially flabbergasted. I started an IOS project some time ago, and juggled around with localization a bit at the start, which became a bit of a mess, because I did not know how to do that properly yet.
Now I have decided to do the localization from scratch, and therefore threw away all the .strings files, and created a proper multi-language structure. I started with empty Localizable.strings files, and run the app to see whether I cleaned up everything properly. With empty Localizable.string files, I assumed my "NSLocalizedString" calls would simply return the key as text. They don't. They still return the old text that I had in the old .strings files.
Just to be sure, I put an NSLog statement under one of the NSLocalizedString calls, as such:
NSString *text = NSLocalizedString( key, nil );
NSLog(#"key=%# text=%#", key, text);
Then I search my whole harddisk for the text that was returned. No file on my harddisk contains the string that NSLocalizedString returns. And it is a completely different string than the key, so it cannot be constructed by NSLocalizedString either.
Anybody knows how this can happen? Is the old info cached somewhere by XCode? How can I persuade the tool to use the new Localizable.strings files? Obviously, I have already 'clean'ed and rebuilt the whole project.
Try to delete the app from the phone, then clean your project and install the app afresh.
If it still doesn't work, check you haven't somehow messed up with the Build Rules (Xcode 4 -> select your target -> tab "Build Rules") There, check if you don't have too many "CopyStringsFile" rules that aren't using "CopyStringsFile". If so you can remove them all but one.
If you are testing on the simulator, try resetting the simulator using the "Reset content and settings..." option in the "iOS Simulator" application menu.
When you redeploy a new build of the app, even after a clean build, it often doesn't clear out the cached content of the previously built version.
Did you also clean build folder? command + option + shift + k or go to product, press option, there will be a clean build folder, usually, resources file are cached, any resources file replacement (file with same file name but different object) might not be detected by XCode
Also, deleting app / resetting simulator does help. Deleted files sometime don't get removed when you redeploy.

Resources