| 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 // This file declares extension specific l10n utils. | 5 // This file declares extension specific l10n utils. |
| 6 | 6 |
| 7 #ifndef CHROME_COMMON_EXTENSIONS_EXTENSION_L10N_UTIL_H_ | 7 #ifndef CHROME_COMMON_EXTENSIONS_EXTENSION_L10N_UTIL_H_ |
| 8 #define CHROME_COMMON_EXTENSIONS_EXTENSION_L10N_UTIL_H_ | 8 #define CHROME_COMMON_EXTENSIONS_EXTENSION_L10N_UTIL_H_ |
| 9 | 9 |
| 10 #include <set> | 10 #include <set> |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 // the sandboxed utility process, where file reading is not allowed. | 28 // the sandboxed utility process, where file reading is not allowed. |
| 29 void SetProcessLocale(const std::string& locale); | 29 void SetProcessLocale(const std::string& locale); |
| 30 | 30 |
| 31 // Returns default locale in form "en-US" or "sr" or empty string if | 31 // Returns default locale in form "en-US" or "sr" or empty string if |
| 32 // "default_locale" section was not defined in the manifest.json file. | 32 // "default_locale" section was not defined in the manifest.json file. |
| 33 std::string GetDefaultLocaleFromManifest(const base::DictionaryValue& manifest, | 33 std::string GetDefaultLocaleFromManifest(const base::DictionaryValue& manifest, |
| 34 std::string* error); | 34 std::string* error); |
| 35 | 35 |
| 36 // Returns true iff the extension was localized, and the current locale | 36 // Returns true iff the extension was localized, and the current locale |
| 37 // doesn't match the locale written into info.extension_manifest. | 37 // doesn't match the locale written into info.extension_manifest. |
| 38 bool ShouldRelocalizeManifest(const extensions::ExtensionInfo& info); | 38 bool ShouldRelocalizeManifest(const base::DictionaryValue* manifest); |
| 39 | 39 |
| 40 // Localize extension name, description, browser_action and other fields | 40 // Localize extension name, description, browser_action and other fields |
| 41 // in the manifest. | 41 // in the manifest. |
| 42 bool LocalizeManifest(const extensions::MessageBundle& messages, | 42 bool LocalizeManifest(const extensions::MessageBundle& messages, |
| 43 base::DictionaryValue* manifest, | 43 base::DictionaryValue* manifest, |
| 44 std::string* error); | 44 std::string* error); |
| 45 | 45 |
| 46 // Load message catalogs, localize manifest and attach message bundle to the | 46 // Load message catalogs, localize manifest and attach message bundle to the |
| 47 // extension. | 47 // extension. |
| 48 bool LocalizeExtension(const base::FilePath& extension_path, | 48 bool LocalizeExtension(const base::FilePath& extension_path, |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 ~ScopedLocaleForTest(); | 120 ~ScopedLocaleForTest(); |
| 121 | 121 |
| 122 private: | 122 private: |
| 123 std::string locale_; // The current locale at ctor time. | 123 std::string locale_; // The current locale at ctor time. |
| 124 }; | 124 }; |
| 125 | 125 |
| 126 | 126 |
| 127 } // namespace extension_l10n_util | 127 } // namespace extension_l10n_util |
| 128 | 128 |
| 129 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_L10N_UTIL_H_ | 129 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_L10N_UTIL_H_ |
| OLD | NEW |