Upload upstream chromium 94.0.4606.31
[platform/framework/web/chromium-efl.git] / components / login / localized_values_builder.h
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.
4
5 #ifndef COMPONENTS_LOGIN_LOCALIZED_VALUES_BUILDER_H_
6 #define COMPONENTS_LOGIN_LOCALIZED_VALUES_BUILDER_H_
7
8 #include <string>
9
10 #include "base/macros.h"
11 #include "components/login/login_export.h"
12
13 namespace base {
14 class DictionaryValue;
15 }
16
17 namespace login {
18
19 // Class that collects Localized Values for translation.
20 class LOGIN_EXPORT LocalizedValuesBuilder {
21  public:
22   explicit LocalizedValuesBuilder(base::DictionaryValue* dict);
23   explicit LocalizedValuesBuilder(const std::string& prefix,
24                                   base::DictionaryValue* dict);
25
26   // Method to declare localized value. |key| is the i18n key used in html.
27   // |message| is text of the message.
28   void Add(const std::string& key, const std::string& message);
29
30   // Method to declare localized value. |key| is the i18n key used in html.
31   // |message| is text of the message.
32   void Add(const std::string& key, const std::u16string& message);
33
34   // Method to declare localized value. |key| is the i18n key used in html.
35   // |message_id| is a resource id of message.
36   void Add(const std::string& key, int message_id);
37
38   // Method to declare localized value. |key| is the i18n key used in html.
39   // |message_id| is a resource id of message. Message is expected to have
40   // one format parameter subsituted by |a|.
41   void AddF(const std::string& key, int message_id, const std::u16string& a);
42
43   // Method to declare localized value. |key| is the i18n key used in html.
44   // |message_id| is a resource id of message. Message is expected to have
45   // two format parameters subsituted by |a| and |b| respectively.
46   void AddF(const std::string& key,
47             int message_id,
48             const std::u16string& a,
49             const std::u16string& b);
50
51   // Method to declare localized value. |key| is the i18n key used in html.
52   // |message_id| is a resource id of message. Message is expected to have
53   // two format parameters subsituted by |a|, |b| and |c| respectively.
54   void AddF(const std::string& key,
55             int message_id,
56             const std::u16string& a,
57             const std::u16string& b,
58             const std::u16string& c);
59
60   // Method to declare localized value. |key| is the i18n key used in html.
61   // |message_id| is a resource id of message. Message is expected to have
62   // one format parameter subsituted by resource identified by |message_id_a|.
63   void AddF(const std::string& key, int message_id, int message_id_a);
64
65   // Method to declare localized value. |key| is the i18n key used in html.
66   // |message_id| is a resource id of message. Message is expected to have
67   // two format parameters subsituted by resource identified by |message_id_a|
68   // and |message_id_b| respectively.
69   void AddF(const std::string& key,
70             int message_id,
71             int message_id_a,
72             int message_id_b);
73
74   // Method to declare localized value. |key| is the i18n key used in html.
75   // |message_id| is a resource id of message. Message is expected to have
76   // three format parameters subsituted by resource identified by
77   // |message_id_a|, |message_id_b| and |message_id_c| respectively.
78   void AddF(const std::string& key,
79             int message_id,
80             int message_id_a,
81             int message_id_b,
82             int message_id_c);
83
84  private:
85   std::string prefix_;
86
87   // Not owned.
88   base::DictionaryValue* dict_;
89 };
90
91 }  // namespace login
92
93 #endif  // COMPONENTS_LOGIN_LOCALIZED_VALUES_BUILDER_H_