Skip to content
levching edited this page Apr 15, 2020 · 3 revisions

The ISN_NSLocale will provide an Information about linguistic, cultural, and technological conventions for use in formatting data for presentation.

The CurrentLocale property is representing the user's region settings at the time the property is read. The locale is formed from the settings for the current user’s chosen system locale overlaid with any custom settings the user has specified. Use this property when you need to rely on a consistent locale. A locale instance obtained this way does not change even when the user changes region settings.

See the code snippet below:

using SA.iOS.Foundation;
...
var currentLocale = ISN_NSLocale.CurrentLocale;
Debug.Log("currentLocale.Identifier: " + currentLocale.Identifier);
Debug.Log("currentLocale.CountryCode: " + currentLocale.CountryCode);
Debug.Log("currentLocale.CurrencyCode: " + currentLocale.CurrencyCode);
Debug.Log("currentLocale.LanguageCode: " + currentLocale.LanguageCode);
Debug.Log("currentLocale.CurrencySymbol: " + currentLocale.CurrencySymbol);

If you want a local instance that always reflects the current configuration, use the one provided by the AutoupdatingCurrentLocale property instead.

using SA.iOS.Foundation;
...
var locale = ISN_NSLocale.AutoUpdatingCurrentLocale;
Debug.Log("Identifier: " + locale.Identifier);
Debug.Log("CountryCode: " + locale.CountryCode);
Debug.Log("CurrencyCode: " + locale.CurrencyCode);
Debug.Log("LanguageCode: " + locale.LanguageCode);
Debug.Log("CurrencySymbol: " + locale.CurrencySymbol);

System Language

In the most use cases, you would probably want to know not the user current locale but also his current phone system language and preferred localization as well.

Users choose a primary language when configuring a device, as described in Reviewing Language and Region Settings. Use this property to obtain the current user's ordered language.

For more information about language localization in your app, see Language and Locale IDs.

using SA.iOS.Foundation;
...

var preferredLanguage = ISN_NSLocale.PreferredLanguage;
Debug.Log("preferredLanguage : " + preferredLanguage );

Preferred Language

Use preffered localization

using SA.iOS.Foundation;
...

var preferredLocalization = ISN_NSBundle.MainBundle.PreferredLocalization;
Debug.Log("PreferredLocalization: " + preferredLocalization);

About

Foundation

AV Foundation

App Tracking Transparency

Game Kit

Store Kit

UI Kit

Social

Replay Kit

Contacts

AVKit

Photos

App Delegate

User Notifications

MediaPlayer

Core Location

AdSupport

EventKit

CloudKit

Authentication Services

XCode

Knowledge Base

Clone this wiki locally