我在信号面板bir EN
另有FR
中有2个细分,但在我的应用中有语言更改,人们可以在应用程序内部每次更改应用程序语言,当我从我发送的一个信号发送推送时段,但我想在语言部分添加appdelegate
如果用户语言是英语,则必须提醒英语,如果用户语言法国必须警惕法国推动。
在我的应用程序端语言选择字符串是
let appcurrentlanguage = prefs.value(forKey: "lang") as! String
我该怎么做?
我的代码在下面
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
//HERE APP LANGUAGE
let appcurrentlanguage = prefs.value(forKey: "lang") as! String
GMSServices.provideAPIKey("xxx")
OneSignal.initWithLaunchOptions(launchOptions, appId: "xxx") { (result) in
let payload = result?.notification.payload
if let additionalData = payload?.additionalData, let actionSelected = additionalData["comes"] as? String {
if actionSelected == "1" {
let mainStoryboardIpad : UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
let initialViewControlleripad : UIViewController = mainStoryboardIpad.instantiateViewController(withIdentifier: "ViewController") as! ViewController
self.window = UIWindow(frame: UIScreen.main.bounds)
self.window?.rootViewController = initialViewControlleripad
self.window?.makeKeyAndVisible()
}else if actionSelected == "2" {
if let newsID = additionalData["id"] as? String {
prefs.setValue(newsID, forKeyPath: "gelenID")
prefs.synchronize()
}
if let newsType = additionalData["type"] as? String {
prefs.setValue(newsType, forKeyPath: "newsType")
prefs.synchronize()
}
}
}
}
sleep(2)
return true
}