本地化
其他可以參考
http://www.cocoachina.com/ios/20170122/18609.html
/*
key
The key for a string in the table identified by tableName.
value
The value to return if key is nil or if a localized string for key can’t be found in the table.
tableName
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
*/
NSString *title = [[NSBundle mainBundle] localizedStringForKey:@"cancle" value:@"" table:nil];
NSString *title = NSLocalizedStringFromTable(@"cancle", @"Test", nil);
系統(tǒng)定義的宏
NSLocalizedString(<#key#>, <#comment#>)
NSLocalizedStringFromTable(<#key#>, <#tbl#>, <#comment#>)
NSString *title = NSLocalizedStringFromTable(@"cancle", @"Test", nil);
[self.btn setTitle:title forState:UIControlStateNormal];
命令:
genstrings file
genstrings 目錄/* 該目錄下的所有文件