OLD | NEW |
(Empty) | |
| 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 "base/strings/string16.h" |
| 12 #include "components/login/login_export.h" |
| 13 |
| 14 namespace base { |
| 15 class DictionaryValue; |
| 16 } |
| 17 |
| 18 namespace login { |
| 19 |
| 20 // Class that collects Localized Values for translation. |
| 21 class LOGIN_EXPORT LocalizedValuesBuilder { |
| 22 public: |
| 23 explicit LocalizedValuesBuilder(base::DictionaryValue* dict); |
| 24 explicit LocalizedValuesBuilder(const std::string& prefix, |
| 25 base::DictionaryValue* dict); |
| 26 |
| 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); |
| 30 |
| 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); |
| 34 |
| 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); |
| 38 |
| 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); |
| 43 |
| 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, |
| 48 int message_id, |
| 49 const base::string16& a, |
| 50 const base::string16& b); |
| 51 |
| 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 // one format parameter subsituted by resource identified by |message_id_a|. |
| 55 void AddF(const std::string& key, int message_id, int message_id_a); |
| 56 |
| 57 // Method to declare localized value. |key| is the i18n key used in html. |
| 58 // |message_id| is a resource id of message. Message is expected to have |
| 59 // two format parameters subsituted by resource identified by |message_id_a| |
| 60 // and |message_id_b| respectively. |
| 61 void AddF(const std::string& key, |
| 62 int message_id, |
| 63 int message_id_a, |
| 64 int message_id_b); |
| 65 |
| 66 private: |
| 67 std::string prefix_; |
| 68 |
| 69 // Not owned. |
| 70 base::DictionaryValue* dict_; |
| 71 }; |
| 72 |
| 73 } // namespace login |
| 74 |
| 75 #endif // COMPONENTS_LOGIN_LOCALIZED_VALUES_BUILDER_H_ |
OLD | NEW |