Chromium Code Reviews| Index: chrome/common/extensions/extension_l10n_util.cc |
| diff --git a/chrome/browser/extensions/extension_l10n_util.cc b/chrome/common/extensions/extension_l10n_util.cc |
| similarity index 94% |
| rename from chrome/browser/extensions/extension_l10n_util.cc |
| rename to chrome/common/extensions/extension_l10n_util.cc |
| index 1ac93ffdbac74afcc08d8e386bfd1bebbd62dbaa..bd8431d76fd44f4265d394052799da8740d6e732 100644 |
| --- a/chrome/browser/extensions/extension_l10n_util.cc |
| +++ b/chrome/common/extensions/extension_l10n_util.cc |
| @@ -2,7 +2,7 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| -#include "chrome/browser/extensions/extension_l10n_util.h" |
| +#include "chrome/common/extensions/extension_l10n_util.h" |
| #include <set> |
| #include <string> |
| @@ -21,8 +21,17 @@ |
| namespace errors = extension_manifest_errors; |
| namespace keys = extension_manifest_keys; |
| +static std::string* GetProcessLocale() { |
| + static std::string locale; |
| + return &locale; |
| +} |
| + |
| namespace extension_l10n_util { |
| +void SetProcessLocale(const std::string& locale) { |
| + *(GetProcessLocale()) = locale; |
| +} |
| + |
| std::string GetDefaultLocaleFromManifest(const DictionaryValue& manifest, |
| std::string* error) { |
| std::string default_locale; |
| @@ -187,10 +196,12 @@ void GetL10nRelativePaths(const FilePath& relative_resource_path, |
| std::vector<FilePath>* l10n_paths) { |
| DCHECK(NULL != l10n_paths); |
| + std::string* current_locale = GetProcessLocale(); |
| + if (current_locale->empty()) |
| + *current_locale = l10n_util::GetApplicationLocale(L""); |
|
Nebojša Ćirić
2009/10/27 22:04:35
No big deal, but you could use
SetProcessLocale(l
|
| + |
| std::vector<std::string> locales; |
| - static const std::string current_locale = |
| - l10n_util::GetApplicationLocale(L""); |
| - GetParentLocales(current_locale, &locales); |
| + GetParentLocales(*current_locale, &locales); |
| FilePath locale_relative_path; |
| for (size_t i = 0; i < locales.size(); ++i) { |