Add a feature to Safari (desktop and Mobile) to query configured locale

Originator:aschlag
Number:rdar://13792294 Date Originated:02-May-2013 11:39 AM
Status:Open Resolved:
Product:Safari Product Version:all
Classification:Feature request Reproducible:Yes
 
Summary:

Safari (both Mobile Safari on iOS and Safari on OS X) incorrectly report the configured system locale. For example, 
if a user has their OS region set to "Canada" and their language to "English" then Safari will report the locale (both via the "Accept-Language" HTTP header and navigator.language in JavaScript) as "en-us". If the region is then changed to United Kingdom the locale is still reported as "en-us". If the language is set to French and the region is set to anywhere the locale is reported as "fr-fr". This request is to either modify behavior to report the correct IETF language tag in "Accept-Language" header and in navigator.language or to add an additional API to query this information.

Steps to Reproduce:

_OS X:_

1. Open System Preferences
2. Select "Language & Text"
3. On the "Language" tab, select "English"
4. On the "Region" tab, select "Canada" as the region.
5. On Safari, open the attached localetest.html

_iOS_

1. Open Settings
2. Navigate to "General" > "International"
3. Make sure "English" is selected as the primary language
4. Select "Region Format"
5. Select "Canada"
6. Open Safari and load the attached localetest.html from a web server

Expected Results:

Desired behavior is for it to report as "en-CA", the correct IETF language tag based on the user's configured language and region preferences.

Actual Results:

The page reports "en-us", even when Canada is selected as the region.

Regression:

I have not tested beyond the versions given, but I suspect this behavior is consistent across all versions of Safari for at least the past year or so.

Notes:

This request comes from work I am doing for both a mobile web site and app that requires some smarts in determining what kind of customer is accessing functionality. We must be able to determine if a customer is from the United States or Canada and support both English and French. Also, there are some minor differences in language we need to support based on if the customer is a US or Canadian customer. We know this information once a customer is logged in, but we want to be able to make a good guess on their preferences when they first use our application. We can get this information in our native code but we can't get this information in Safari and have to create a dumber experience there. Geolocation doesn't help as we have customers who frequently travel and this data doesn't give us what we're looking for, which is their desired language and region settings.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!