How to get language/country code using NSLocale in Swift 3 Posted on 2018-01-19 if let languageCode = (Locale.current as NSLocale).object(forKey: .languageCode) as? String { print(languageCode) } if let countryCode = (Locale.current as NSLocale).object(forKey: .countryCode) as? String { print(countryCode) } 執行結果是: zh TW