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_BROWSER_EXTENSIONS_EXTENSION_L10N_UTIL_H_ |
8 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_L10N_UTIL_H_ | 8 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_L10N_UTIL_H_ |
9 | 9 |
10 #include <set> | 10 #include <set> |
11 #include <string> | 11 #include <string> |
12 | 12 |
13 class DictionaryValue; | 13 class DictionaryValue; |
14 class Extension; | 14 class Extension; |
15 class FilePath; | 15 class FilePath; |
16 | 16 |
17 namespace extension_l10n_util { | 17 namespace extension_l10n_util { |
18 | 18 |
19 // Returns true if default_locale was set to valid locale | 19 // Returns true if default_locale was set to valid locale |
20 // (supported by the extension). | 20 // (supported by the extension). |
21 bool ValidateDefaultLocale(const Extension* extension); | 21 bool ValidateDefaultLocale(const Extension* extension); |
22 | 22 |
23 // Adds locale_name to the extension if it's in chrome_locales, and | 23 // Adds locale_name to the extension if it's in chrome_locales, and |
24 // if messages file is present (we don't check content of messages file here). | 24 // if messages file is present (we don't check content of messages file here). |
25 // Returns false if locale_name was not found in chrome_locales, and sets | 25 // Returns false if locale_name was not found in chrome_locales, and sets |
26 // error with locale_name. | 26 // error with locale_name. |
| 27 // If file name starts with . return true (helps testing extensions under svn). |
27 bool AddLocale(const std::set<std::string>& chrome_locales, | 28 bool AddLocale(const std::set<std::string>& chrome_locales, |
28 const FilePath& locale_folder, | 29 const FilePath& locale_folder, |
29 Extension* extension, | 30 Extension* extension, |
30 std::string* locale_name, | 31 std::string* locale_name, |
31 std::string* error); | 32 std::string* error); |
32 | 33 |
33 // Adds valid locales to the extension. | 34 // Adds valid locales to the extension. |
34 // 1. Do nothing if _locales directory is missing (not an error). | 35 // 1. Do nothing if _locales directory is missing (not an error). |
35 // 2. Get list of Chrome locales. | 36 // 2. Get list of Chrome locales. |
36 // 3. Enumerate all subdirectories of _locales directory. | 37 // 3. Enumerate all subdirectories of _locales directory. |
37 // 4. Intersect both lists, and add intersection to the extension. | 38 // 4. Intersect both lists, and add intersection to the extension. |
38 // Returns false if any of supplied locales don't match chrome list of locales. | 39 // Returns false if any of supplied locales don't match chrome list of locales. |
39 // Fills out error with offending locale name. | 40 // Fills out error with offending locale name. |
40 bool AddValidLocales(const FilePath& locale_path, | 41 bool AddValidLocales(const FilePath& locale_path, |
41 Extension* extension, | 42 Extension* extension, |
42 std::string* error); | 43 std::string* error); |
43 | 44 |
44 } // namespace extension_l10n_util | 45 } // namespace extension_l10n_util |
45 | 46 |
46 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_L10N_UTIL_H_ | 47 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_L10N_UTIL_H_ |
OLD | NEW |