I was reading the iOS 8 series from RayWenderlich.com website.
I came to the localization and internationalization. Read every single bit of it but I could not succeed on localizing images. (I did localized strings with no errors :) )
Here is what I have done:
1- Created a project of Single View Application
2- Placed an UIImageView on the Sotryboard by drag and drop.
3- Added my image to my project (back.png).
4- Assigned my UIImageView to that image (back.png).
Now is the steps for localization:
1- Go to project navigator and select the project.
2- Under localization, "Use Base Internationalization" us checked by default.
3- I added Arabic language.
4- Localized Storyboard files and its .strings and my image (back.png)
I have two image files English and Arabic versions. Each file on its respective folder. See screenshot.
When I run my app on the simulator which has Arabic language installed and selected. My imageView still displays the English version of the image.
I tried to use ar_SA (Arabic, Saudi Arabia) but still same issue. My image is displayed in English.
I have my simulator reset, and I have deleted derived files form library/dev.../xcode... But my app does not care about the Arabic version of the image.
if you want to localize app according to system language it is not happen in iOS 8 because it is a bug.
you can be sure from this point by trying to run the code in the following link.
https://github.com/EmanRezk/Localize.git
change simulator language to arabic in
iphone5s (7.0) then run app you will see the arabic image.
iphone5s (8.1) then run app you will see the english image.
I advice you to localize app according to app language not the system language.
Related
I'm trying to have the launchScreen.storyboard to change according to the language of the device.
I made storyboards with each one having a different background color for UIImageView at the top see sample...
these storyboards are localized versions of the storyboard, so each one would be chosen according to the language of the device
the problem is :-
it always shows the english version for example when I switch the language of the iPhone's Simulator to Arabic, how can I make each one show up for the language it's localized for?
Unfortunatelly, you won't be able to achieve this. Launch screens are static and it's content is not a subject to localization.
Refering to the Apple human interface guidelines
Avoid including text on your launch screen. Because launch screens are static, any displayed text won’t be localized.
This piece of storyboard was intended to save you from creating a separate launch image for each screen resolution. iOS doesn't translate launch screen storyboards as it didn't give you a way to provide launch image for each of the supported languages.
However, you can find some workaround in this post.
Just to be sure, have you set support for those languages in Project settings(under Localizations) ?
I have followed a number of tutorials on the web to try and make an image on my storyboard launch screen change based on the culture that the iPhone is set to. I can make the text inside the app change so I know the culture is being set correctly, and that I have defined the cultures in the project settings but an image on the launch storyboard always shows the English picture.
My storyboard (created as a Launch Screen in Add, New File) is in the iOS project root and I have a Resources folder which contains folders named en.lproj, fr.lproj and de.lproj. I have an image in each of these folders called Header.png which is slightly different based on the language.
From what I have read, setting the image property of the image control on the storyboard to Header.png should show the english version based on it being my default developer culture (which works - this does happen), then should pick the same image from the relevant folder based on the culture changing and the app re-starting. This isn’t happening unfortunately, it always pulls the english one back.
I have tried putting the storyboard in a Base.lproj folder in the project root, and in a Base.lproj folder in the Resources folder and have tried moving the language folders (de.lproj, etc) out of the Resources folder to the root but none of these seemed to change anything.
I am using the iPhone 6 emulator and am developing in Xamarin studio (latest alpha version)
Does anybody have any suggestions as to where I might be going wrong? I’ve been working on this all day (and last night) and it’s driving me nuts :(
Thanks in advance,
Alan
I believe the setup for launch storyboards / screens differs to the general storyboards you use for your UI.
I have tried localising the images on both a Xamarin project and an Xcode project, neither would localise the image on the launch screen - but once launched the same image would be localised on the main storyboard.
Try creating a separate launch storyboard for each localisation as putting each one in it's respective .lproj folder.
https://developer.xamarin.com/guides/ios/advanced_topics/localization_and_internationalization/#Launch_Images
I have localized LaunchScreen.xib, through which the LaunchScreen is divided in two parts.
i.e. LaunchScreen.xib(English) and LaunchScreen.xib(Portugese), but when I change device language to Portuguese then LaunchScreen.xib(English) is also loaded.
Add multiple "LaunchScreen.storyboard" for each language from "Add New File" menu in project. (Lets say for spanish - Launch Screen_sp)
Localize your "Info.plist" from identity inspector menu as InfoPlist.strings (Base) , InfoPlist.strings(Spanish) for each language you want to use.
Now as example: in InfoPlist.strings (spanish)
add following key :
"UILaunchStoryboardName" = "LaunchScreen_sp";
and you are done. Do not forget to set "LaunchScreen" as your Launch Screen File in "General" settings of your project.
The answer is: you cannot localize launch screen
In the Human Interface Guideline, they pointed out:
Avoid including text on your launch screen. Because launch screens are static, any displayed text won’t be localized.
Text cannot be localized.
What about images?
I have tried localising, and as of April 2017, I concluded that localization doesn't work. The localized storyboard will be ignored.
As user: Samewize pointed out, the User Interface Guidelines advise against localizing text on the Launch Screen.
Avoid including text on your launch screen. Because launch screens are
static, any displayed text won’t be localized.
To add to that, as of September 2019, even with localization of asset catalogs (WWDC 2019 Video), I've been unable to localize images that appear on the Launch screen. I'm assuming the Launch screen is statically generated and does not take Localization into account.
As per Apple we can't localise splash screen
here is the link:-
https://developer.apple.com/design/human-interface-guidelines/patterns/launching#launch-screens/
I had a set of launch images specified in XCode (5.0) in the general section. But then after localizing the images XCode has started to say there is no image specified, and if I try to add one nothing happens.
What I did was:
Add the various image sizes to the Xcode Target general section
Select the image in the navigator and from the inspector choose to localize it
This created an English variant.
Select it again in the navigator and add a language (Spanish)
Now there is en.lproj and es.lproj folders which XCode created
The images in the es.lproj at this point are duplicates of those on the en.lproj so I dragged and dropped new Spanish versions into es.lproj to replace the English one.
Some hours later I noticed XCode now says there is no launch images specified
If I try to select an image, for example one in en.lproj then nothing happens and XCode still reports no images specified.
Looks like you can get an idea to your answer here in this post of StackOverflow Question.
Please do check the answer posted here. That is more close to your question.
I have a universal app with some localization. My problem is about splash screens.
I need 6 splash screens.
iPad, iPhone, iPhoneRetina (in English) and iPad, iPhone, iPhoneRetina (in Local Lang)
I have a file for iPad English Splash, named "Default.png". When I select this file on project navigator, I can add localized version by clicking "+" sign. As a result I have 2 files: Default.png (English) and Default.png (Local Lang)
So far eveything is ok.
But when I try to add "Default~iphone.png" file to the project, it doesn't get localized. XCode crashes when I click on the "+" sign.
What is the proper way of adding 6 (3 devices x 2 languages) splash screens to the project ?
If you want to add them without XCode crash, you can use that trick :
Close your project. Go into your project folder into the Finder, create (if they are not already there) yourself the en.lproj, es.lproj, ... folders needed at the right place, and put your localized images inside them.
Then open your project, go to the project info panel, remove all possible localizations (keeping the files when asked), then add those localizations back (still in the project properties).
Then they will be shown like a charm in the file explorer tree.
You need to export localized images from your image editor with exactly the same names as the English. Then drag and drop these files into the de.lproj group in Xcode.
The process altogether:
Open Photoshop, export your 3 English .pngs
Edit the PSD with your localized text
Export the 3 localized .pngs with exactly the same name
Drag and drop them into the local-lang.lproj grouping/folder in
Xcode
I realized that although XCode crashes, it somehow adds the localized splash screen images to the project.
I just kept repeating the procedure and let xcode crash each time. Finally I got what I needed.