Mat*_*teo 1 localization swift
我正在尝试为不同的语言本地化一个数组.
我想要本地化的数组看起来像:
var watch = ["This watch is blue", "this watch is red", "this watch is white "]
Run Code Online (Sandbox Code Playgroud)
我已经有字符串localizable,我正在使用该方法,NSLocalizedString但我不知道如何使用所有不同的描述本地化数组.
感谢您的帮助
如果您已在应用程序中设置了本地化,则仍可以使用NSLocalizedStringin作为数组元素而不是直接字符串.
假设你有一个Localizable.stringsas:
"BlueMessage" = "This watch is blue";
"RedMessage" = "this watch is red";
"WhiteMessage" = "This watch is white ";
Run Code Online (Sandbox Code Playgroud)
然后你可以将watch数组声明为:
var watch = [NSLocalizedString("BlueMessage", comment: ""),
             NSLocalizedString("RedMessage", comment: ""),
             NSLocalizedString("WhiteMessage", comment: "")]
Run Code Online (Sandbox Code Playgroud)
它也是一个strings([String])数组,包含字符串的本地化版本.
|   归档时间:  |  
           
  |  
        
|   查看次数:  |  
           292 次  |  
        
|   最近记录:  |