aboutsummaryrefslogtreecommitdiff
path: root/cpp/include/libaddressinput/localization.h
diff options
context:
space:
mode:
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