Roll src/third_party/WebKit f36d5e0:68b67cd (svn 193299:193303)
[chromium-blink-merge.git] / components / login / localized_values_builder.h
blob8c1731c87d1b297f54f6bf732ee521f7151af0e7
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
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_LOGIN_LOCALIZED_VALUES_BUILDER_H_
6 #define COMPONENTS_LOGIN_LOCALIZED_VALUES_BUILDER_H_
8 #include <string>
10 #include "base/macros.h"
11 #include "base/strings/string16.h"
12 #include "components/login/login_export.h"
14 namespace base {
15 class DictionaryValue;
18 namespace login {
20 // Class that collects Localized Values for translation.
21 class LOGIN_EXPORT LocalizedValuesBuilder {
22 public:
23 explicit LocalizedValuesBuilder(base::DictionaryValue* dict);
24 explicit LocalizedValuesBuilder(const std::string& prefix,
25 base::DictionaryValue* dict);
27 // Method to declare localized value. |key| is the i18n key used in html.
28 // |message| is text of the message.
29 void Add(const std::string& key, const std::string& message);
31 // Method to declare localized value. |key| is the i18n key used in html.
32 // |message| is text of the message.
33 void Add(const std::string& key, const base::string16& message);
35 // Method to declare localized value. |key| is the i18n key used in html.
36 // |message_id| is a resource id of message.
37 void Add(const std::string& key, int message_id);
39 // Method to declare localized value. |key| is the i18n key used in html.
40 // |message_id| is a resource id of message. Message is expected to have
41 // one format parameter subsituted by |a|.
42 void AddF(const std::string& key, int message_id, const base::string16& a);
44 // Method to declare localized value. |key| is the i18n key used in html.
45 // |message_id| is a resource id of message. Message is expected to have
46 // two format parameters subsituted by |a| and |b| respectively.
47 void AddF(const std::string& key,
48 int message_id,
49 const base::string16& a,
50 const base::string16& b);
52 // Method to declare localized value. |key| is the i18n key used in html.
53 // |message_id| is a resource id of message. Message is expected to have
54 // one format parameter subsituted by resource identified by |message_id_a|.
55 void AddF(const std::string& key, int message_id, int message_id_a);
57 // Method to declare localized value. |key| is the i18n key used in html.
58 // |message_id| is a resource id of message. Message is expected to have
59 // two format parameters subsituted by resource identified by |message_id_a|
60 // and |message_id_b| respectively.
61 void AddF(const std::string& key,
62 int message_id,
63 int message_id_a,
64 int message_id_b);
66 private:
67 std::string prefix_;
69 // Not owned.
70 base::DictionaryValue* dict_;
73 } // namespace login
75 #endif // COMPONENTS_LOGIN_LOCALIZED_VALUES_BUILDER_H_