| 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 "chrome/common/extensions/extension_l10n_util.h" | 5 #include "chrome/common/extensions/extension_l10n_util.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 if (locale_name.find(".") == 0) | 204 if (locale_name.find(".") == 0) |
| 205 return true; | 205 return true; |
| 206 if (chrome_locales.find(locale_name) == chrome_locales.end()) { | 206 if (chrome_locales.find(locale_name) == chrome_locales.end()) { |
| 207 // Warn if there is an extension locale that's not in the Chrome list, | 207 // Warn if there is an extension locale that's not in the Chrome list, |
| 208 // but don't fail. | 208 // but don't fail. |
| 209 DLOG(WARNING) << base::StringPrintf("Supplied locale %s is not supported.", | 209 DLOG(WARNING) << base::StringPrintf("Supplied locale %s is not supported.", |
| 210 locale_name.c_str()); | 210 locale_name.c_str()); |
| 211 return true; | 211 return true; |
| 212 } | 212 } |
| 213 // Check if messages file is actually present (but don't check content). | 213 // Check if messages file is actually present (but don't check content). |
| 214 if (file_util::PathExists( | 214 if (base::PathExists( |
| 215 locale_folder.Append(extensions::kMessagesFilename))) { | 215 locale_folder.Append(extensions::kMessagesFilename))) { |
| 216 valid_locales->insert(locale_name); | 216 valid_locales->insert(locale_name); |
| 217 } else { | 217 } else { |
| 218 *error = base::StringPrintf("Catalog file is missing for locale %s.", | 218 *error = base::StringPrintf("Catalog file is missing for locale %s.", |
| 219 locale_name.c_str()); | 219 locale_name.c_str()); |
| 220 return false; | 220 return false; |
| 221 } | 221 } |
| 222 | 222 |
| 223 return true; | 223 return true; |
| 224 } | 224 } |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 ScopedLocaleForTest::ScopedLocaleForTest(const std::string& locale) | 367 ScopedLocaleForTest::ScopedLocaleForTest(const std::string& locale) |
| 368 : locale_(extension_l10n_util::CurrentLocaleOrDefault()) { | 368 : locale_(extension_l10n_util::CurrentLocaleOrDefault()) { |
| 369 extension_l10n_util::SetProcessLocale(locale); | 369 extension_l10n_util::SetProcessLocale(locale); |
| 370 } | 370 } |
| 371 | 371 |
| 372 ScopedLocaleForTest::~ScopedLocaleForTest() { | 372 ScopedLocaleForTest::~ScopedLocaleForTest() { |
| 373 extension_l10n_util::SetProcessLocale(locale_); | 373 extension_l10n_util::SetProcessLocale(locale_); |
| 374 } | 374 } |
| 375 | 375 |
| 376 } // namespace extension_l10n_util | 376 } // namespace extension_l10n_util |
| OLD | NEW |