SDK内本地化处理 localizedStringForKey:value:table:


参考:

1,https://developer.apple.com/documentation/foundation/nsbundle/1417694-localizedstringforkey

2,MJRefresh

 

原理:
1,找到本地化字符串表(string table)对应的 bundle,例如,en.lproj

2,调用系统提供的在string table中值的方法

[targetBundle localizedStringForKey:key value:value table:nil];

value和table一般都是nil。

value的作用是找不到key后的提示。

如果value为nil,找不到key提示为@"" 空字符串。

value可以这样设置下

value = [NSString stringWithFormat:@"%@ 对应的本地化字符串没有在%@ 中找到",key,targetBundle];

The receiver’s string table to search. If tableName is nil or is an empty string, the method attempts to use the table in Localizable.strings.

 

tableName传入nil,会在bundle的Localizable.strings里查找。

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM