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_
10 #include "base/macros.h"
11 #include "components/login/login_export.h"
14 class DictionaryValue;
19 // Class that collects Localized Values for translation.
20 class LOGIN_EXPORT LocalizedValuesBuilder {
22 explicit LocalizedValuesBuilder(base::DictionaryValue* dict);
23 explicit LocalizedValuesBuilder(const std::string& prefix,
24 base::DictionaryValue* dict);
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);
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);
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);
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);
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,
48 const std::u16string& a,
49 const std::u16string& b);
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,
56 const std::u16string& a,
57 const std::u16string& b,
58 const std::u16string& c);
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);
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,
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,
88 base::DictionaryValue* dict_;
93 #endif // COMPONENTS_LOGIN_LOCALIZED_VALUES_BUILDER_H_