Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Localization of iOS Storyboard: UITextView texts are not localized?

I have a storyboard based application, which is localized from German to English.

Most strings in the UI are correctly pulled from the Main.strings files, with the exception of all text in UITextViews, although they do appear in Main.strings file:

/* Class = "IBUITextView"; text = "Die Futtermenge kann bei Hunden ab 12 Monaten anhand des Schiebreglers von 2% auf 5% des Körpergewichts verstellt werden. Als Standart empfehlen wir 2% Futter vom Körpergewicht Ihres Hundes. Je nach Aktivität kann das abweichen. Wenn Sie bereits eine hohe Menge an Futter geben und Sie der Meinung sind, es ist nicht ausreichend, erhöhen Sie die Fettmenge im Futter. Mehr unter den Fragen & Antworten.\n \nFür Welpen und Junghunde gilt:\nWelpen 8 - 20 Woche: 7%\nJunghunde 21 - 35 Woche: 6%\nJunghunde 36 - 52 Woche: 5%"; ObjectID = "TAc-yh-nWQ"; */
"TAc-yh-nWQ.text" = "As of 12 months of age, you can use the slide ruler to adjust the food amount for dogs from 2% to 5% of body weight. As a baseline, we recommend 2% of your dog's weight to determine the amount of food. It will vary depending on activity. If you are already giving your dog a lot of food and you feel it is not sufficient, increase the fat content of the food. More information can be found in the FAQ section.\n \nFor puppies and young dogs:\nPuppies 8 - 20 weeks: 7%\nYoung dogs 21 - 35 weeks: 6%\nYoung dogs 36 - 52 weeks: 5%";
/* Class = "IBUILabel"; text = "Getreide:"; ObjectID = "VMF-xs-WfF"; */
"VMF-xs-WfF.text" = "Grains:";
/* Class = "IBUIButton"; normalTitle = "Gewicht aktualisieren..."; ObjectID = "WpP-c7-ipY"; */
"WpP-c7-ipY.normalTitle" = "Update weight...";

Is there something wrong with my Main.strings? The above is an excerpt.

like image 919
mrd Avatar asked Feb 19 '15 00:02

mrd


People also ask

How do you localize a storyboard?

Go to storyboard and click on UI Element that you want to localize. Select identity inspector, In Document portion you will see Object ID that we need to use for localize that element. Now goto localization file that created from step 3. In that string file you will see Object ID of elements.

How does localization work in iOS?

Localization is the process of making your app support other languages. In many cases, you make your app with English user interface first and then localize the app to other languages such as Japanese. The process of localization is tedious, and steps of it change little by little as XCode gets updated.

How do I localize Xib files?

strings files from the xib, which make localization pretty straight forward. Right click on the xib file in Xcode, and choose Get Info . Select the General tab and on the bottom click Make File Localizable . Then you will be able to add localizations by clicking Add Localization on that same tab.


1 Answers

Looks like this is a long-standing bug discussed here.

You could try the "Change "Localizable Strings" to "Interface Builder Cocoa Touch XIB"" method recommended there, which seems like a strange bit of voodoo magic but hey if it works it works. Otherwise, setting it at runtime appears necessary.

like image 141
Alex Curylo Avatar answered Sep 18 '22 16:09

Alex Curylo