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

Side by Side Diff: ui/base/webui/web_ui_util.cc

Issue 2032843002: WebUI: add global "locale" key to loadTimeData in many cases (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 6 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
« no previous file with comments | « no previous file | ui/base/webui/web_ui_util_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #include "ui/base/webui/web_ui_util.h" 5 #include "ui/base/webui/web_ui_util.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/base64.h" 9 #include "base/base64.h"
10 #include "base/i18n/rtl.h" 10 #include "base/i18n/rtl.h"
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 if (scale_factor) 113 if (scale_factor)
114 *scale_factor = factor; 114 *scale_factor = factor;
115 } 115 }
116 } 116 }
117 117
118 void SetLoadTimeDataDefaults(const std::string& app_locale, 118 void SetLoadTimeDataDefaults(const std::string& app_locale,
119 base::DictionaryValue* localized_strings) { 119 base::DictionaryValue* localized_strings) {
120 localized_strings->SetString("fontfamily", GetFontFamily()); 120 localized_strings->SetString("fontfamily", GetFontFamily());
121 localized_strings->SetString("fontsize", GetFontSize()); 121 localized_strings->SetString("fontsize", GetFontSize());
122 localized_strings->SetString("language", l10n_util::GetLanguage(app_locale)); 122 localized_strings->SetString("language", l10n_util::GetLanguage(app_locale));
123 localized_strings->SetString("locale", app_locale);
123 localized_strings->SetString("textdirection", GetTextDirection()); 124 localized_strings->SetString("textdirection", GetTextDirection());
124 } 125 }
125 126
126 std::string GetWebUiCssTextDefaults(const std::string& css_template) { 127 std::string GetWebUiCssTextDefaults(const std::string& css_template) {
127 ui::TemplateReplacements placeholders; 128 ui::TemplateReplacements placeholders;
128 placeholders["textDirection"] = GetTextDirection(); 129 placeholders["textDirection"] = GetTextDirection();
129 placeholders["fontFamily"] = GetFontFamily(); 130 placeholders["fontFamily"] = GetFontFamily();
130 placeholders["fontSize"] = GetFontSize(); 131 placeholders["fontSize"] = GetFontSize();
131 return ui::ReplaceTemplateExpressions(css_template, placeholders); 132 return ui::ReplaceTemplateExpressions(css_template, placeholders);
132 } 133 }
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 IDS_WEB_FONT_SIZE_XP : 181 IDS_WEB_FONT_SIZE_XP :
181 #endif 182 #endif
182 IDS_WEB_FONT_SIZE); 183 IDS_WEB_FONT_SIZE);
183 } 184 }
184 185
185 std::string GetTextDirection() { 186 std::string GetTextDirection() {
186 return base::i18n::IsRTL() ? "rtl" : "ltr"; 187 return base::i18n::IsRTL() ? "rtl" : "ltr";
187 } 188 }
188 189
189 } // namespace webui 190 } // namespace webui
OLDNEW
« no previous file with comments | « no previous file | ui/base/webui/web_ui_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698