简体   繁体   中英

Change a launch screen storyboard image based on culture on my Xamarin Forms iOS app

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM