123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- //
- // LanguagesUtil.swift
- // ADHTuanCan
- //
- // Created by 敖德亨 on 2023/10/25.
- //
- import UIKit
- @objc(LanguagesUtil)
- @objcMembers
- class LanguagesUtil: NSObject {
-
- class func createTextBy(Ctext:String?,Etext:String?) -> String{
-
- let languanges : [String] = UserDefaults.standard.object(forKey: "AppleLanguages") as! [String]
- let preferredLanguage = languanges.first
-
- // if preferredLanguage == "zh-Hans-CN" || preferredLanguage == "zh-Hant-CN" || preferredLanguage == "zh-Hant-HK" || preferredLanguage == "zh-Hant-MO" || preferredLanguage == "zh-Hant-TW" || preferredLanguage == "zh-Hans-US"{
- // return Ctext ?? ""
- // }else{
- // return Etext ?? ""
- // }
- if preferredLanguage!.contains("zh"){
- return Ctext ?? ""
- }else{
- return Etext ?? ""
- }
-
- }
-
- class func isEnLanguage() -> Bool{
-
- let languanges : [String] = UserDefaults.standard.object(forKey: "AppleLanguages") as! [String]
- let preferredLanguage = languanges.first
-
-
- if preferredLanguage!.contains("zh"){
- return false
- }else{
- return true
- }
-
- // if preferredLanguage == "zh-Hans-CN" || preferredLanguage == "zh-Hant-CN" || preferredLanguage == "zh-Hant-HK" || preferredLanguage == "zh-Hant-MO" || preferredLanguage == "zh-Hant-TW" || preferredLanguage == "zh-Hans-US"{
- // return false
- // }else{
- // return true
- // }
- }
- }
|