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(USE_X11) | 7 #if defined(TOOLKIT_GTK) |
8 #include <glib/gutils.h> | 8 #include <glib.h> |
9 #endif | 9 #endif |
Evan Martin
2012/02/08 22:04:23
I think officially conditional headers belong down
| |
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" |
18 #include "base/i18n/rtl.h" | 18 #include "base/i18n/rtl.h" |
19 #include "base/memory/scoped_ptr.h" | 19 #include "base/memory/scoped_ptr.h" |
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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_ANDROID) | 407 #elif defined(OS_ANDROID) |
408 | 408 |
409 // TODO(jcivelli): use the application locale preference for now. | 409 // TODO(jcivelli): use the application locale preference for now. |
410 if (!pref_locale.empty()) | 410 if (!pref_locale.empty()) |
411 candidates.push_back(pref_locale); | 411 candidates.push_back(pref_locale); |
412 | 412 |
413 #elif !defined(OS_MACOSX) | 413 #elif defined(TOOLKIT_GTK) |
414 | 414 |
415 // GLib implements correct environment variable parsing with | 415 // GLib implements correct environment variable parsing with |
416 // the precedence order: LANGUAGE, LC_ALL, LC_MESSAGES and LANG. | 416 // the precedence order: LANGUAGE, LC_ALL, LC_MESSAGES and LANG. |
417 // We used to use our custom parsing code along with ICU for this purpose. | 417 // We used to use our custom parsing code along with ICU for this purpose. |
418 // If we have a port that does not depend on GTK, we have to | 418 // If we have a port that does not depend on GTK, we have to |
419 // restore our custom code for that port. | 419 // restore our custom code for that port. |
420 const char* const* languages = g_get_language_names(); | 420 const char* const* languages = g_get_language_names(); |
421 DCHECK(languages); // A valid pointer is guaranteed. | 421 DCHECK(languages); // A valid pointer is guaranteed. |
422 DCHECK(*languages); // At least one entry, "C", is guaranteed. | 422 DCHECK(*languages); // At least one entry, "C", is guaranteed. |
423 | 423 |
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
818 for (size_t i = 0; i < arraysize(kAcceptLanguageList); ++i) { | 818 for (size_t i = 0; i < arraysize(kAcceptLanguageList); ++i) { |
819 if (!IsLocaleNameTranslated(kAcceptLanguageList[i], display_locale)) | 819 if (!IsLocaleNameTranslated(kAcceptLanguageList[i], display_locale)) |
820 // TODO(jungshik) : Put them at the of the list with language codes | 820 // TODO(jungshik) : Put them at the of the list with language codes |
821 // enclosed by brackets instead of skipping. | 821 // enclosed by brackets instead of skipping. |
822 continue; | 822 continue; |
823 locale_codes->push_back(kAcceptLanguageList[i]); | 823 locale_codes->push_back(kAcceptLanguageList[i]); |
824 } | 824 } |
825 } | 825 } |
826 | 826 |
827 } // namespace l10n_util | 827 } // namespace l10n_util |
OLD | NEW |