aboutsummaryrefslogtreecommitdiff
path: root/cpp/include/libaddressinput/localization.h
diff options
context:
space:
mode:
authorTorne (Richard Coles) <torne@google.com>2014-06-25 10:31:36 +0100
committerTorne (Richard Coles) <torne@google.com>2014-06-25 10:31:36 +0100
commit6ce3a9ad00160cd58574b6bca6d2220c4dbfc83e (patch)
treebd4c283a39b6659d25c49870a045ff73b049eebc /cpp/include/libaddressinput/localization.h
parentb8347ad8ead685b8afe0ff329ae047f17c7b817c (diff)
parentf7ddeee545f03c948074c921c4648807d90227ae (diff)
downloadsrc-l-preview.tar.gz
This commit was generated by merge_to_master.py. Change-Id: I283eef90c15d40ea8cd6290f12094fc152a2c45e
Diffstat (limited to 'cpp/include/libaddressinput/localization.h')
-rw-r--r--cpp/include/libaddressinput/localization.h27
1 files changed, 9 insertions, 18 deletions
diff --git a/cpp/include/libaddressinput/localization.h b/cpp/include/libaddressinput/localization.h
index 08b5964..acfdf7e 100644
--- a/cpp/include/libaddressinput/localization.h
+++ b/cpp/include/libaddressinput/localization.h
@@ -26,17 +26,17 @@ namespace addressinput {
struct AddressData;
-// The object to retrieve localized strings based on message IDs. Sample usage:
+// The object to retrieve localized strings based on message IDs. It returns
+// English by default. Sample usage:
// Localization localization;
-// localization.SetLanguage("en");
// std::string best_language_tag;
-// Process(BuildComponents("CA", localization, &best_language_tag));
+// Process(BuildComponents("CA", localization, "en-US", &best_language_tag));
//
// Alternative usage:
// Localization localization;
-// localization.SetGetter(&MyStringGetter, "fr");
+// localization.SetGetter(&MyStringGetter);
// std::string best_language_tag;
-// Process(BuildComponents("CA", localization, &best_language_tag));
+// Process(BuildComponents("CA", localization, "fr-CA", &best_language_tag));
class Localization {
public:
// Initializes with English messages by default.
@@ -63,17 +63,11 @@ class Localization {
bool enable_examples,
bool enable_links) const;
- // Sets the language for the strings. The only supported language is "en"
- // until we have translations.
- void SetLanguage(const std::string& language_tag);
-
// Sets the string getter that takes a message identifier and returns the
- // corresponding localized string. The |language_tag| parameter is used only
- // for information purposes here.
- void SetGetter(std::string (*getter)(int), const std::string& language_tag);
-
- // Returns the current language tag.
- const std::string& GetLanguage() const { return language_tag_; }
+ // corresponding localized string. For example, in Chromium there is
+ // l10n_util::GetStringUTF8 which always returns strings in the current
+ // application locale.
+ void SetGetter(std::string (*getter)(int));
private:
// Returns the error message where the address field is a postal code. Helper
@@ -90,9 +84,6 @@ class Localization {
// The string getter.
std::string (*get_string_)(int);
-
- // The current language tag.
- std::string language_tag_;
};
} // namespace addressinput