1234567891011121314151617181920212223242526272829303132333435363738 |
- //
- // 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"{
- 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 == "zh_Hans_CN" || preferredLanguage == "zh-Hant-CN" || preferredLanguage == "zh-Hant-HK" || preferredLanguage == "zh-Hant-MO" || preferredLanguage == "zh-Hant-TW"{
- return false
- }else{
- return true
- }
- }
- }
|