| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/base/l10n/l10n_util.h" | 5 #include "ui/base/l10n/l10n_util.h" |
| 6 | 6 |
| 7 #if defined(TOOLKIT_USES_GTK) | 7 #if defined(USE_X11) |
| 8 #include <glib/gutils.h> | 8 #include <glib/gutils.h> |
| 9 #endif | 9 #endif |
| 10 | 10 |
| 11 #include <algorithm> | 11 #include <algorithm> |
| 12 #include <cstdlib> | 12 #include <cstdlib> |
| 13 #include <iterator> | 13 #include <iterator> |
| 14 | 14 |
| 15 #include "base/command_line.h" | 15 #include "base/command_line.h" |
| 16 #include "base/file_util.h" | 16 #include "base/file_util.h" |
| 17 #include "base/i18n/file_util_icu.h" | 17 #include "base/i18n/file_util_icu.h" |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 // If no override was set, defer to ICU | 397 // If no override was set, defer to ICU |
| 398 candidates.push_back(base::i18n::GetConfiguredLocale()); | 398 candidates.push_back(base::i18n::GetConfiguredLocale()); |
| 399 } | 399 } |
| 400 | 400 |
| 401 #elif defined(OS_CHROMEOS) | 401 #elif defined(OS_CHROMEOS) |
| 402 | 402 |
| 403 // On ChromeOS, use the application locale preference. | 403 // On ChromeOS, use the application locale preference. |
| 404 if (!pref_locale.empty()) | 404 if (!pref_locale.empty()) |
| 405 candidates.push_back(pref_locale); | 405 candidates.push_back(pref_locale); |
| 406 | 406 |
| 407 #elif defined(OS_POSIX) && defined(TOOLKIT_USES_GTK) | 407 #elif !defined(OS_MACOSX) |
| 408 | 408 |
| 409 // GLib implements correct environment variable parsing with | 409 // GLib implements correct environment variable parsing with |
| 410 // the precedence order: LANGUAGE, LC_ALL, LC_MESSAGES and LANG. | 410 // the precedence order: LANGUAGE, LC_ALL, LC_MESSAGES and LANG. |
| 411 // We used to use our custom parsing code along with ICU for this purpose. | 411 // We used to use our custom parsing code along with ICU for this purpose. |
| 412 // If we have a port that does not depend on GTK, we have to | 412 // If we have a port that does not depend on GTK, we have to |
| 413 // restore our custom code for that port. | 413 // restore our custom code for that port. |
| 414 const char* const* languages = g_get_language_names(); | 414 const char* const* languages = g_get_language_names(); |
| 415 DCHECK(languages); // A valid pointer is guaranteed. | 415 DCHECK(languages); // A valid pointer is guaranteed. |
| 416 DCHECK(*languages); // At least one entry, "C", is guaranteed. | 416 DCHECK(*languages); // At least one entry, "C", is guaranteed. |
| 417 | 417 |
| (...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 812 for (size_t i = 0; i < arraysize(kAcceptLanguageList); ++i) { | 812 for (size_t i = 0; i < arraysize(kAcceptLanguageList); ++i) { |
| 813 if (!IsLocaleNameTranslated(kAcceptLanguageList[i], display_locale)) | 813 if (!IsLocaleNameTranslated(kAcceptLanguageList[i], display_locale)) |
| 814 // TODO(jungshik) : Put them at the of the list with language codes | 814 // TODO(jungshik) : Put them at the of the list with language codes |
| 815 // enclosed by brackets instead of skipping. | 815 // enclosed by brackets instead of skipping. |
| 816 continue; | 816 continue; |
| 817 locale_codes->push_back(kAcceptLanguageList[i]); | 817 locale_codes->push_back(kAcceptLanguageList[i]); |
| 818 } | 818 } |
| 819 } | 819 } |
| 820 | 820 |
| 821 } // namespace l10n_util | 821 } // namespace l10n_util |
| OLD | NEW |