-
Notifications
You must be signed in to change notification settings - Fork 1
Locale
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);
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 );
Use preffered localization
using SA.iOS.Foundation;
...
var preferredLocalization = ISN_NSBundle.MainBundle.PreferredLocalization;
Debug.Log("PreferredLocalization: " + preferredLocalization);
Reliable and high-quality Unity Development service. Let's Talk!
Website | AssetStore | LinkedIn | Youtube | Scripting Reference
- Getting Started
- Authentication
- Game Center UI
- Leaderboards
- Default Leaderboard
- Achievements
- Saving A Game
- Access Point
- iTunes Connect Setup
- StoreKit Initialization
- Purchase flow
- Receipt Validation
- Store Review Controller
- Storefront API
- Subscription Offers