| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "app/l10n_util.h" | 5 #include "app/l10n_util.h" |
| 6 | 6 |
| 7 #if defined(TOOLKIT_USES_GTK) | 7 #if defined(TOOLKIT_USES_GTK) |
| 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 "app/app_paths.h" | |
| 16 #include "app/l10n_util_collator.h" | 15 #include "app/l10n_util_collator.h" |
| 17 #include "app/resource_bundle.h" | |
| 18 #include "base/command_line.h" | 16 #include "base/command_line.h" |
| 19 #include "base/file_util.h" | 17 #include "base/file_util.h" |
| 20 #include "base/i18n/file_util_icu.h" | 18 #include "base/i18n/file_util_icu.h" |
| 21 #include "base/i18n/rtl.h" | 19 #include "base/i18n/rtl.h" |
| 22 #include "base/path_service.h" | 20 #include "base/path_service.h" |
| 23 #include "base/scoped_ptr.h" | 21 #include "base/scoped_ptr.h" |
| 24 #include "base/string16.h" | 22 #include "base/string16.h" |
| 25 #include "base/string_number_conversions.h" | 23 #include "base/string_number_conversions.h" |
| 26 #include "base/string_split.h" | 24 #include "base/string_split.h" |
| 27 #include "base/sys_string_conversions.h" | 25 #include "base/sys_string_conversions.h" |
| 28 #include "base/utf_string_conversions.h" | 26 #include "base/utf_string_conversions.h" |
| 29 #include "build/build_config.h" | 27 #include "build/build_config.h" |
| 30 #include "gfx/canvas.h" | 28 #include "gfx/canvas.h" |
| 29 #include "ui/base/resource/resource_bundle.h" |
| 30 #include "ui/base/ui_base_paths.h" |
| 31 #include "unicode/rbbi.h" | 31 #include "unicode/rbbi.h" |
| 32 #include "unicode/uloc.h" | 32 #include "unicode/uloc.h" |
| 33 | 33 |
| 34 #if defined(OS_MACOSX) | 34 #if defined(OS_MACOSX) |
| 35 #include "app/l10n_util_mac.h" | 35 #include "app/l10n_util_mac.h" |
| 36 #elif defined(OS_WIN) | 36 #elif defined(OS_WIN) |
| 37 #include "app/l10n_util_win.h" | 37 #include "app/l10n_util_win.h" |
| 38 #endif | 38 #endif |
| 39 | 39 |
| 40 namespace { | 40 namespace { |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 // with CheckAndResolveLocal to make ICU APIs work in that locale. | 355 // with CheckAndResolveLocal to make ICU APIs work in that locale. |
| 356 // Mac doesn't use a locale directory tree of resources (it uses Mac style | 356 // Mac doesn't use a locale directory tree of resources (it uses Mac style |
| 357 // resources), so mirror the Windows/Linux behavior of calling | 357 // resources), so mirror the Windows/Linux behavior of calling |
| 358 // SetICUDefaultLocale. | 358 // SetICUDefaultLocale. |
| 359 base::i18n::SetICUDefaultLocale(app_locale); | 359 base::i18n::SetICUDefaultLocale(app_locale); |
| 360 return app_locale; | 360 return app_locale; |
| 361 | 361 |
| 362 #else | 362 #else |
| 363 | 363 |
| 364 FilePath locale_path; | 364 FilePath locale_path; |
| 365 PathService::Get(app::DIR_LOCALES, &locale_path); | 365 PathService::Get(ui::DIR_LOCALES, &locale_path); |
| 366 std::string resolved_locale; | 366 std::string resolved_locale; |
| 367 std::vector<std::string> candidates; | 367 std::vector<std::string> candidates; |
| 368 | 368 |
| 369 // We only use --lang and the app pref on Windows. On Linux, we only | 369 // We only use --lang and the app pref on Windows. On Linux, we only |
| 370 // look at the LC_*/LANG environment variables. We do, however, pass --lang | 370 // look at the LC_*/LANG environment variables. We do, however, pass --lang |
| 371 // to renderer and plugin processes so they know what language the parent | 371 // to renderer and plugin processes so they know what language the parent |
| 372 // process decided to use. | 372 // process decided to use. |
| 373 | 373 |
| 374 #if defined(OS_WIN) | 374 #if defined(OS_WIN) |
| 375 | 375 |
| (...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 867 for (size_t i = 0; i < arraysize(kAcceptLanguageList); ++i) { | 867 for (size_t i = 0; i < arraysize(kAcceptLanguageList); ++i) { |
| 868 if (!IsLocaleNameTranslated(kAcceptLanguageList[i], display_locale)) | 868 if (!IsLocaleNameTranslated(kAcceptLanguageList[i], display_locale)) |
| 869 // TODO(jungshik) : Put them at the of the list with language codes | 869 // TODO(jungshik) : Put them at the of the list with language codes |
| 870 // enclosed by brackets instead of skipping. | 870 // enclosed by brackets instead of skipping. |
| 871 continue; | 871 continue; |
| 872 locale_codes->push_back(kAcceptLanguageList[i]); | 872 locale_codes->push_back(kAcceptLanguageList[i]); |
| 873 } | 873 } |
| 874 } | 874 } |
| 875 | 875 |
| 876 } // namespace l10n_util | 876 } // namespace l10n_util |
| OLD | NEW |