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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 std::set<std::string>* valid_locales, | 61 std::set<std::string>* valid_locales, |
62 std::string* error); | 62 std::string* error); |
63 | 63 |
64 // Returns normalized current locale, or default locale - en_US. | 64 // Returns normalized current locale, or default locale - en_US. |
65 std::string CurrentLocaleOrDefault(); | 65 std::string CurrentLocaleOrDefault(); |
66 | 66 |
67 // Extends list of Chrome locales to them and their parents, so we can do | 67 // Extends list of Chrome locales to them and their parents, so we can do |
68 // proper fallback. | 68 // proper fallback. |
69 void GetAllLocales(std::set<std::string>* all_locales); | 69 void GetAllLocales(std::set<std::string>* all_locales); |
70 | 70 |
71 // Provides a vector of all fallback locales for message localization. | |
72 // The vector is ordered by priority of locale - |application_locale|, | |
73 // first_parent, ..., |default_locale|. | |
74 void GetAllFallbackLocales(const std::string& application_locale, | |
75 const std::string& default_locale, | |
76 std::vector<std::string>* all_fallback_locales); | |
77 | |
78 // Adds valid locales to the extension. | 71 // Adds valid locales to the extension. |
79 // 1. Do nothing if _locales directory is missing (not an error). | 72 // 1. Do nothing if _locales directory is missing (not an error). |
80 // 2. Get list of Chrome locales. | 73 // 2. Get list of Chrome locales. |
81 // 3. Enumerate all subdirectories of _locales directory. | 74 // 3. Enumerate all subdirectories of _locales directory. |
82 // 4. Intersect both lists, and add intersection to the extension. | 75 // 4. Intersect both lists, and add intersection to the extension. |
83 // Returns false if any of supplied locales don't match chrome list of locales. | 76 // Returns false if any of supplied locales don't match chrome list of locales. |
84 // Fills out error with offending locale name. | 77 // Fills out error with offending locale name. |
85 bool GetValidLocales(const FilePath& locale_path, | 78 bool GetValidLocales(const FilePath& locale_path, |
86 std::set<std::string>* locales, | 79 std::set<std::string>* locales, |
87 std::string* error); | 80 std::string* error); |
(...skipping 15 matching lines...) Expand all Loading... |
103 // |locales_path| is extension_id/_locales | 96 // |locales_path| is extension_id/_locales |
104 // |locale_path| is extension_id/_locales/xx | 97 // |locale_path| is extension_id/_locales/xx |
105 // |all_locales| is a set of all valid Chrome locales. | 98 // |all_locales| is a set of all valid Chrome locales. |
106 bool ShouldSkipValidation(const FilePath& locales_path, | 99 bool ShouldSkipValidation(const FilePath& locales_path, |
107 const FilePath& locale_path, | 100 const FilePath& locale_path, |
108 const std::set<std::string>& all_locales); | 101 const std::set<std::string>& all_locales); |
109 | 102 |
110 } // namespace extension_l10n_util | 103 } // namespace extension_l10n_util |
111 | 104 |
112 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_L10N_UTIL_H_ | 105 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_L10N_UTIL_H_ |
OLD | NEW |