Improving the retrieval of the user's locale on Apple systems.

The previous behavior used the entire local identifier string that includes optional settings such as variant and calendar format. This results in locales like en_US_POSIX@calendar=buddhist which results in the user's culture being the invariant culture.