我正在創建一個Mac應用程序,我想本地化我的標籤。我認爲.strings
文件將是一個更好的選擇。但是我在閱讀Objective-C中的.strings
文件時遇到了困難。我正在尋找一種更簡單的方法。在Objective-C中讀取.strings文件?
這是我.string
文件內容:
"LABEL_001" = "Start MyApp";
"LABEL_002" = "Stop MyApp";
"LABEL_003" = "My AppFolder";
...
這是我的代碼:
NSBundle *bundle = [NSBundle mainBundle];
NSString *strFilePath = [[NSBundle mainBundle] pathForResource:@"Labels" ofType:@"strings"];
NSString *tt =NSLocalizedStringFromTableInBundle(@"LABEL_001",strFilePath,bundle, nil);
NSLog(@"STRING ::: %@",tt);
但串TT給人"LABEL_001"
,我想"Start MyApp"
我在做什麼錯?
你看着NSLocalizedString? – Luke 2012-08-17 10:44:11