NSLocalizedString()的第二个参数是什么? [英] What is the second parameter of NSLocalizedString()?

查看:184
本文介绍了NSLocalizedString()的第二个参数是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是*comment参数:

NSString *NSLocalizedString(NSString *key, NSString *comment)

如果我这样做:

NSLocalizedString(@"Hello_World_Key", @"Hello World")

,并且有两个版本的Localizable.strings(英语和西班牙语),每个都需要输入:

and have two versions of a Localizable.strings (English and Spanish), does each need the entry:

English.lproj/Localization.strings: @"Hello_World_Key" = @"Hello World";

Spanish.lproj/Localization.strings: @"Hello_World_Key" = @"Hola Mundo";

英语不是多余的吗?

推荐答案

注释字符串被应用程序忽略.它用于翻译者的利益,可在您的应用程序中找到的键的上下文用法中添加含义.

The comment string is ignored by the application. It is used for a translator's benefit, to add meaning to the contextual usage of the key where it is found in your application.

例如,Hello_World_Key键在给定语言中可能采用不同的值,具体取决于Hello World短语在该语言中需要使用的正式或非正式形式("What's up World","Yo World","Yo World",美好的一天世界",等等.

For example, the Hello_World_Key key may take different values in a given language, depending on how formal or informal the Hello World phrase needs to be in that language ("What's up World", "Yo World", "Good Day World", etc.).

您可以在注释字段中添加一个字符串,以向翻译者提示这种用法,翻译者(可能会认为)可以更好地本地化您的应用程序.

You can add a string in the comment field to hint this usage to the translator, who will (one would presume) be better able to localize your application.

这篇关于NSLocalizedString()的第二个参数是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