code to get localization for images in IOS? - localization

I have set of images to which I want to localize in any other language.
I know the same for text :
"Sign In" = "Sign In";
Can someone help me with the images?

iOS : Manage Localized Images
- declare it programmatically like mentioned in this URL
OR
You can localize your images individually by declaring it in inspector section (define there in which language you want to localize it).

Related

Sign in with Apple button title always displays "SIGN_IN_WITH_APPLE"

I have an app which is localised for two languages: English and Lithuanian. I'm implementing Sign in with Apple functionality and everything is working great except for the button title, which I'm trying to localise.
I'm creating the button as recommended in documentation: let asiButton = ASAuthorizationAppleIDButton(type: .signIn, style: .black) I've entered "SIGN_IN_WITH_APPLE" in Localizable.strings for both languages. When the language is set to Lithuanian, the button displays a correct string, but when I change the language to English, the button always displays SIGN_IN_WITH_APPLE (as in the screenshot).
Screenshot
For some reason it seems to ignore the value I've put into Localizable.strings for an English version (although all other strings work as expected), as I can remove it altogether and have the same outcome.
I've tried getting and setting the label to the button directly through code using asiButton.accessibilityLabel, but this returns nil and setting it results in the same outcome, a button with SIGN_IN_WITH_APPLE title.
Any ideas would be appreciated!
Do not use Localizable.strings for this. ASAuthorizationAppleIDButton is already automatically localized.
I've faced same issue.
I added "SIGN_IN_WITH_APPLE" = "Sign in with Apple"; pair to my Localizable.strings that chained to English file and all working fine.
It's kinda an answer, but I suppose this message should be in comments. Sorry, but right now I'm not allowed make comment cause of low reputation count.. )

Is it possible to remove a UILabel from localization?

Hello localisation pros,
after searching the various tutorials, tipps and tricks around "Localization" and of course this stackoverflow forum, I have to commit, that I did not find a good answer. Thats why I post my problem here and hope for an answer.
I have two types of UILabel in my Storyboard. And I have plenty of each type in the app.
One type contains text, that is not necessary to localize, because it is just an integer (e.g. "5"), or an emoji or it is just an international word (e.g. "Computer").
And of course I have the other type of UILabel in my app, that contain text, that must be localized.
When exporting for localization, ALL UILabel in the Storyboard will be put in the localization files by xCode and makes the file bigger than necessary, since plenty of the UILabels belong to type 1.
Is there any way, to take out these UILabels from the localization process and to mark them as "not necessary to localize" ??
Thanks for helping.
You need to manually remove the each label entry from localize file as Xcode localize whole storyboard not single one or you can create xib of each viewController the you can localize each viewController .
Thanks
Change them to attributed and they won't get exported.

How to Localize Image Files in IOS project

i went through few video tutorials and links for localizing an IOS app,there are few very good tutorials about the localization though, i am facing issues with localizing the resources. i am using assets catalog for management of the resources in the app and i am using launcher.xib for my custom spalsh screen which contains a lable and an imageview. i will be setting the image to imageview based on the language settings (english and french). i followed initial steps for adding localization feature to the app, and it created fr.lproj directory in my xcode project folder. i copied few images with french text in to fr.lproj folder and few english texted images in to base.lproj. in assets catalog i used english texted images default images for the imageview, now i run the app by changing the language setting of the device, and result is in english. i went through this link http://www.raywenderlich.com/64401/internationalization-tutorial-for-ios-2014 where author says we cant localize the assets catalog, and he is doing a little trick to do it. but my problem is launcher.xib doesnt linked with .h and .m files and dont have any methods where i cant set an image programatically. How can i achieve this? help Me please..
Thanks.
[UIImage imageNamed:#"NSLocalizedString (#"image_name_key", nil)"]
image_name_key will contain your image name in different language in string files. like
image_name_key = #"fr.jpg"
image_name_key = #"en.jpg"

Trouble in Internationalisation, iOS

I need to internationalize some of the labels in a screen; do I need to localize the whole screen?
One more doubt, I have taken a string file and pulling the value of the keys from that file directly from that file using NSLocalizedString, then also do I need to localize the screen or it will by default get localized?
Thanks in advance.
you need not to localize the whole screen.
for two label only, on viewdidLoad
self.lbe1.text = NSLocalizedString(#"Label1", nil)
self.lbe2.text = NSLocalizedString(#"Label2", nil)
your second doubt is not clear to me.
You have to create the localize file. Then label you can use the localized id. Then you don't need to worry the whole screen or particular screen or particular text. Because whatever you can change. If you want more info refer this link
http://www.raywenderlich.com/64401/internationalization-tutorial-for-ios-2014

How to get system images programmatically? (example: disclosure chevron)

I want to create UIImageView with some system-image in it. (Example: the disclosure chevron image, etc.). How can I do so programmatically?
Note: I don't want to download the image and add it to the project, I want to fetch it from the user programmatically / from the Interface Builder.
From iOS 13 and Xcode 11 you can get system images by giving system name.
let image = UIImage(systemName: "info.circle")
Reference : UIImage Apple Documentation
If you mean you can to set the button to use the system disclosure icon, just do as #middaparka suggested and use this:
UIButton *button = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
If you're asking how you can access the image directly, you can't do that. This is your only option: Use default apple icons for pdfs and docs in iOS app?
I think iOS-Artwork-Extractor is the tool you are looking for. It lets you extract the artwork into png files.
There is no clean programmatical way to access the images of system buttons. Quote from the documentation of the UIButton.imageView property:
The value of the property is nil for system buttons.
You may do an off screen rendering of the views and extract the resources on the fly but that's a very shaky approach. It's better to extract every asset you need and use them as intended. You'll suffer much more in the end with the programmatic way.

Resources