14

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.

4

6 に答える 6

6

この投稿には、いくつかのヒントが含まれている可能性があります。

http://blog.wilshipley.com/2009/10/pimp-my-code-part-17-lost-in.html

于 2010-11-02T17:32:01.087 に答える
2

この投稿が古いものであっても、IB ファイルの自動ローカライズに関心がある場合は、 https ://github.com/angelolloqui/AGi18n を確認してください。

免責事項:私はライブラリの開発者です

于 2013-03-19T09:24:59.063 に答える
2

ユーザー定義のランタイム属性の高度な機能を利用できます。

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 ローカライズする文字列

ここに画像の説明を入力

于 2014-04-26T08:23:48.363 に答える
1

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/

于 2010-11-02T16:46:03.540 に答える
0

@OAKが言及したのと同じことをしました。ここに完全なコードがあります。

Interface Builder のローカリゼーション ハウツー

于 2014-09-30T20:09:48.070 に答える