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