summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/l10n_util.cc15
-rw-r--r--app/l10n_util_mac.mm7
2 files changed, 13 insertions, 9 deletions
diff --git a/app/l10n_util.cc b/app/l10n_util.cc
index 751a41c..1330263 100644
--- a/app/l10n_util.cc
+++ b/app/l10n_util.cc
@@ -220,15 +220,12 @@ namespace l10n_util {
// Represents the locale-specific text direction.
static TextDirection g_text_direction = UNKNOWN_DIRECTION;
+// On the Mac, we don't want to test preferences or ICU for the language,
+// we want to use whatever Cocoa is using when it loaded the main nib file.
+// It handles all the mapping and fallbacks for us, we just need to ask.
+// See l10n_util_mac for that implementation.
+#if !defined(OS_MACOSX)
std::string GetApplicationLocale(const std::wstring& pref_locale) {
-#if defined(OS_MACOSX)
- // On the mac, we don't want to test preferences or ICU for the language,
- // we want to use whatever Cocoa is using when it loaded the main nib file.
- // It handles all the mapping and fallbacks for us, we just need to ask
- // Cocoa.
- // TODO(pinkerton): break this out into a .mm and ask Cocoa.
- return "en";
-#else
FilePath locale_path;
PathService::Get(app::DIR_LOCALES, &locale_path);
std::string resolved_locale;
@@ -269,8 +266,8 @@ std::string GetApplicationLocale(const std::wstring& pref_locale) {
NOTREACHED();
return std::string();
-#endif
}
+#endif // !defined(OS_MACOSX)
string16 GetDisplayNameForLocale(const std::string& locale_code,
const std::string& display_locale,
diff --git a/app/l10n_util_mac.mm b/app/l10n_util_mac.mm
index a664eb3..fe09826 100644
--- a/app/l10n_util_mac.mm
+++ b/app/l10n_util_mac.mm
@@ -8,6 +8,13 @@
namespace l10n_util {
+std::string GetApplicationLocale(const std::wstring& pref_locale) {
+ // NOTE: The Win/Linux version of this calls out to CheckAndResolveLocale
+ // to do some remapping. Since Mac is using real locales that Cocoa has
+ // to be able to load, that shouldn't be needed.
+ return [[[NSLocale currentLocale] localeIdentifier] UTF8String];
+}
+
// Remove the Windows-style accelerator marker and change "..." into an
// ellipsis. Returns the result in an autoreleased NSString.
NSString* FixUpWindowsStyleLabel(const string16& label) {