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

Side by Side Diff: ui/base/template_expressions.h

Issue 1585923011: [Template Expressions] changing ${ leader to $i18n{ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 defines utility functions for replacing template expressions. 5 // This file defines utility functions for replacing template expressions.
6 // For example "Hello ${name}" could have ${name} replaced by the user's name. 6 // For example "Hello ${name}" could have ${name} replaced by the user's name.
7 7
8 #ifndef UI_BASE_TEMPLATE_EXPRESSIONS_H_ 8 #ifndef UI_BASE_TEMPLATE_EXPRESSIONS_H_
9 #define UI_BASE_TEMPLATE_EXPRESSIONS_H_ 9 #define UI_BASE_TEMPLATE_EXPRESSIONS_H_
10 10
11 #include <map> 11 #include <map>
12 #include <string> 12 #include <string>
13 13
14 #include "base/strings/string_piece.h" 14 #include "base/strings/string_piece.h"
15 #include "ui/base/ui_base_export.h" 15 #include "ui/base/ui_base_export.h"
16 16
17 namespace ui { 17 namespace ui {
18 18
19 // Map of strings for template replacement in |ReplaceTemplateExpressions|.
20 typedef std::map<const std::string, std::string> ReplaceTemplateMap;
Dan Beam 2016/01/20 22:34:38 nit: I18nTemplateMap? TemplateReplacements? Templa
dschuyler 2016/01/21 18:43:53 Done.
21
19 // Replace ${foo} in the format string with the value for the foo key in 22 // Replace ${foo} in the format string with the value for the foo key in
20 // |subst|. If the key is not found in the |substitutions| that item will 23 // |subst|. If the key is not found in the |substitutions| that item will
21 // be unaltered. 24 // be unaltered.
22 UI_BASE_EXPORT std::string ReplaceTemplateExpressions( 25 UI_BASE_EXPORT std::string ReplaceTemplateExpressions(
23 base::StringPiece format_string, 26 base::StringPiece format_string,
24 const std::map<base::StringPiece, std::string>& substitutions); 27 const ReplaceTemplateMap& substitutions);
25 28
26 } // namespace ui 29 } // namespace ui
27 30
28 #endif // UI_BASE_TEMPLATE_EXPRESSIONS_H_ 31 #endif // UI_BASE_TEMPLATE_EXPRESSIONS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698