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 #include "components/login/localized_values_builder.h"
7 #include "base/values.h"
8 #include "ui/base/l10n/l10n_util.h"
12 LocalizedValuesBuilder::LocalizedValuesBuilder(base::DictionaryValue
* dict
)
16 LocalizedValuesBuilder::LocalizedValuesBuilder(const std::string
& prefix
,
17 base::DictionaryValue
* dict
)
18 : prefix_(prefix
), dict_(dict
) {
21 void LocalizedValuesBuilder::Add(const std::string
& key
,
22 const std::string
& message
) {
23 dict_
->SetString(prefix_
+ key
, message
);
26 void LocalizedValuesBuilder::Add(const std::string
& key
,
27 const base::string16
& message
) {
28 dict_
->SetString(prefix_
+ key
, message
);
31 void LocalizedValuesBuilder::Add(const std::string
& key
, int message_id
) {
32 dict_
->SetString(prefix_
+ key
, l10n_util::GetStringUTF16(message_id
));
35 void LocalizedValuesBuilder::AddF(const std::string
& key
,
37 const base::string16
& a
) {
38 dict_
->SetString(prefix_
+ key
, l10n_util::GetStringFUTF16(message_id
, a
));
41 void LocalizedValuesBuilder::AddF(const std::string
& key
,
43 const base::string16
& a
,
44 const base::string16
& b
) {
45 dict_
->SetString(prefix_
+ key
, l10n_util::GetStringFUTF16(message_id
, a
, b
));
48 void LocalizedValuesBuilder::AddF(const std::string
& key
,
51 AddF(key
, message_id
, l10n_util::GetStringUTF16(message_id_a
));
54 void LocalizedValuesBuilder::AddF(const std::string
& key
,
58 AddF(key
, message_id
, l10n_util::GetStringUTF16(message_id_a
),
59 l10n_util::GetStringUTF16(message_id_b
));