如何本地化解析数据?

时间:2013-01-02 06:21:01

标签: iphone objective-c ios xcode localization

我正在进行本地化。我得到了一些有关它的信息,即在Localizable.strings中编辑标签文本。但我想本地化解析数据。我在下面用于编辑Localizable.strings中的标签文本。对此有何想法?

label1.text=NSLocalizedString(@"One", @"The Number1");
label2.text=NSLocalizedString(@"Two", @"The Number 2");

.....

Data is editing in 
 /* The Number 5 */
 "Five" = "Five";

/* The Number 4 */
"Four" = "Four";

/* The Number1 */
"One" = "One";

/* The Number 3 */
"Three" = "Three";

/* The Number 2 */
"Two" = "Two";

1 个答案:

答案 0 :(得分:1)

见这个例子:

Localizable.strings(English)

"Home" = "Home";

Localizable.strings(Danish)

"Home" = "Hjem";

Localizable.strings获取密钥:

currentKey = NSLocalizedString(@"Home", nil);

让你的yourParseDataDictionary:

value = "ABCD" for key = Home
value = "EFGH" for key = Hjem

然后你可以获得价值:

currentValue = [yourParseDataDictionary objectForKey:currentKey];

// currentValue = [yourParseDataDictionary objectForKey:@"Home"]; // In english
// currentValue = [yourParseDataDictionary objectForKey:@"Hjem"]; // In Danish