Search code examples
iosxcodelocalizationnsattributedstring

Localizing attributed UITextView from storyboard


I am using the storyboard and have a view where I have subclassed some UITextViews.

My problem is that I am using ibtool --generate-strings-file to extract strings from the storyboard for localization and afterwards use ibtool -write on another storyboard file to apply the translated strings.

When I use ibtool any UITextViews that have attributed text is ignored by the ibtool --generate-strings-file command and omitted from the resulting strings file.

Is it possible to extract attributed text from a storyboard for localization?


Solution

  • I ended up concluding that it couldn't be done using ibtool in the present version.

    Instead I let the Textview be a plain text view and, using my subclass, parsed its text property so I could make a NSMutableAttributedString and set the needed properties.

    That enabled me to use ibtool to extract the strings and still have an attributed textview.