Platforms to show: All Mac Windows Linux Cross-Platform

Back to NSLocaleMBS class.

NSLocaleMBS.Constructor

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Currency, Date and Time Format MBS MacBase Plugin 7.4 ✅ Yes ❌ No ❌ No ✅ Yes All
The default constructor.

Available in Mac OS X v10.4 and later.
Loads the same values for this object as if you just take the object from NSLocaleMBS.currentLocale.

See also:

NSLocaleMBS.Constructor(Identifier as string)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Currency, Date and Time Format MBS MacBase Plugin 9.1 ✅ Yes ❌ No ❌ No ✅ Yes All
The constructor.
Example
Var a(-1) as string = NSLocalembs.availableLocaleIdentifiers

// show all identifers:
Var s(-1) as string
s.Append "All available Locale Identifiers:"

Var c as Integer = UBound(a)

for i as Integer=0 to c
Var identifier as string=a(i)
s.Append identifier
next

MsgBox Join(s)

// now show the currency symbols:

redim s(-1)
s.Append "All Currency symbols:"

c = UBound(a)
for i as Integer=0 to c
Var identifier as string=a(i)
Var n as new NSLocaleMBS(identifier)
s.Append n.CurrencySymbol
next

MsgBox Join(s)

Available in Mac OS X v10.4 and later.
Pass in the country identifier which you get with the availableLocaleIdentifiers function.

See also:

NSLocaleMBS.displayName(key as string, value as string) as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Currency, Date and Time Format MBS MacBase Plugin 9.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns the display name for the given value.
Example
Var displayNameString as string

// The first uses the fr_FR locale.

Var frLocale as new NSLocaleMBS("fr_FR")

displayNameString = frLocale.displayName(frLocale.NSLocaleIdentifier, "fr_FR")
MsgBox "display name for fr_FR in fr_FR: "+displayNameString
// shows: "display name for fr_FR in fr_FR: français (France)"

displayNameString = frLocale.displayName(frLocale.NSLocaleIdentifier, "en_US")
MsgBox "display name for en_US in fr_FR: "+displayNameString
// shows: "display name for en_US in fr_FR: anglais (États-Unis)"

// The following example uses the en_GB locale.

Var gbLocale as new NSLocaleMBS("en_US")

displayNameString = gbLocale.displayName(frLocale.NSLocaleIdentifier, "fr_FR")
MsgBox "display name for fr_FR in en_US: "+displayNameString
// shows: "display name for fr_FR in en_US: French (France)"

displayNameString = gbLocale.displayName(frLocale.NSLocaleIdentifier, "en_US")
MsgBox "display name for en_US in en_US: "+displayNameString
// shows: "display name for en_US in en_US: English (United States)"

Not all locale property keys have values with display name values.

You can use the NSLocaleIdentifier key to get the name of a locale in the language of another locale, as illustrated in the example code above.

NSLocaleMBS.ExemplarCharacterSet as Variant

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Currency, Date and Time Format MBS MacBase Plugin 9.6 ✅ Yes ❌ No ❌ No ✅ Yes All
The exemplar character set for the locale.
Example
Var n as NSLocaleMBS = NSLocaleMBS.currentLocale

MsgBox n.ExemplarCharacterSet.StringValue
// shows "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzÄÖÜßäöü" in Germany

Returns a NSCharacterSetMBS object.
Available in Mac OS X v10.4 and later.

NSLocaleMBS.GetString(key as string) as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Currency, Date and Time Format MBS MacBase Plugin 7.4 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns a string for one of the NSLocate keys.

Available in Mac OS X v10.4 and later.
This keys can be found int he NSLocale reference from Apple.

NSLocaleMBS.localizedStringForCalendarIdentifier(CalendarIdentifier as String) as String

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Currency, Date and Time Format MBS MacBase Plugin 24.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns the localized string for the specified calendar identifier.
Example
Var l As NSLocaleMBS = NSLocaleMBS.currentLocale
MessageBox l.localizedStringForCalendarIdentifier(l.calendarIdentifier)

calendarIdentifier: The calendar identifier indicating the calendar whose name you want. Use one of the values listed in Calendar Identifiers.

Returns a human readable string suitable for display to the user corresponding to the given calendar.

For example, on an American English (en_US) locale, passing NSCalendarIdentifierGregorian as the identifier, produces the string "Gregorian Calendar".

NSLocaleMBS.localizedStringForCollationIdentifier(CollationIdentifier as String) as String

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Currency, Date and Time Format MBS MacBase Plugin 24.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns the localized string for the specified variant code.

