| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cstdlib> | 8 #include <cstdlib> |
| 9 #include <iterator> | 9 #include <iterator> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 // is not available. A more robust/elegant way to check is to add a special | 218 // is not available. A more robust/elegant way to check is to add a special |
| 219 // field (say, 'isPartial' to our version of ICU locale files) and | 219 // field (say, 'isPartial' to our version of ICU locale files) and |
| 220 // check its value, but this hack seems to work well. | 220 // check its value, but this hack seems to work well. |
| 221 return !l10n_util::IsLocaleNameTranslated("en", locale_name); | 221 return !l10n_util::IsLocaleNameTranslated("en", locale_name); |
| 222 } | 222 } |
| 223 | 223 |
| 224 #if !defined(OS_MACOSX) | 224 #if !defined(OS_MACOSX) |
| 225 bool IsLocaleAvailable(const std::string& locale) { | 225 bool IsLocaleAvailable(const std::string& locale) { |
| 226 // If locale has any illegal characters in it, we don't want to try to | 226 // If locale has any illegal characters in it, we don't want to try to |
| 227 // load it because it may be pointing outside the locale data file directory. | 227 // load it because it may be pointing outside the locale data file directory. |
| 228 if (!file_util::IsFilenameLegal(base::ASCIIToUTF16(locale))) | 228 if (!base::i18n::IsFilenameLegal(base::ASCIIToUTF16(locale))) |
| 229 return false; | 229 return false; |
| 230 | 230 |
| 231 // IsLocalePartiallyPopulated() can be called here for an early return w/o | 231 // IsLocalePartiallyPopulated() can be called here for an early return w/o |
| 232 // checking the resource availability below. It'd help when Chrome is run | 232 // checking the resource availability below. It'd help when Chrome is run |
| 233 // under a system locale Chrome is not localized to (e.g.Farsi on Linux), | 233 // under a system locale Chrome is not localized to (e.g.Farsi on Linux), |
| 234 // but it'd slow down the start up time a little bit for locales Chrome is | 234 // but it'd slow down the start up time a little bit for locales Chrome is |
| 235 // localized to. So, we don't call it here. | 235 // localized to. So, we don't call it here. |
| 236 if (!l10n_util::IsLocaleSupportedByOS(locale)) | 236 if (!l10n_util::IsLocaleSupportedByOS(locale)) |
| 237 return false; | 237 return false; |
| 238 | 238 |
| (...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 871 } | 871 } |
| 872 | 872 |
| 873 int GetLocalizedContentsWidthInPixels(int pixel_resource_id) { | 873 int GetLocalizedContentsWidthInPixels(int pixel_resource_id) { |
| 874 int width = 0; | 874 int width = 0; |
| 875 base::StringToInt(l10n_util::GetStringUTF8(pixel_resource_id), &width); | 875 base::StringToInt(l10n_util::GetStringUTF8(pixel_resource_id), &width); |
| 876 DCHECK_GT(width, 0); | 876 DCHECK_GT(width, 0); |
| 877 return width; | 877 return width; |
| 878 } | 878 } |
| 879 | 879 |
| 880 } // namespace l10n_util | 880 } // namespace l10n_util |
| OLD | NEW |