Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(72)

Side by Side Diff: chrome/browser/extensions/extension_l10n_util.h

Issue 293037: Implementing better fallback algorithm.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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>
(...skipping 11 matching lines...) Expand all
22 std::string GetDefaultLocaleFromManifest(const DictionaryValue& manifest, 22 std::string GetDefaultLocaleFromManifest(const DictionaryValue& manifest,
23 std::string* error); 23 std::string* error);
24 24
25 // Adds locale_name to the extension if it's in chrome_locales, and 25 // Adds locale_name to the extension if it's in chrome_locales, and
26 // if messages file is present (we don't check content of messages file here). 26 // if messages file is present (we don't check content of messages file here).
27 // Returns false if locale_name was not found in chrome_locales, and sets 27 // Returns false if locale_name was not found in chrome_locales, and sets
28 // error with locale_name. 28 // error with locale_name.
29 // If file name starts with . return true (helps testing extensions under svn). 29 // If file name starts with . return true (helps testing extensions under svn).
30 bool AddLocale(const std::set<std::string>& chrome_locales, 30 bool AddLocale(const std::set<std::string>& chrome_locales,
31 const FilePath& locale_folder, 31 const FilePath& locale_folder,
32 const std::string& locale_name,
32 std::set<std::string>* valid_locales, 33 std::set<std::string>* valid_locales,
33 std::string* locale_name,
34 std::string* error); 34 std::string* error);
35 35
36 // Adds valid locales to the extension. 36 // Adds valid locales to the extension.
37 // 1. Do nothing if _locales directory is missing (not an error). 37 // 1. Do nothing if _locales directory is missing (not an error).
38 // 2. Get list of Chrome locales. 38 // 2. Get list of Chrome locales.
39 // 3. Enumerate all subdirectories of _locales directory. 39 // 3. Enumerate all subdirectories of _locales directory.
40 // 4. Intersect both lists, and add intersection to the extension. 40 // 4. Intersect both lists, and add intersection to the extension.
41 // Returns false if any of supplied locales don't match chrome list of locales. 41 // Returns false if any of supplied locales don't match chrome list of locales.
42 // Fills out error with offending locale name. 42 // Fills out error with offending locale name.
43 bool GetValidLocales(const FilePath& locale_path, 43 bool GetValidLocales(const FilePath& locale_path,
44 std::set<std::string>* locales, 44 std::set<std::string>* locales,
45 std::string* error); 45 std::string* error);
46 46
47 // Loads messages file for default locale, and application locale (application 47 // Loads messages file for default locale, and application locales (application
48 // locale doesn't have to exist). 48 // locales doesn't have to exist). Application locale is current locale and its
49 // It creates simplified in-memory representation of name-value pairs, where 49 // parents.
50 // value part is actual message with placeholders resolved.
51 // Returns message bundle if it can load default locale messages file, and all 50 // Returns message bundle if it can load default locale messages file, and all
52 // messages are valid, else returns NULL and sets error. 51 // messages are valid, else returns NULL and sets error.
53 ExtensionMessageBundle* LoadMessageCatalogs(const FilePath& locale_path, 52 ExtensionMessageBundle* LoadMessageCatalogs(
54 const std::string& default_locale, 53 const FilePath& locale_path,
55 const std::string& app_locale, 54 const std::string& default_locale,
56 std::string* error); 55 const std::string& app_locale,
56 const std::set<std::string>& valid_locales,
57 std::string* error);
57 58
58 // Returns relative l10n path to the resource. 59 // Returns relative l10n path to the resource.
59 FilePath GetL10nRelativePath(const FilePath& relative_resource_path); 60 FilePath GetL10nRelativePath(const FilePath& relative_resource_path);
60 61
61 } // namespace extension_l10n_util 62 } // namespace extension_l10n_util
62 63
63 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_L10N_UTIL_H_ 64 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_L10N_UTIL_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_file_util.cc ('k') | chrome/browser/extensions/extension_l10n_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698