Localization not working on ipad but working on iphone - ios

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/

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.

iOS App Localization: Storybords Translation

My storyboards appear to be translated when previewed in XCode but when I install the app on the device nothing is translated to other languages. Here is the checklist.
Storyboards are all translated:
I have some duplicates here - perhaps the reason it is not working:
And finally local file structure on my computer:
Question: how to verify correct file linking or any steps to find the issue of Storyboards not working on the iPhone or Simulator.
You need Base.storyboard and other should be ##language##.strings. Inside these files you will translate things corresponding to ID of the element.
You can check explicitly if the string is translated by calling something like:
NSLog(#"%#", NSLocalizedString("AWO-r7-rD4.text",nil));
You should put instead of "AWO-r7-rD4.text" one of the IDs from Localizable.strings for storyboard.
For comparison:
I have Auth.storyboard, and it can be nested to: Auth.storyboard(Base), Auth.string(English), Auth.String(French).
One stupid thing: Have you changed regional settings in simulator settings?
Hope it helps.

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.

How to localize iOS (iPhone/iPad) app using only single storyboard?

I was wondering if somebody could explain in the details how I can localize an iOS app using only 1 storyboard. I know how to localize by creating several storyboards(one storyboard for each used language), however I'd like to find out another solution.
Thanks.
The tutorial on raywenderlich.com uses two forms of localization together. The reason is he also checks the storyboard when turning on localisation in image 3:
.
So then what?
NSLocalizedString is very useful, any text set programatically can (and should) be localised using this method. Ray's tutorial is still very useful.
However, it's not very desirable to create a clone of the storyboard(s) to do translation, it's just not very maintainable in the long run.
And what about storyboards?
The magic happens using the Base Localization feature. Base localization uses the generated objectId's to 'map' different languages to the storyboard.
Do note that this feature is only available using SDK 6.0 and above. Running the app on a lower iOS version will not cause any errors, it'll simply won't work.
Go to your project, and select Base Localization, then add any other language.
Open your storyboard file and check the new language as well. Note the icon is not a storyboard icon, but a simple text file icon. That's a good thing; it won't copy the whole storyboard this time :).
Note how there is now another file 'under' the storyboard. Xcode automatically generates a file for every language you select.
You can se Localization feature for this. You need to add the Localizable.strings file for each supported language and use it for locaization.
You need to use : NSLocalizedString() for fetcing data corresponding to each key.
Check this tutorial for details.

iOS localized images don't appear to be localized

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.

Resources