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

Unified Diff: chrome/browser/extensions/extension_l10n_util.h

Issue 202063: Implemented the rest of loading/parsing logic for extension i18n:... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/extension_l10n_util.h
===================================================================
--- chrome/browser/extensions/extension_l10n_util.h (revision 25781)
+++ chrome/browser/extensions/extension_l10n_util.h (working copy)
@@ -12,13 +12,15 @@
class DictionaryValue;
class Extension;
+class ExtensionMessageBundle;
class FilePath;
namespace extension_l10n_util {
-// Returns true if default_locale was set to valid locale
-// (supported by the extension).
-bool ValidateDefaultLocale(const Extension* extension);
+// Returns default locale in form "en-US" or "sr" or empty string if
+// "default_locale" section was not defined in the manifest.json file.
+std::string GetDefaultLocaleFromManifest(const DictionaryValue& manifest,
+ std::string* error);
// Adds locale_name to the extension if it's in chrome_locales, and
// if messages file is present (we don't check content of messages file here).
@@ -27,7 +29,7 @@
// If file name starts with . return true (helps testing extensions under svn).
bool AddLocale(const std::set<std::string>& chrome_locales,
const FilePath& locale_folder,
- Extension* extension,
+ std::set<std::string>* valid_locales,
std::string* locale_name,
std::string* error);
@@ -38,10 +40,21 @@
// 4. Intersect both lists, and add intersection to the extension.
// Returns false if any of supplied locales don't match chrome list of locales.
// Fills out error with offending locale name.
-bool AddValidLocales(const FilePath& locale_path,
- Extension* extension,
+bool GetValidLocales(const FilePath& locale_path,
+ std::set<std::string>* locales,
std::string* error);
+// Loads messages file for default locale, and application locale (application
+// locale doesn't have to exist).
+// It creates simplified in-memory representation of name-value pairs, where
+// value part is actual message with placeholders resolved.
+// Returns message bundle if it can load default locale messages file, and all
+// messages are valid, else returns NULL and sets error.
+ExtensionMessageBundle* LoadMessageCatalogs(const FilePath& locale_path,
+ const std::string& default_locale,
+ const std::string& app_locale,
+ std::string* error);
+
} // namespace extension_l10n_util
#endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_L10N_UTIL_H_
« no previous file with comments | « chrome/browser/extensions/extension_file_util_unittest.cc ('k') | chrome/browser/extensions/extension_l10n_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698