OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_BROWSER_EXTENSIONS_EXTENSION_L10N_UTIL_H_ | 7 #ifndef CHROME_COMMON_EXTENSIONS_EXTENSION_L10N_UTIL_H_ |
8 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_L10N_UTIL_H_ | 8 #define CHROME_COMMON_EXTENSIONS_EXTENSION_L10N_UTIL_H_ |
9 | 9 |
10 #include <set> | 10 #include <set> |
11 #include <string> | 11 #include <string> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 class DictionaryValue; | 14 class DictionaryValue; |
15 class Extension; | 15 class Extension; |
16 class ExtensionMessageBundle; | 16 class ExtensionMessageBundle; |
17 class FilePath; | 17 class FilePath; |
18 | 18 |
19 namespace extension_l10n_util { | 19 namespace extension_l10n_util { |
20 | 20 |
| 21 // Set the locale for this process to a fixed value, rather than using the |
| 22 // normal file-based lookup mechanisms. This is used to set the locale inside |
| 23 // the sandboxed utility process, where file reading is not allowed. |
| 24 void SetProcessLocale(const std::string& locale); |
| 25 |
21 // Returns default locale in form "en-US" or "sr" or empty string if | 26 // Returns default locale in form "en-US" or "sr" or empty string if |
22 // "default_locale" section was not defined in the manifest.json file. | 27 // "default_locale" section was not defined in the manifest.json file. |
23 std::string GetDefaultLocaleFromManifest(const DictionaryValue& manifest, | 28 std::string GetDefaultLocaleFromManifest(const DictionaryValue& manifest, |
24 std::string* error); | 29 std::string* error); |
25 | 30 |
26 // Adds locale_name to the extension if it's in chrome_locales, and | 31 // Adds locale_name to the extension if it's in chrome_locales, and |
27 // if messages file is present (we don't check content of messages file here). | 32 // if messages file is present (we don't check content of messages file here). |
28 // Returns false if locale_name was not found in chrome_locales, and sets | 33 // Returns false if locale_name was not found in chrome_locales, and sets |
29 // error with locale_name. | 34 // error with locale_name. |
30 // If file name starts with . return true (helps testing extensions under svn). | 35 // If file name starts with . return true (helps testing extensions under svn). |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 std::string* error); | 72 std::string* error); |
68 | 73 |
69 // Returns relative l10n paths to the resource. | 74 // Returns relative l10n paths to the resource. |
70 // Returned vector starts with more specific locale path, and ends with the | 75 // Returned vector starts with more specific locale path, and ends with the |
71 // least specific one. | 76 // least specific one. |
72 void GetL10nRelativePaths(const FilePath& relative_resource_path, | 77 void GetL10nRelativePaths(const FilePath& relative_resource_path, |
73 std::vector<FilePath>* l10n_paths); | 78 std::vector<FilePath>* l10n_paths); |
74 | 79 |
75 } // namespace extension_l10n_util | 80 } // namespace extension_l10n_util |
76 | 81 |
77 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_L10N_UTIL_H_ | 82 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_L10N_UTIL_H_ |
OLD | NEW |