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

Unified Diff: ui/base/webui/jstemplate_builder.cc

Issue 2607843002: [MD settings] i18n template replacements in shared HTML resources (Closed)
Patch Set: nits Created 3 years, 11 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
« no previous file with comments | « ui/base/template_expressions.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/webui/jstemplate_builder.cc
diff --git a/ui/base/webui/jstemplate_builder.cc b/ui/base/webui/jstemplate_builder.cc
index 3e9d4110ce9f82624a2cae4e9f9d3214eecd8cd5..16a338a8755a7c601e523a20164ea48fdff5795c 100644
--- a/ui/base/webui/jstemplate_builder.cc
+++ b/ui/base/webui/jstemplate_builder.cc
@@ -13,6 +13,7 @@
#include "base/strings/string_util.h"
#include "ui/base/layout.h"
#include "ui/base/resource/resource_bundle.h"
+#include "ui/base/template_expressions.h"
#include "ui/resources/grit/webui_resources.h"
namespace webui {
@@ -101,10 +102,19 @@ void AppendI18nTemplateSourceHtml(std::string* output) {
std::string GetI18nTemplateHtml(const base::StringPiece& html_template,
const base::DictionaryValue* json) {
- std::string output(html_template.data(), html_template.size());
+ ui::TemplateReplacements replacements;
+ ui::TemplateReplacementsFromDictionaryValue(*json, &replacements);
+ std::string output =
+ ui::ReplaceTemplateExpressions(html_template, replacements);
+
+ // TODO(dschuyler): After the i18n-content and i18n-values are replaced with
+ // $i18n{} replacements, we will be able to return output at this point.
+ // Remove Append*() lines that builds up the i18n replacement work to be done
+ // in JavaScript.
AppendLoadTimeData(&output);
AppendJsonHtml(json, &output);
AppendI18nTemplateSourceHtml(&output);
+
return output;
}
« no previous file with comments | « ui/base/template_expressions.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698