Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>So, I did some research, and it seems that in order for this to work correctly, the text for the UITextView needs to be set programmatically.</p> <p>Source: <a href="https://devforums.apple.com/message/883759#883759" rel="nofollow">Devforums.apple</a></p> <p>Quote: </p> <blockquote> <p>as I understand it, strings such as the text property of a text view/field have to be set in code using NSLocalizedString. The first 1/2 hour of WWDC 2013 video session #219 Making Your App World Ready covers this if you have the time to watch it</p> </blockquote> <p>So, it seems that the workaround (if you don't want to set the text programmatically) is to convert the strings file into a storyboard before shipping the app. This does seem to work as intended and shows the UITextView properly localized.</p> <p>EDIT: Found another workaround that allows to keep .strings file. </p> <p>In <code>- (void)viewDidLoad</code>:</p> <pre><code>for(UIView* v in self.view.subviews) { if([v isKindOfClass:[UITextView class]]) { UITextView* txv = (UITextView*)v; NSString *loctxt = [txv.text stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; txv.text = NSLocalizedString(loctxt, @""); } } </code></pre> <p>This produces a Percent Escapes encoded string from whatever is inside the storyboard, like this:</p> <pre><code>Hello%20World </code></pre> <p>In your <code>Localizable.strings</code> file, you use the above as the key, and this will produce the localized text in the app at runtime for the selected locale, like this:</p> <pre><code>"Hello%20World" = "Hallo Welt"; </code></pre> <p>The Percent escaping takes care of all escape characters in the base string.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload