我正在尝试本地化字符串列表。我有一些照片,每张照片都有这样的描述,我想用另一种语言翻译这些描述。 那是代码:
ViewController.swift
var imageList:[String] = ["new_york_city_sky_house_skyscraper_59212_640x1136.jpg","79506M1pZO4U6d12i0Xzf27765gWo71P5061732uthh68xHQ8Dq1yTQ0Bj8p9F45.jpg","iphone 5 wallpaper new york.jpg","New-York-Vintage-Effect-iphone-5-wallpaper-ilikewallpaper_com.jpg","Superb-View-Over-New-York-iphone-5-wallpaper-ilikewallpaper_com.jpg","New-York-Empire-State-Building-1136x640.jpg","New-York-City-iphone-5s-wallpaper-ilikewallpaper_com.jpg","new-york-city.jpg","New-York-By-Day-iphone-5-wallpaper-ilikewallpaper_com.jpg","The-Empire-State-Building-New-York-1136x640.jpg"]
var nameList:[String] = ["NYC","New York", "Empire State Building","4","5","6","7","8","9","10"]
var sentMessage: [String] = ["NYC 1", "New York 2", "Empire State Building 3", "Description here 4", "Description here 5", "Description here 6", "Description here 7", "Description here 8", "Description here 9", "Description here 10"]
let minimages = 0
let maximages = 9
var imageIndex : NSInteger = 0
@IBAction func showView(){
let vc = SecondViewController(nibName: "SecondViewController", bundle: nil)
vc.sentMessage = sentMessage[imageIndex]
showViewController(vc, sender: self)
SecondViewController.swift
@IBOutlet var myMessage : UILabel?
var sentMessage: String = ""
override func viewDidLoad() {
super.viewDidLoad()
myMessage?.text = sentMessage
我希望翻译名单列表类别并发送消息类别,如下所示:"说明此处1"在" Descrizione qui 1","描述在这里2"在" Descrizione qui 2" ...
我该怎么办?我正在学习创建一个应用程序,因为我有一些想法,但我被困在这里......谢谢!
答案 0 :(得分:-1)
Ciao Matteo
Localize-Swift 是一个简单的框架,可以改进Swift iOS应用程序中的i18n和本地化 - 提供更清晰的语法和应用程序内语言切换。
通过在Podfile上添加以下内容来安装它
pod'Localize-Swift','〜> 1.6'
阅读its Gitpage了解详细信息