Mac

The Mac stores language information in several locations in the global preferences domain. Thus, we read them all using the shell command 'defaults read -g X' where X is the property that we want. Parsing is regrettably not consistent, but will be documented at each stage.

Per one of Apple's support posts (which I regrettably did not save a link to), use of these defaults calls is not considered a public API, and is subject to change. Nonetheless, they appear to be generally stable and should work going back to at least 2012 (OS X Mountain Lion), and probably a good bit further back than that. If we need to version guard any piece, I've specifically designed this file to make that straightforward.

The stable API requires a call to Apple's Foundation frameworks. This is done via NativeCall. Because of the way that GateKeeper works, I'm not entirely convinced that this is something that can be guaranteed to function long term without requiring users to build on their system (which requires clang or gcc to be installed). For this reason, I have also maintained similar code in Raku using the aforementioned non-public/non-stable (but very in the open, very unchanged) API provided through defaults.

Intl::UserLanguage v0.4.0

A simple module for obtaining the user’s preferred language(s)

Authors

  • Matthew ‘Matéu’ Stephen STUCKWISCH

License

Artistic-2.0

Dependencies

Intl::LanguageTag:auth:<zef:guifa>:ver<0.12.1+>

Test Dependencies

Provides

  • Intl::UserLanguage
  • Intl::UserLanguage::Linux
  • Intl::UserLanguage::Mac
  • Intl::UserLanguage::Windows

Documentation

The Camelia image is copyright 2009 by Larry Wall. "Raku" is trademark of the Yet Another Society. All rights reserved.