Skip to content

Instantly share code, notes, and snippets.

@yossan
Created September 12, 2015 07:54
Show Gist options
  • Save yossan/1d9f76ab2c96f4d47bdf to your computer and use it in GitHub Desktop.
Save yossan/1d9f76ab2c96f4d47bdf to your computer and use it in GitHub Desktop.
import Foundation
let constants = [
NSLocaleIdentifier,
NSLocaleLanguageCode,
NSLocaleCountryCode,
NSLocaleScriptCode,
NSLocaleVariantCode,
NSLocaleExemplarCharacterSet,
NSLocaleCalendar,
NSLocaleCollationIdentifier,
NSLocaleUsesMetricSystem,
NSLocaleMeasurementSystem,
NSLocaleDecimalSeparator,
NSLocaleGroupingSeparator,
NSLocaleCurrencySymbol,
NSLocaleCurrencyCode,
NSLocaleCollatorIdentifier,
NSLocaleQuotationBeginDelimiterKey,
NSLocaleQuotationEndDelimiterKey,
NSLocaleAlternateQuotationBeginDelimiterKey,
NSLocaleAlternateQuotationEndDelimiterKey
]
let locale = NSLocale(localeIdentifier:"ja_JP")
func output(localeKey:String) {
print("\(localeKey) = \(locale.objectForKey(localeKey))")
}
for constant in constants {
output(constant)
}
//print(locale.objectForKey(NSLocaleScriptCode))
//print(locale.localeIdentifier)
//print(locale.displayNameForKey(NSLocaleIdentifier, value:"en_JP"))
//print(locale.displayNameForKey(NSLocaleLanguageCode, value:"en_JP"))
//print(locale.displayNameForKey(NSLocaleCountryCode, value:"USA"))
//print(locale.displayNameForKey(NSLocaleScriptCode, value:"Latn"))
//print(locale.displayNameForKey(NSLocaleScriptCode, value:"Hira"))
//print(locale.displayNameForKey(NSLocaleScriptCode, value:"Kana"))
//print(locale.displayNameForKey(NSLocaleScriptCode, value:"Hang"))
//print(NSLocale.preferredLanguages())
//print(NSLocale.ISOCountryCodes())
//print(NSLocale.ISOLanguageCodes())
/*
let NSLocaleIdentifier: String
let NSLocaleLanguageCode: String
let NSLocaleCountryCode: String
let NSLocaleScriptCode: String
let NSLocaleVariantCode: String
let NSLocaleExemplarCharacterSet: String
let NSLocaleCalendar: String
let NSLocaleCollationIdentifier: String
let NSLocaleUsesMetricSystem: String
let NSLocaleMeasurementSystem: String
let NSLocaleDecimalSeparator: String
let NSLocaleGroupingSeparator: String
let NSLocaleCurrencySymbol: String
let NSLocaleCurrencyCode: String
let NSLocaleCollatorIdentifier: String
let NSLocaleQuotationBeginDelimiterKey: String
let NSLocaleQuotationEndDelimiterKey: String
let NSLocaleAlternateQuotationBeginDelimiterKey: String
let NSLocaleAlternateQuotationEndDelimiterKey: String
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment