Index: chrome/browser/extensions/extension_file_util.cc |
=================================================================== |
--- chrome/browser/extensions/extension_file_util.cc (revision 24127) |
+++ chrome/browser/extensions/extension_file_util.cc (working copy) |
@@ -4,6 +4,7 @@ |
#include "chrome/browser/extensions/extension_file_util.h" |
+#include "app/l10n_util.h" |
#include "base/file_util.h" |
#include "base/logging.h" |
#include "base/scoped_temp_dir.h" |
@@ -94,7 +95,8 @@ |
return true; |
} |
-Extension* LoadExtension(const FilePath& extension_path, bool require_key, |
+Extension* LoadExtension(const FilePath& extension_path, |
+ bool require_key, |
std::string* error) { |
FilePath manifest_path = |
extension_path.AppendASCII(Extension::kManifestFilename); |
@@ -232,6 +234,34 @@ |
*error = extension_manifest_errors::kLocalesNoDefaultLocaleSpecified; |
return false; |
} |
+ |
+ // We can't call g_browser_process->GetApplicationLocale() since we are not |
+ // on the main thread. |
+ static const std::string& app_locale = l10n_util::GetApplicationLocale(L""); |
Aaron Boodman
2009/08/31 21:42:55
This seems to check the prefs. Is it OK to do that
|
+ extension->set_application_locale(app_locale); |
+ if (!extension_l10n_util::LoadMessageCatalogs(locale_path, |
+ extension, |
+ error)) { |
+ return NULL; |
+ } |
+ // Replace possible messages in the manifest name and description sections. |
+ std::string value = extension->name(); |
Aaron Boodman
2009/08/31 21:42:55
Instead of reading and then re-writing the name, w
|
+ if (extension->message_handler()->ReplaceMessagesInString(&value)) { |
+ extension->set_name(value); |
+ } else { |
+ *error = StringPrintf("Message \"%s\" is missing but used in a " |
+ "extension name.", value.c_str()); |
+ return NULL; |
+ } |
+ |
+ value = extension->description(); |
+ if (extension->message_handler()->ReplaceMessagesInString(&value)) { |
+ extension->set_description(value); |
+ } else { |
+ *error = StringPrintf("Message \"%s\" is missing but used in a " |
+ "extension description.", value.c_str()); |
+ return NULL; |
+ } |
} |
// Check children of extension root to see if any of them start with _ and is |