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
dim a(-1) as string = NSLocalembs.availableLocaleIdentifiers

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

dim c as Integer = UBound(a)

for i as Integer=0 to c
dim 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
dim identifier as string=a(i)
dim 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
dim displayNameString as string

// The first uses the fr_FR locale.

dim 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.

dim 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
dim 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.localeIdentifier 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 identifier for the receiver.

The identifier for the receiver. This may not be the same string that the locale was created with, since NSLocale may canonicalize it.

Available in Mac OS X v10.4 and later.

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


The biggest plugin in space...