Is there any way to insert an NSLocalizedString in interface builder. For example set a label text to a localized string instead of a static string?
I really hate to create a property for every single item that requires a localized string.
Is there any way to insert an NSLocalizedString in interface builder. For example set a label text to a localized string instead of a static string?
I really hate to create a property for every single item that requires a localized string.
この投稿には、いくつかのヒントが含まれている可能性があります。
http://blog.wilshipley.com/2009/10/pimp-my-code-part-17-lost-in.html
この投稿が古いものであっても、IB ファイルの自動ローカライズに関心がある場合は、 https ://github.com/angelolloqui/AGi18n を確認してください。
免責事項:私はライブラリの開発者です
ユーザー定義のランタイム属性の高度な機能を利用できます。
http://cupobjc.blogspot.com.es/2014/04/interfaz-builder-localization.html
まず、UILabel の新しいカテゴリを定義します。
#import "UILabel+Localized.h"
@implementation UILabel (Localized)
-(void) setTextLocalized:(NSString *)aText{
[self setText:NSLocalizedString(aText, nil)];
}
@end
次に、インターフェイス ビルダーで、 User Defined Runtime Attributes :
textLocalized String ローカライズする文字列

NSLocalizedString is not the recommended way to localize Interface Builder files. Check out ibtool:
http://www.bdunagan.com/2009/03/15/ibtool-localization-made-easy/
@OAKが言及したのと同じことをしました。ここに完全なコードがあります。