I am developing an application for Mac OS X. I want to change indication contents by the language locale (English, Spanish, etc.) of the application user, how do I get information of which language is used?
A locale representing the user's region settings at the time the property is read.
Detailed Answer: current returns the current locale, that is, the value set by Settings > General > Language & Region > Region Formats.
You can use Locale. getDefault(). getLanguage(); to get the usual language code (e.g. "de", "en").
A locale is a set that defines the language and region preferences that the user wants to see in their user interface. Usually a locale identifier includes a language code and a country or region code.
NSLog(@"localeIdentifier: %@", [[NSLocale currentLocale] localeIdentifier]);
You can use the NSLocale API to get that information, but it isn't necessary to do what you want to do. OS X has support for localization built into the OS — all you need to do is supply the appropriate language files and the user can select which language he wants.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With