variantCode: The variant code whose name you want.

Returns the localized name of the variant.

For example, calling this method on an American English (en_US) locale, passing "POSIX" for variantCode, produces the string "Computer".
This method is equivalent to calling the displayNameForKey() method passing the NSLocaleVariantCode key and variantCode value.

NSLocaleMBS.localizedStringForCollatorIdentifier(CollatorIdentifier as String) as String

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Currency, Date and Time Format MBS MacBase Plugin 24.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns the localized string for the specified collator identifier.

collatorIdentifier: The identifier for the collator whose name you want.

Returns the localized name of the collator.

This method is equivalent to calling the displayNameForKey method passing the NSLocaleCollatorIdentifier key and collatorIdentifier value.

NSLocaleMBS.localizedStringForCountryCode(CountryCode as String) as String

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Currency, Date and Time Format MBS MacBase Plugin 24.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns the localized string for a country or region code.
Example
Var l As NSLocaleMBS = NSLocaleMBS.currentLocale
MessageBox l.countryCode + ": " + l.localizedStringForCountryCode(l.countryCode)

countryCode: The code of the country or region that indicates the name you want.

Returns the localized name of the country or region.

For example, calling this method on an American English (en_US) locale, passing "GB" for countryCode, produces the string "United Kingdom".
This method is equivalent to calling the displayNameForKey() method passing the NSLocaleCountryCode key and countryCode value.

NSLocaleMBS.localizedStringForCurrencyCode(CurrencyCode as String) as String

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Currency, Date and Time Format MBS MacBase Plugin 24.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns the localized string for the specified currency code.
Example
Var l As NSLocaleMBS = NSLocaleMBS.currentLocale
MessageBox l.currencyCode + ": " + l.localizedStringForCurrencyCode(l.currencyCode)

currencyCode: The code for the currency whose name you want.

Returns the localized name of the currency.

For example, calling this method on an American English (en_US) locale, passing "JPY" for currencyCode, produces the string "Japanese Yen".
This method is equivalent to calling the displayNameForKey() method passing the NSLocaleCurrencyCode key and currencyCode value.

NSLocaleMBS.localizedStringForLanguageCode(LanguageCode as String) as String

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Currency, Date and Time Format MBS MacBase Plugin 24.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns the localized string for the specified language code.
Example
Var l As NSLocaleMBS = NSLocaleMBS.currentLocale
MessageBox l.languageCode + ": " + l.localizedStringForLanguageCode(l.languageCode)

languageCode: The language code indicating the language whose name you want.

Returns the localized name of the language.

For example, calling this method on an American English (en_US) locale, passing "zh" for languageCode, produces the string "Chinese".
This method is equivalent to calling the displayNameForKey() method passing the NSLocaleLanguageCode key and languageCode value.

NSLocaleMBS.localizedStringForLocaleIdentifier(LocaleIdentifier as String) as String

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Currency, Date and Time Format MBS MacBase Plugin 24.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns the localized string for the specified locale identifier.
Example
Var l As NSLocaleMBS = NSLocaleMBS.currentLocale
MessageBox l.localeIdentifier + ": " + l.localizedStringForLocaleIdentifier(l.localeIdentifier)

localeIdentifier: The identifier for which you want the localized name.

Returns the localized name of the locale.

For example, calling this method on an American English (en_US) locale, passing "fr_FR" for localeIdentifier, produces the string "French (France)".
This method is equivalent to calling the displayNameForKey() method passing the NSLocaleIdentifier key and localeIdentifier value.

NSLocaleMBS.localizedStringForScriptCode(ScriptCode as String) as String

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Currency, Date and Time Format MBS MacBase Plugin 24.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns the localized string for the specified script code.

scriptCode: The script code for the script whose name you want.

Returns the localized name of the script.

For example, calling this method on an American English (en_US) locale, passing "Hant" for scriptCode, produces the string "Traditional Han".
This method is equivalent to calling the displayNameForKey() method passing the NSLocaleScriptCode key and scriptCode value.

NSLocaleMBS.localizedStringForVariantCode(VariantCode as String) as String

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Currency, Date and Time Format MBS MacBase Plugin 24.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns the localized string for the specified variant code.

variantCode: The variant code whose name you want.

Returns the localized name of the variant.

For example, calling this method on an American English (en_US) locale, passing "POSIX" for variantCode, produces the string "Computer".
This method is equivalent to calling the displayNameForKey() method passing the NSLocaleVariantCode key and variantCode value.

The items on this page are in the following plugins: MBS MacBase Plugin.


The biggest plugin in space...