NSLocalizedString() 参数 "value" 和 "tableName" 有什么作用?
What do NSLocalizedString() parameters "value" and "tableName" do?
Apple 文档(在 Xcode 和网页中)完全 没有 参数解释。
https://developer.apple.com/documentation/foundation/1418095-nslocalizedstring
作为参考,函数签名是
NSLocalizedString(
_ key : String,
tableName: String? = default, // ??
bundle : Bundle = default,
value : String = default, // ????
comment : String
) -> String
我不太清楚 tableName
是什么 -- 但更多信息会有所帮助。 (它仅仅是字符串文件的文件名吗?)我不知道 value
是干什么用的。
NSLocalizedStringWithDefaultValue
的 Objective-C 文档解释了参数:
Parameters
key
The key for a string in the specified table.
tableName
The name of the table containing the key-value pairs. Also, the suffix for the strings file (a file with the .strings extension) to store the localized string.
bundle
The bundle containing the strings file.
value
The value to return if key is nil or if a localized string for key can’t be found in the table.
comment
The comment to place above the key-value pair in the strings file.
基本上,key
是在指定包中名为 tableName.strings
的文件中查找的。该字符串文件的格式为:
# comment
"key" = "value"
Apple 文档(在 Xcode 和网页中)完全 没有 参数解释。
https://developer.apple.com/documentation/foundation/1418095-nslocalizedstring
作为参考,函数签名是
NSLocalizedString(
_ key : String,
tableName: String? = default, // ??
bundle : Bundle = default,
value : String = default, // ????
comment : String
) -> String
我不太清楚 tableName
是什么 -- 但更多信息会有所帮助。 (它仅仅是字符串文件的文件名吗?)我不知道 value
是干什么用的。
NSLocalizedStringWithDefaultValue
的 Objective-C 文档解释了参数:
Parameters
key
The key for a string in the specified table.tableName
The name of the table containing the key-value pairs. Also, the suffix for the strings file (a file with the .strings extension) to store the localized string.bundle
The bundle containing the strings file.value
The value to return if key is nil or if a localized string for key can’t be found in the table.comment
The comment to place above the key-value pair in the strings file.
基本上,key
是在指定包中名为 tableName.strings
的文件中查找的。该字符串文件的格式为:
# comment
"key" = "value"