从情节提要本地化属性 UITextView [英] Localizing attributed UITextView from storyboard
问题描述
我正在使用情节提要并有一个视图,其中我对一些 UITextViews 进行了子类化.
I am using the storyboard and have a view where I have subclassed some UITextViews.
我的问题是我正在使用 ibtool --generate-strings-file
从情节提要中提取字符串以进行本地化,然后在另一个情节提要文件上使用 ibtool -write
应用翻译后的字符串.
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.
当我使用 ibtool
时,任何具有属性文本的 UITextView 都会被 ibtool --generate-strings-file
命令忽略,并从生成的字符串文件中省略.
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?
推荐答案
我最终得出结论,在当前版本中使用 ibtool
无法完成.
I ended up concluding that it couldn't be done using ibtool
in the present version.
相反,我让 Textview 成为纯文本视图,并使用我的子类解析其文本属性,以便我可以创建一个 NSMutableAttributedString
并设置所需的属性.
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.
这使我能够使用 ibtool
来提取字符串并且仍然拥有一个属性化的 textview.
That enabled me to use ibtool
to extract the strings and still have an attributed textview.
这篇关于从情节提要本地化属性 UITextView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!