Search code examples
androidiosobjective-ccountrylocalizable.strings

Basic styling of Localizable.strings in iOS


From an Android background, I would have thought that it is possible to add a basic styling to iOS Localizable.strings by using HTML markup like over here:

http://developer.android.com/guide/topics/resources/string-resource.html#FormattingAndStyling

Is there any way to add some basic styling information? What would be the iOS way to display the following text in the given styling for many different languages:

Title

Information1:
blablabla

Information2:
blablabla

Do I have to add a new key for each word? That would be crazy if the structure changed based on the language... There has to be a way to do it like this for each country:

"text.screen1" = "<b>Title</b> <br><br> <i>Information1</i> ..."

Glad about any help!


Solution

  • The only way to display HTML is to use a UIWebView and loadHTMLString method:

    UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, 320,200)];
    [webView loadHTMLString:@"test <i>italic</i>" baseURL:nil];
    [self.view addSubview:webView];
    

    You can also use \n, but you can't change font/style of the rendered text of a UITextView.