美文网首页
iOS多语言配置

iOS多语言配置

作者: TomorrowNice | 来源:发表于2017-03-20 15:33 被阅读0次

一、先从最简单的开始.

1、 在工程的Info.plist添加个字段: Application has localized display name 适配应用名。

2、在工程的project中添加需要的语言

二、添加 多语言displayName的.strings文件。

1、command + n  addfiles 选择Resource中的 Strings File  然后命名为InfoPlist

2、点击刚才创建的InfoPlists.strings文件,在右边Localization下面点按钮,添加刚刚添加的语言,然后再需要的下面打钩

在InfoPlist.strings中对应位置添加如下东西,多语言下app的名就弄好了。

CFBundleDisplayName ="中文的";

CFBundleDisplayName ="english";

三、界面中的字体语言多语言化。

command+n  添加Strings File文件,命名为Localizable.strings

重复上面二(2)的操作。

"textlabel"="english"; 英文环境下

"textlabel"="汉语";中文环境下

四,使用

UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(100, 100, 150, 30)];

label.text = NSLocalizedString(@"textlabel", @"");

[self.view addSubview:label];

相关文章

网友评论

      本文标题:iOS多语言配置

      本文链接:https://www.haomeiwen.com/subject/jrtinttx.html