[CalendarServer-changes] [9814] CalendarServer/trunk/twistedcaldav/localization.py
source_changes at macosforge.org
source_changes at macosforge.org
Mon Sep 17 14:39:58 PDT 2012
Revision: 9814
http://trac.calendarserver.org//changeset/9814
Author: sagen at apple.com
Date: 2012-09-17 14:13:15 -0700 (Mon, 17 Sep 2012)
Log Message:
-----------
Use NSLocale instead of NSUserDefaults because the values returned by the latter don't always match our on-disk localization files
Modified Paths:
--------------
CalendarServer/trunk/twistedcaldav/localization.py
Modified: CalendarServer/trunk/twistedcaldav/localization.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/localization.py 2012-09-17 19:55:41 UTC (rev 9813)
+++ CalendarServer/trunk/twistedcaldav/localization.py 2012-09-17 21:13:15 UTC (rev 9814)
@@ -27,7 +27,7 @@
try:
from Foundation import (
- NSPropertyListImmutable, NSPropertyListSerialization, NSData, NSUserDefaults
+ NSPropertyListImmutable, NSPropertyListSerialization, NSData, NSLocale
)
foundationImported = True
except ImportError:
@@ -479,7 +479,7 @@
def getLanguage(config):
"""
If the language has been specified explicitly in the config, return it. Otherwise
- look it up via NSUserDefaults on OS X. Failing that, return "en"
+ look it up via NSLocale on OS X. Failing that, return "en"
@param config: The configuration object to examine
@type config: ConfigDict
@@ -491,7 +491,7 @@
return config.Localization.Language
try:
- language = NSUserDefaults.standardUserDefaults().objectForKey_(u"AppleLanguages")[0]
+ language = NSLocale.preferredLanguages()[0]
except:
language = "en"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20120917/17beeea7/attachment.html>
More information about the calendarserver-changes
mailing list