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 "base/strings/string16.h"
12 #include "components/login/login_export.h"
15 class DictionaryValue;
20 // Class that collects Localized Values for translation.
21 class LOGIN_EXPORT LocalizedValuesBuilder {
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,
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 // two format parameters subsituted by |a|, |b| and |c| respectively.
55 void AddF(const std::string& key,
57 const base::string16& a,
58 const base::string16& b,
59 const base::string16& c);
61 // Method to declare localized value. |key| is the i18n key used in html.
62 // |message_id| is a resource id of message. Message is expected to have
63 // one format parameter subsituted by resource identified by |message_id_a|.
64 void AddF(const std::string& key, int message_id, int message_id_a);
66 // Method to declare localized value. |key| is the i18n key used in html.
67 // |message_id| is a resource id of message. Message is expected to have
68 // two format parameters subsituted by resource identified by |message_id_a|
69 // and |message_id_b| respectively.
70 void AddF(const std::string& key,
75 // Method to declare localized value. |key| is the i18n key used in html.
76 // |message_id| is a resource id of message. Message is expected to have
77 // three format parameters subsituted by resource identified by
78 // |message_id_a|, |message_id_b| and |message_id_c| respectively.
79 void AddF(const std::string& key,
89 base::DictionaryValue* dict_;
94 #endif // COMPONENTS_LOGIN_LOCALIZED_VALUES_BUILDER_H_