summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/ui/autofill/autofill_dialog_i18n_input.cc9
-rw-r--r--chrome/browser/ui/autofill/country_combobox_model_unittest.cc3
-rw-r--r--third_party/libaddressinput/chromium/cpp/include/libaddressinput/address_data.h5
-rw-r--r--third_party/libaddressinput/chromium/cpp/include/libaddressinput/address_ui.h23
-rw-r--r--third_party/libaddressinput/chromium/cpp/libaddressinput.gyp7
-rw-r--r--third_party/libaddressinput/chromium/cpp/src/address_data.cc35
-rw-r--r--third_party/libaddressinput/chromium/cpp/src/address_ui.cc95
-rw-r--r--third_party/libaddressinput/chromium/cpp/src/address_validator.cc2
-rw-r--r--third_party/libaddressinput/chromium/cpp/src/region_data_constants.cc353
-rw-r--r--third_party/libaddressinput/chromium/cpp/src/retriever.cc2
-rw-r--r--third_party/libaddressinput/chromium/cpp/src/rule.cc15
-rw-r--r--third_party/libaddressinput/chromium/cpp/src/rule.h14
-rw-r--r--third_party/libaddressinput/chromium/cpp/src/time_to_string.cc36
-rw-r--r--third_party/libaddressinput/chromium/cpp/src/time_to_string.h30
-rw-r--r--third_party/libaddressinput/chromium/cpp/src/util/string_compare.cc31
-rw-r--r--third_party/libaddressinput/chromium/cpp/src/util/string_compare.h30
-rw-r--r--third_party/libaddressinput/chromium/cpp/src/util/string_split.cc37
-rw-r--r--third_party/libaddressinput/chromium/cpp/src/util/string_split.h34
-rw-r--r--third_party/libaddressinput/chromium/cpp/src/util/string_util.cc80
-rw-r--r--third_party/libaddressinput/chromium/cpp/src/util/string_util.h56
-rw-r--r--third_party/libaddressinput/chromium/cpp/test/address_data_test.cc28
-rw-r--r--third_party/libaddressinput/chromium/cpp/test/address_ui_test.cc53
-rw-r--r--third_party/libaddressinput/chromium/cpp/test/countryinfo_example_addresses_test.cc2
-rw-r--r--third_party/libaddressinput/chromium/cpp/test/retriever_test.cc2
-rw-r--r--third_party/libaddressinput/chromium/cpp/test/util/string_util_test.cc (renamed from third_party/libaddressinput/chromium/cpp/test/util/string_split_unittest.cc)4
-rw-r--r--third_party/libaddressinput/libaddressinput.gyp12
26 files changed, 684 insertions, 314 deletions
diff --git a/chrome/browser/ui/autofill/autofill_dialog_i18n_input.cc b/chrome/browser/ui/autofill/autofill_dialog_i18n_input.cc
index ee60f41..c079e3d 100644
--- a/chrome/browser/ui/autofill/autofill_dialog_i18n_input.cc
+++ b/chrome/browser/ui/autofill/autofill_dialog_i18n_input.cc
@@ -6,6 +6,7 @@
#include "base/strings/string_split.h"
#include "base/strings/utf_string_conversions.h"
+#include "chrome/browser/browser_process.h"
#include "components/autofill/core/browser/autofill_profile.h"
#include "components/autofill/core/browser/credit_card.h"
#include "components/autofill/core/browser/field_types.h"
@@ -38,8 +39,11 @@ DetailInput::Length LengthFromHint(AddressUiComponent::LengthHint hint) {
void BuildAddressInputs(common::AddressType address_type,
const std::string& country_code,
DetailInputs* inputs) {
+ // TODO(rouslan): Store the language code for the autofill profile.
+ // http://crbug.com/354955
std::vector<AddressUiComponent> components(
- ::i18n::addressinput::BuildComponents(country_code));
+ ::i18n::addressinput::BuildComponents(
+ country_code, g_browser_process->GetApplicationLocale(), NULL));
const bool billing = address_type == common::ADDRESS_TYPE_BILLING;
@@ -242,7 +246,8 @@ void CreateAddressData(
bool CountryIsFullySupported(const std::string& country_code) {
DCHECK_EQ(2U, country_code.size());
std::vector< ::i18n::addressinput::AddressUiComponent> components =
- ::i18n::addressinput::BuildComponents(country_code);
+ ::i18n::addressinput::BuildComponents(
+ country_code, g_browser_process->GetApplicationLocale(), NULL);
for (size_t i = 0; i < components.size(); ++i) {
if (components[i].field == ::i18n::addressinput::DEPENDENT_LOCALITY)
return false;
diff --git a/chrome/browser/ui/autofill/country_combobox_model_unittest.cc b/chrome/browser/ui/autofill/country_combobox_model_unittest.cc
index 1514b7a..56ebd85 100644
--- a/chrome/browser/ui/autofill/country_combobox_model_unittest.cc
+++ b/chrome/browser/ui/autofill/country_combobox_model_unittest.cc
@@ -50,7 +50,8 @@ TEST_F(CountryComboboxModelTest, AllCountriesHaveComponents) {
std::string country_code = model()->countries()[i]->country_code();
std::vector< ::i18n::addressinput::AddressUiComponent> components =
- ::i18n::addressinput::BuildComponents(country_code);
+ ::i18n::addressinput::BuildComponents(
+ country_code, std::string(), NULL);
EXPECT_FALSE(components.empty());
}
}
diff --git a/third_party/libaddressinput/chromium/cpp/include/libaddressinput/address_data.h b/third_party/libaddressinput/chromium/cpp/include/libaddressinput/address_data.h
index e9ca7a4..e101877 100644
--- a/third_party/libaddressinput/chromium/cpp/include/libaddressinput/address_data.h
+++ b/third_party/libaddressinput/chromium/cpp/include/libaddressinput/address_data.h
@@ -56,11 +56,6 @@ struct AddressData {
// which comprises multiple fields.
void SetFieldValue(AddressField field, const std::string& value);
- // Guesses the BCP 47 language code to be used for formatting the address for
- // display. For example, guesses "en" if the |country_code| is "US". Can
- // return an empty string.
- const std::string& GuessLanguageCode() const;
-
// The BCP 47 language code used to guide how the address is formatted for
// display. The same address may have different representations in different
// languages.
diff --git a/third_party/libaddressinput/chromium/cpp/include/libaddressinput/address_ui.h b/third_party/libaddressinput/chromium/cpp/include/libaddressinput/address_ui.h
index 91d917b..eecbcd8a 100644
--- a/third_party/libaddressinput/chromium/cpp/include/libaddressinput/address_ui.h
+++ b/third_party/libaddressinput/chromium/cpp/include/libaddressinput/address_ui.h
@@ -28,9 +28,26 @@ struct AddressUiComponent;
// Returns the list of supported CLDR region codes.
const std::vector<std::string>& GetRegionCodes();
-// Returns the UI components for the CLDR |region_code|. Returns an empty vector
-// on error.
-std::vector<AddressUiComponent> BuildComponents(const std::string& region_code);
+// Returns the UI components for the CLDR |region_code|. These components
+// represent the address input and formatting rules for |region_code|.
+//
+// Sets the |components_language_code| to the BCP 47 language code that should
+// be used to format the address that the user entered via the UI components.
+// The |components_language_code| parameter can be NULL.
+//
+// If |region_code| has rules for latinized address format and the BCP 47
+// |ui_language_code| is not the primary language code used in the region, then
+// returns the latinized version of the UI components.
+//
+// If the UI language has a variation, then the function ignores the variation.
+// For example, the function does not distinguish among zh-hans, zh-hant, and
+// zh.
+//
+// Returns an empty vector on error.
+std::vector<AddressUiComponent> BuildComponents(
+ const std::string& region_code,
+ const std::string& ui_language_code,
+ std::string* components_language_code);
// Returns the fields which are required for the CLDR |region_code|. Returns an
// empty vector on error.
diff --git a/third_party/libaddressinput/chromium/cpp/libaddressinput.gyp b/third_party/libaddressinput/chromium/cpp/libaddressinput.gyp
index 6215898..8c44188 100644
--- a/third_party/libaddressinput/chromium/cpp/libaddressinput.gyp
+++ b/third_party/libaddressinput/chromium/cpp/libaddressinput.gyp
@@ -42,12 +42,10 @@
'src/retriever.cc',
'src/rule.cc',
'src/ruleset.cc',
- 'src/time_to_string.cc',
'src/util/canonicalize_string.cc',
'src/util/json.cc',
'src/util/md5.cc',
- 'src/util/string_compare.cc',
- 'src/util/string_split.cc',
+ 'src/util/string_util.cc',
'src/util/trie.cc',
],
'defines': [
@@ -76,12 +74,11 @@
'test/retriever_test.cc',
'test/rule_test.cc',
'test/storage_test_runner.cc',
- 'test/time_to_string.cc',
'test/util/json_test.cc',
'test/util/md5_unittest.cc',
'test/util/scoped_ptr_unittest.cc',
'test/util/stl_util_unittest.cc',
- 'test/util/string_split_unittest.cc',
+ 'test/util/string_util_test.cc',
'test/util/trie_test.cc',
],
'defines': [
diff --git a/third_party/libaddressinput/chromium/cpp/src/address_data.cc b/third_party/libaddressinput/chromium/cpp/src/address_data.cc
index 51d36c6..08da6ca 100644
--- a/third_party/libaddressinput/chromium/cpp/src/address_data.cc
+++ b/third_party/libaddressinput/chromium/cpp/src/address_data.cc
@@ -24,6 +24,7 @@
#include "region_data_constants.h"
#include "rule.h"
+#include "util/string_util.h"
namespace i18n {
namespace addressinput {
@@ -65,7 +66,16 @@ void AddressData::FormatForDisplay(std::vector<std::string>* lines) const {
rule.CopyFrom(Rule::GetDefault());
rule.ParseSerializedRule(RegionDataConstants::GetRegionData(country_code));
- const std::vector<std::vector<FormatElement> >& format = rule.GetFormat();
+ // If latinized rules are available and the |language_code| of this address is
+ // not the primary language code for the region, then use the latinized
+ // formatting rules.
+ const std::vector<std::vector<FormatElement> >& format =
+ rule.GetLatinFormat().empty() ||
+ language_code.empty() ||
+ NormalizeLanguageCode(language_code) ==
+ NormalizeLanguageCode(rule.GetLanguage())
+ ? rule.GetFormat() : rule.GetLatinFormat();
+
for (size_t i = 0; i < format.size(); ++i) {
std::string line;
for (size_t j = 0; j < format[i].size(); ++j) {
@@ -107,28 +117,5 @@ void AddressData::SetFieldValue(AddressField field, const std::string& value) {
}
}
-const std::string& AddressData::GuessLanguageCode() const {
- Rule rule;
- rule.CopyFrom(Rule::GetDefault());
- if (!rule.ParseSerializedRule(
- RegionDataConstants::GetRegionData(country_code))) {
- return language_code;
- }
-
- std::vector<std::string>::const_iterator lang_it =
- std::find(rule.GetLanguages().begin(),
- rule.GetLanguages().end(),
- language_code);
- if (lang_it != rule.GetLanguages().end()) {
- return *lang_it;
- }
-
- if (!rule.GetLanguage().empty()) {
- return rule.GetLanguage();
- }
-
- return language_code;
-}
-
} // namespace addressinput
} // namespace i18n
diff --git a/third_party/libaddressinput/chromium/cpp/src/address_ui.cc b/third_party/libaddressinput/chromium/cpp/src/address_ui.cc
index c4eeb99..b4337fd 100644
--- a/third_party/libaddressinput/chromium/cpp/src/address_ui.cc
+++ b/third_party/libaddressinput/chromium/cpp/src/address_ui.cc
@@ -17,6 +17,9 @@
#include <libaddressinput/address_field.h>
#include <libaddressinput/address_ui_component.h>
+#include <algorithm>
+#include <cassert>
+#include <cstddef>
#include <set>
#include <string>
#include <vector>
@@ -25,6 +28,7 @@
#include "grit/libaddressinput_strings.h"
#include "region_data_constants.h"
#include "rule.h"
+#include "util/string_util.h"
namespace i18n {
namespace addressinput {
@@ -58,6 +62,74 @@ int GetMessageIdForField(AddressField field,
}
}
+// Returns the BCP 47 language code that should be used to format the address
+// that the user entered.
+//
+// If the rule does not contain information about languages, then returns the
+// UI language.
+//
+// If the UI language is either the default language for the country, one of the
+// languages for rules, or one of the languages for address input, then returns
+// this UI language. If there're no matches, then picks one of the languages in
+// the rule and returns it.
+//
+// If latinized rules are available and the UI language code is not the primary
+// language code for this region, then returns the primary language with "-latn"
+// appended.
+std::string GetComponentsLanguageCode(const Rule& rule,
+ const std::string& ui_language_code) {
+ // Select the default language code for the region.
+ std::string default_language_code;
+ if (!rule.GetLanguage().empty()) {
+ default_language_code = rule.GetLanguage();
+ } else if (!rule.GetLanguages().empty()) {
+ default_language_code = rule.GetLanguages()[0];
+ } else if (!rule.GetInputLanguages().empty()) {
+ default_language_code = rule.GetInputLanguages()[0];
+ } else {
+ // Region does not have any language information (e.g. Antarctica). Use the
+ // UI language code as is.
+ return ui_language_code;
+ }
+
+ // If the UI language code is not set, then use default language code.
+ if (ui_language_code.empty()) {
+ return default_language_code;
+ }
+
+ const std::string& normalized_ui_language_code =
+ NormalizeLanguageCode(ui_language_code);
+ const std::string& normalized_default_language_code =
+ NormalizeLanguageCode(default_language_code);
+
+ // Check whether UI language code matches any language codes in the rule,
+ // normalized or as is.
+ if (normalized_default_language_code == normalized_ui_language_code ||
+ std::find(
+ rule.GetLanguages().begin(),
+ rule.GetLanguages().end(),
+ ui_language_code) != rule.GetLanguages().end() ||
+ std::find(
+ rule.GetLanguages().begin(),
+ rule.GetLanguages().end(),
+ normalized_ui_language_code) != rule.GetLanguages().end() ||
+ std::find(
+ rule.GetInputLanguages().begin(),
+ rule.GetInputLanguages().end(),
+ ui_language_code) != rule.GetInputLanguages().end() ||
+ std::find(
+ rule.GetInputLanguages().begin(),
+ rule.GetInputLanguages().end(),
+ normalized_ui_language_code) != rule.GetInputLanguages().end()) {
+ return ui_language_code;
+ }
+
+ // The UI language code does not match any language information in the rule.
+ return rule.GetLatinFormat().empty()
+ ? default_language_code
+ : normalized_default_language_code + "-latn";
+}
+
} // namespace
const std::vector<std::string>& GetRegionCodes() {
@@ -65,7 +137,9 @@ const std::vector<std::string>& GetRegionCodes() {
}
std::vector<AddressUiComponent> BuildComponents(
- const std::string& region_code) {
+ const std::string& region_code,
+ const std::string& ui_language_code,
+ std::string* components_language_code) {
std::vector<AddressUiComponent> result;
Rule rule;
@@ -75,13 +149,28 @@ std::vector<AddressUiComponent> BuildComponents(
return result;
}
+ if (components_language_code != NULL) {
+ *components_language_code =
+ GetComponentsLanguageCode(rule, ui_language_code);
+ }
+
// For avoiding showing an input field twice, when the field is displayed
// twice on an envelope.
std::set<AddressField> fields;
+ // If latinized rules are available and the |ui_language_code| is not the
+ // primary language code for the region, then use the latinized formatting
+ // rules.
+ const std::vector<std::vector<FormatElement> >& format =
+ rule.GetLatinFormat().empty() ||
+ ui_language_code.empty() ||
+ NormalizeLanguageCode(ui_language_code) ==
+ NormalizeLanguageCode(rule.GetLanguage())
+ ? rule.GetFormat() : rule.GetLatinFormat();
+
for (std::vector<std::vector<FormatElement> >::const_iterator
- line_it = rule.GetFormat().begin();
- line_it != rule.GetFormat().end();
+ line_it = format.begin();
+ line_it != format.end();
++line_it) {
int num_fields_this_row = 0;
for (std::vector<FormatElement>::const_iterator element_it =
diff --git a/third_party/libaddressinput/chromium/cpp/src/address_validator.cc b/third_party/libaddressinput/chromium/cpp/src/address_validator.cc
index 357cc16..3241d47 100644
--- a/third_party/libaddressinput/chromium/cpp/src/address_validator.cc
+++ b/third_party/libaddressinput/chromium/cpp/src/address_validator.cc
@@ -40,7 +40,7 @@
#include "rule.h"
#include "ruleset.h"
#include "util/stl_util.h"
-#include "util/string_compare.h"
+#include "util/string_util.h"
namespace i18n {
namespace addressinput {
diff --git a/third_party/libaddressinput/chromium/cpp/src/region_data_constants.cc b/third_party/libaddressinput/chromium/cpp/src/region_data_constants.cc
index be60e54..9b80464 100644
--- a/third_party/libaddressinput/chromium/cpp/src/region_data_constants.cc
+++ b/third_party/libaddressinput/chromium/cpp/src/region_data_constants.cc
@@ -17,8 +17,8 @@
//
// https://code.google.com/p/libaddressinput/source/browse/trunk/java/src/com/android/i18n/addressinput/RegionDataConstants.java?r=137
//
-// The language-to-separator and country-to-language mapping is loosely based
-// on:
+// The language-to-separator mapping and primary input languages are loosely
+// based on:
//
// http://unicode.org/cldr/trac/browser/tags/release-24/common/supplemental/supplementalData.xml
@@ -41,39 +41,48 @@ std::map<std::string, std::string> InitRegionData() {
"\"name\":\"ANDORRA\","
"\"lang\":\"ca\","
"\"languages\":\"ca\","
+ "\"input_languages\":\"ca\","
"\"fmt\":\"%N%n%O%n%A%n%Z %S\","
"\"require\":\"AS\","
"\"state_name_type\":\"parish\""
"}"));
region_data.insert(std::make_pair("AE", "{"
"\"name\":\"UNITED ARAB EMIRATES\","
+ "\"input_languages\":\"ar\","
"\"fmt\":\"%N%n%O%n%A%n%C\","
"\"require\":\"AC\""
"}"));
region_data.insert(std::make_pair("AF", "{"
- "\"name\":\"AFGHANISTAN\""
+ "\"name\":\"AFGHANISTAN\","
+ "\"input_languages\":\"fa~ps\""
"}"));
region_data.insert(std::make_pair("AG", "{"
"\"name\":\"ANTIGUA AND BARBUDA\","
+ "\"input_languages\":\"en\","
"\"require\":\"A\""
"}"));
region_data.insert(std::make_pair("AI", "{"
- "\"name\":\"ANGUILLA\""
+ "\"name\":\"ANGUILLA\","
+ "\"input_languages\":\"en\""
"}"));
region_data.insert(std::make_pair("AL", "{"
- "\"name\":\"ALBANIA\""
+ "\"name\":\"ALBANIA\","
+ "\"input_languages\":\"sq\""
"}"));
region_data.insert(std::make_pair("AM", "{"
"\"name\":\"ARMENIA\","
"\"lang\":\"hy\","
"\"languages\":\"hy\","
- "\"fmt\":\"%N%n%O%n%A%n%Z%n%C%n%S\""
+ "\"input_languages\":\"hy\","
+ "\"fmt\":\"%N%n%O%n%A%n%Z%n%C%n%S\","
+ "\"lfmt\":\"%N%n%O%n%A%n%Z%n%C%n%S\""
"}"));
region_data.insert(std::make_pair("AN", "{"
"\"name\":\"NETHERLANDS ANTILLES\""
"}"));
region_data.insert(std::make_pair("AO", "{"
- "\"name\":\"ANGOLA\""
+ "\"name\":\"ANGOLA\","
+ "\"input_languages\":\"pt\""
"}"));
region_data.insert(std::make_pair("AQ", "{"
"\"name\":\"ANTARCTICA\""
@@ -82,11 +91,13 @@ std::map<std::string, std::string> InitRegionData() {
"\"name\":\"ARGENTINA\","
"\"lang\":\"es\","
"\"languages\":\"es\","
+ "\"input_languages\":\"es\","
"\"fmt\":\"%N%n%O%n%A%n%Z %C%n%S\","
"\"state_name_type\":\"state\""
"}"));
region_data.insert(std::make_pair("AS", "{"
"\"name\":\"AMERICAN SAMOA\","
+ "\"input_languages\":\"en~sm\","
"\"fmt\":\"%N%n%O%n%A%n%C %S %Z\","
"\"require\":\"ACSZ\","
"\"zip_name_type\":\"zip\","
@@ -94,6 +105,7 @@ std::map<std::string, std::string> InitRegionData() {
"}"));
region_data.insert(std::make_pair("AT", "{"
"\"name\":\"AUSTRIA\","
+ "\"input_languages\":\"de\","
"\"fmt\":\"%O%n%N%n%A%n%Z %C\","
"\"require\":\"ACZ\""
"}"));
@@ -101,77 +113,95 @@ std::map<std::string, std::string> InitRegionData() {
"\"name\":\"AUSTRALIA\","
"\"lang\":\"en\","
"\"languages\":\"en\","
+ "\"input_languages\":\"en\","
"\"fmt\":\"%O%n%N%n%A%n%C %S %Z\","
"\"require\":\"ACSZ\","
"\"state_name_type\":\"state\""
"}"));
region_data.insert(std::make_pair("AW", "{"
- "\"name\":\"ARUBA\""
+ "\"name\":\"ARUBA\","
+ "\"input_languages\":\"nl~pap\""
"}"));
region_data.insert(std::make_pair("AX", "{"
"\"name\":\"FINLAND\","
+ "\"input_languages\":\"sv\","
"\"fmt\":\"%O%n%N%n%A%nAX-%Z %C%n\xC3\x85LAND\"," // \xC3\x85 is Å.
"\"require\":\"ACZ\""
"}"));
region_data.insert(std::make_pair("AZ", "{"
"\"name\":\"AZERBAIJAN\","
+ "\"input_languages\":\"az\","
"\"fmt\":\"%N%n%O%n%A%nAZ %Z %C\""
"}"));
region_data.insert(std::make_pair("BA", "{"
"\"name\":\"BOSNIA AND HERZEGOVINA\","
+ "\"input_languages\":\"bs~hr~sr\","
"\"fmt\":\"%N%n%O%n%A%n%Z %C\""
"}"));
region_data.insert(std::make_pair("BB", "{"
"\"name\":\"BARBADOS\","
+ "\"input_languages\":\"en\","
"\"state_name_type\":\"parish\""
"}"));
region_data.insert(std::make_pair("BD", "{"
"\"name\":\"BANGLADESH\","
+ "\"input_languages\":\"bn\","
"\"fmt\":\"%N%n%O%n%A%n%C - %Z\""
"}"));
region_data.insert(std::make_pair("BE", "{"
"\"name\":\"BELGIUM\","
+ "\"input_languages\":\"de~fr~nl\","
"\"fmt\":\"%O%n%N%n%A%n%Z %C\","
"\"require\":\"ACZ\""
"}"));
region_data.insert(std::make_pair("BF", "{"
"\"name\":\"BURKINA FASO\","
+ "\"input_languages\":\"fr\","
"\"fmt\":\"%N%n%O%n%A%n%C %X\""
"}"));
region_data.insert(std::make_pair("BG", "{"
"\"name\":\"BULGARIA (REP.)\","
+ "\"input_languages\":\"bg\","
"\"fmt\":\"%N%n%O%n%A%n%Z %C\""
"}"));
region_data.insert(std::make_pair("BH", "{"
"\"name\":\"BAHRAIN\","
+ "\"input_languages\":\"ar\","
"\"fmt\":\"%N%n%O%n%A%n%C %Z\""
"}"));
region_data.insert(std::make_pair("BI", "{"
- "\"name\":\"BURUNDI\""
+ "\"name\":\"BURUNDI\","
+ "\"input_languages\":\"fr~rn\""
"}"));
region_data.insert(std::make_pair("BJ", "{"
- "\"name\":\"BENIN\""
+ "\"name\":\"BENIN\","
+ "\"input_languages\":\"fr\""
"}"));
region_data.insert(std::make_pair("BL", "{"
"\"name\":\"SAINT BARTHELEMY\","
+ "\"input_languages\":\"fr\","
"\"fmt\":\"%O%n%N%n%A%n%Z %C %X\","
"\"require\":\"ACZ\""
"}"));
region_data.insert(std::make_pair("BM", "{"
"\"name\":\"BERMUDA\","
+ "\"input_languages\":\"en\","
"\"fmt\":\"%N%n%O%n%A%n%C %Z\""
"}"));
region_data.insert(std::make_pair("BN", "{"
"\"name\":\"BRUNEI DARUSSALAM\","
+ "\"input_languages\":\"ms\","
"\"fmt\":\"%N%n%O%n%A%n%C %Z\""
"}"));
region_data.insert(std::make_pair("BO", "{"
- "\"name\":\"BOLIVIA\""
+ "\"name\":\"BOLIVIA\","
+ "\"input_languages\":\"ay~es~qu\""
"}"));
region_data.insert(std::make_pair("BR", "{"
"\"name\":\"BRAZIL\","
"\"lang\":\"pt\","
"\"languages\":\"pt\","
+ "\"input_languages\":\"pt\","
"\"fmt\":\"%O%n%N%n%A%n%C-%S%n%Z\","
"\"require\":\"ASCZ\","
"\"state_name_type\":\"state\""
@@ -180,84 +210,103 @@ std::map<std::string, std::string> InitRegionData() {
"\"name\":\"BAHAMAS\","
"\"lang\":\"en\","
"\"languages\":\"en\","
+ "\"input_languages\":\"en\","
"\"fmt\":\"%N%n%O%n%A%n%C, %S\","
"\"state_name_type\":\"island\""
"}"));
region_data.insert(std::make_pair("BT", "{"
- "\"name\":\"BHUTAN\""
+ "\"name\":\"BHUTAN\","
+ "\"input_languages\":\"dz\""
"}"));
region_data.insert(std::make_pair("BV", "{"
"\"name\":\"BOUVET ISLAND\""
"}"));
region_data.insert(std::make_pair("BW", "{"
- "\"name\":\"BOTSWANA\""
+ "\"name\":\"BOTSWANA\","
+ "\"input_languages\":\"en~tn\""
"}"));
region_data.insert(std::make_pair("BY", "{"
"\"name\":\"BELARUS\","
+ "\"input_languages\":\"be~ru\","
"\"fmt\":\"%S%n%Z %C %X%n%A%n%O%n%N\""
"}"));
region_data.insert(std::make_pair("BZ", "{"
- "\"name\":\"BELIZE\""
+ "\"name\":\"BELIZE\","
+ "\"input_languages\":\"en\""
"}"));
region_data.insert(std::make_pair("CA", "{"
"\"name\":\"CANADA\","
"\"lang\":\"en\","
"\"languages\":\"en~fr\","
+ "\"input_languages\":\"en~fr\","
"\"fmt\":\"%N%n%O%n%A%n%C %S %Z\","
"\"require\":\"ACSZ\""
"}"));
region_data.insert(std::make_pair("CC", "{"
"\"name\":\"COCOS (KEELING) ISLANDS\","
+ "\"input_languages\":\"en\","
"\"fmt\":\"%O%n%N%n%A%n%C %S %Z\""
"}"));
region_data.insert(std::make_pair("CD", "{"
"\"name\":\"CONGO (DEM. REP.)\","
+ "\"input_languages\":\"fr\","
"\"fmt\":\"%N%n%O%n%A%n%C %X\""
"}"));
region_data.insert(std::make_pair("CF", "{"
- "\"name\":\"CENTRAL AFRICAN REPUBLIC\""
+ "\"name\":\"CENTRAL AFRICAN REPUBLIC\","
+ "\"input_languages\":\"fr~sg\""
"}"));
region_data.insert(std::make_pair("CG", "{"
- "\"name\":\"CONGO (REP.)\""
+ "\"name\":\"CONGO (REP.)\","
+ "\"input_languages\":\"fr~ln\""
"}"));
region_data.insert(std::make_pair("CH", "{"
"\"name\":\"SWITZERLAND\","
"\"lang\":\"de\","
"\"languages\":\"de~fr~it\","
+ "\"input_languages\":\"de~fr~gsw~it\","
"\"fmt\":\"%O%n%N%n%A%nCH-%Z %C\","
"\"require\":\"ACZ\""
"}"));
region_data.insert(std::make_pair("CI", "{"
"\"name\":\"COTE D'IVOIRE\","
+ "\"input_languages\":\"fr\","
"\"fmt\":\"%N%n%O%n%X %A %C %X\""
"}"));
region_data.insert(std::make_pair("CK", "{"
"\"name\":\"COOK ISLANDS\","
+ "\"input_languages\":\"en\","
"\"fmt\":\"%N%n%O%n%A%n%C %Z\""
"}"));
region_data.insert(std::make_pair("CL", "{"
"\"name\":\"CHILE\","
"\"lang\":\"es\","
"\"languages\":\"es\","
+ "\"input_languages\":\"es\","
"\"fmt\":\"%N%n%O%n%A%n%Z %C%n%S\","
"\"state_name_type\":\"state\""
"}"));
region_data.insert(std::make_pair("CM", "{"
- "\"name\":\"CAMEROON\""
+ "\"name\":\"CAMEROON\","
+ "\"input_languages\":\"en~fr\""
"}"));
region_data.insert(std::make_pair("CN", "{"
"\"name\":\"P.R. CHINA\","
"\"lang\":\"zh-hans\","
"\"languages\":\"zh-hans\","
+ "\"input_languages\":\"zh\","
"\"fmt\":\"%Z%n%S%C%D%n%A%n%O%n%N\","
+ "\"lfmt\":\"%N%n%O%n%A, %D%n%C%n%S, %Z\","
"\"require\":\"ACSZ\""
"}"));
region_data.insert(std::make_pair("CO", "{"
"\"name\":\"COLOMBIA\","
+ "\"input_languages\":\"es\","
"\"fmt\":\"%N%n%O%n%A%n%C, %S\""
"}"));
region_data.insert(std::make_pair("CR", "{"
"\"name\":\"COSTA RICA\","
+ "\"input_languages\":\"es\","
"\"fmt\":\"%N%n%O%n%A%n%Z %C\""
"}"));
region_data.insert(std::make_pair("CS", "{"
@@ -268,89 +317,110 @@ std::map<std::string, std::string> InitRegionData() {
"\"name\":\"CAPE VERDE\","
"\"lang\":\"pt\","
"\"languages\":\"pt\","
+ "\"input_languages\":\"pt\","
"\"fmt\":\"%N%n%O%n%A%n%Z %C%n%S\","
"\"state_name_type\":\"island\""
"}"));
region_data.insert(std::make_pair("CX", "{"
"\"name\":\"CHRISTMAS ISLAND\","
+ "\"input_languages\":\"en\","
"\"fmt\":\"%O%n%N%n%A%n%C %S %Z\""
"}"));
region_data.insert(std::make_pair("CY", "{"
"\"name\":\"CYPRUS\","
+ "\"input_languages\":\"el~tr\","
"\"fmt\":\"%N%n%O%n%A%n%Z %C\""
"}"));
region_data.insert(std::make_pair("CZ", "{"
"\"name\":\"CZECH REP.\","
+ "\"input_languages\":\"cs\","
"\"fmt\":\"%N%n%O%n%A%n%Z %C\""
"}"));
region_data.insert(std::make_pair("DE", "{"
"\"name\":\"GERMANY\","
+ "\"input_languages\":\"de\","
"\"fmt\":\"%N%n%O%n%A%n%Z %C\","
"\"require\":\"ACZ\""
"}"));
region_data.insert(std::make_pair("DJ", "{"
- "\"name\":\"DJIBOUTI\""
+ "\"name\":\"DJIBOUTI\","
+ "\"input_languages\":\"ar~fr\""
"}"));
region_data.insert(std::make_pair("DK", "{"
"\"name\":\"DENMARK\","
+ "\"input_languages\":\"da\","
"\"fmt\":\"%O%n%N%n%A%n%Z %C\","
"\"require\":\"ACZ\""
"}"));
region_data.insert(std::make_pair("DM", "{"
- "\"name\":\"DOMINICA\""
+ "\"name\":\"DOMINICA\","
+ "\"input_languages\":\"en\""
"}"));
region_data.insert(std::make_pair("DO", "{"
"\"name\":\"DOMINICAN REP.\","
+ "\"input_languages\":\"es\","
"\"fmt\":\"%N%n%O%n%A%n%Z %C\""
"}"));
region_data.insert(std::make_pair("DZ", "{"
"\"name\":\"ALGERIA\","
+ "\"input_languages\":\"ar~fr\","
"\"fmt\":\"%N%n%O%n%A%n%Z %C\""
"}"));
region_data.insert(std::make_pair("EC", "{"
"\"name\":\"ECUADOR\","
+ "\"input_languages\":\"es\","
"\"fmt\":\"%N%n%O%n%A%n%Z%n%C\""
"}"));
region_data.insert(std::make_pair("EE", "{"
"\"name\":\"ESTONIA\","
+ "\"input_languages\":\"et\","
"\"fmt\":\"%N%n%O%n%A%n%Z %C\""
"}"));
region_data.insert(std::make_pair("EG", "{"
"\"name\":\"EGYPT\","
+ "\"input_languages\":\"ar\","
"\"fmt\":\"%N%n%O%n%A%n%C%n%S%n%Z\""
"}"));
region_data.insert(std::make_pair("EH", "{"
- "\"name\":\"WESTERN SAHARA\""
+ "\"name\":\"WESTERN SAHARA\","
+ "\"input_languages\":\"ar\""
"}"));
region_data.insert(std::make_pair("ER", "{"
- "\"name\":\"ERITREA\""
+ "\"name\":\"ERITREA\","
+ "\"input_languages\":\"ar~en~ti\""
"}"));
region_data.insert(std::make_pair("ES", "{"
"\"name\":\"SPAIN\","
"\"lang\":\"es\","
"\"languages\":\"es\","
+ "\"input_languages\":\"es\","
"\"fmt\":\"%N%n%O%n%A%n%Z %C %S\","
"\"require\":\"ACSZ\""
"}"));
region_data.insert(std::make_pair("ET", "{"
"\"name\":\"ETHIOPIA\","
+ "\"input_languages\":\"am\","
"\"fmt\":\"%N%n%O%n%A%n%Z %C\""
"}"));
region_data.insert(std::make_pair("FI", "{"
"\"name\":\"FINLAND\","
+ "\"input_languages\":\"fi~sv\","
"\"fmt\":\"%O%n%N%n%A%nFI-%Z %C\","
"\"require\":\"ACZ\""
"}"));
region_data.insert(std::make_pair("FJ", "{"
- "\"name\":\"FIJI\""
+ "\"name\":\"FIJI\","
+ "\"input_languages\":\"en~fj\""
"}"));
region_data.insert(std::make_pair("FK", "{"
"\"name\":\"FALKLAND ISLANDS (MALVINAS)\","
+ "\"input_languages\":\"en\","
"\"fmt\":\"%N%n%O%n%A%n%X%n%C%n%Z\","
"\"require\":\"ACZ\""
"}"));
region_data.insert(std::make_pair("FM", "{"
"\"name\":\"MICRONESIA (Federated State of)\","
+ "\"input_languages\":\"chk~en~kos~pon~uli~yap\","
"\"fmt\":\"%N%n%O%n%A%n%C %S %Z\","
"\"require\":\"ACSZ\","
"\"zip_name_type\":\"zip\","
@@ -358,69 +428,85 @@ std::map<std::string, std::string> InitRegionData() {
"}"));
region_data.insert(std::make_pair("FO", "{"
"\"name\":\"FAROE ISLANDS\","
+ "\"input_languages\":\"fo\","
"\"fmt\":\"%N%n%O%n%A%nFO%Z %C\""
"}"));
region_data.insert(std::make_pair("FR", "{"
"\"name\":\"FRANCE\","
+ "\"input_languages\":\"fr\","
"\"fmt\":\"%O%n%N%n%A%n%Z %C %X\","
"\"require\":\"ACZ\""
"}"));
region_data.insert(std::make_pair("GA", "{"
- "\"name\":\"GABON\""
+ "\"name\":\"GABON\","
+ "\"input_languages\":\"fr\""
"}"));
region_data.insert(std::make_pair("GB", "{"
"\"name\":\"UNITED KINGDOM\","
+ "\"input_languages\":\"en\","
"\"fmt\":\"%N%n%O%n%A%n%C%n%S%n%Z\","
"\"require\":\"ACZ\","
"\"state_name_type\":\"county\""
"}"));
region_data.insert(std::make_pair("GD", "{"
- "\"name\":\"GRENADA (WEST INDIES)\""
+ "\"name\":\"GRENADA (WEST INDIES)\","
+ "\"input_languages\":\"en\""
"}"));
region_data.insert(std::make_pair("GE", "{"
"\"name\":\"GEORGIA\","
+ "\"input_languages\":\"ka\","
"\"fmt\":\"%N%n%O%n%A%n%Z %C\""
"}"));
region_data.insert(std::make_pair("GF", "{"
"\"name\":\"FRENCH GUIANA\","
+ "\"input_languages\":\"fr\","
"\"fmt\":\"%O%n%N%n%A%n%Z %C %X\","
"\"require\":\"ACZ\""
"}"));
region_data.insert(std::make_pair("GG", "{"
"\"name\":\"CHANNEL ISLANDS\","
+ "\"input_languages\":\"en\","
"\"fmt\":\"%N%n%O%n%A%n%X%n%C%nGUERNSEY%n%Z\","
"\"require\":\"ACZ\""
"}"));
region_data.insert(std::make_pair("GH", "{"
- "\"name\":\"GHANA\""
+ "\"name\":\"GHANA\","
+ "\"input_languages\":\"en\""
"}"));
region_data.insert(std::make_pair("GI", "{"
"\"name\":\"GIBRALTAR\","
+ "\"input_languages\":\"en\","
"\"fmt\":\"%N%n%O%n%A\","
"\"require\":\"A\""
"}"));
region_data.insert(std::make_pair("GL", "{"
"\"name\":\"GREENLAND\","
+ "\"input_languages\":\"da~kl\","
"\"fmt\":\"%N%n%O%n%A%n%Z %C\","
"\"require\":\"ACZ\""
"}"));
region_data.insert(std::make_pair("GM", "{"
- "\"name\":\"GAMBIA\""
+ "\"name\":\"GAMBIA\","
+ "\"input_languages\":\"en\""
"}"));
region_data.insert(std::make_pair("GN", "{"
"\"name\":\"GUINEA\","
+ "\"input_languages\":\"fr\","
"\"fmt\":\"%N%n%O%n%Z %A %C\""
"}"));
region_data.insert(std::make_pair("GP", "{"
"\"name\":\"GUADELOUPE\","
+ "\"input_languages\":\"fr\","
"\"fmt\":\"%O%n%N%n%A%n%Z %C %X\","
"\"require\":\"ACZ\""
"}"));
region_data.insert(std::make_pair("GQ", "{"
- "\"name\":\"EQUATORIAL GUINEA\""
+ "\"name\":\"EQUATORIAL GUINEA\","
+ "\"input_languages\":\"es~fr\""
"}"));
region_data.insert(std::make_pair("GR", "{"
"\"name\":\"GREECE\","
+ "\"input_languages\":\"el\","
"\"fmt\":\"%N%n%O%n%A%n%Z %C\","
"\"require\":\"ACZ\""
"}"));
@@ -431,10 +517,12 @@ std::map<std::string, std::string> InitRegionData() {
"}"));
region_data.insert(std::make_pair("GT", "{"
"\"name\":\"GUATEMALA\","
+ "\"input_languages\":\"es\","
"\"fmt\":\"%N%n%O%n%A%n%Z- %C\""
"}"));
region_data.insert(std::make_pair("GU", "{"
"\"name\":\"GUAM\","
+ "\"input_languages\":\"ch~en\","
"\"fmt\":\"%N%n%O%n%A%n%C %S %Z\","
"\"require\":\"ACSZ\","
"\"zip_name_type\":\"zip\","
@@ -442,16 +530,20 @@ std::map<std::string, std::string> InitRegionData() {
"}"));
region_data.insert(std::make_pair("GW", "{"
"\"name\":\"GUINEA-BISSAU\","
+ "\"input_languages\":\"pt\","
"\"fmt\":\"%N%n%O%n%A%n%Z %C\""
"}"));
region_data.insert(std::make_pair("GY", "{"
- "\"name\":\"GUYANA\""
+ "\"name\":\"GUYANA\","
+ "\"input_languages\":\"en\""
"}"));
region_data.insert(std::make_pair("HK", "{"
"\"name\":\"HONG KONG\","
"\"lang\":\"zh\","
"\"languages\":\"zh\","
+ "\"input_languages\":\"en~zh\","
"\"fmt\":\"%S%n%A%n%O%n%N\","
+ "\"lfmt\":\"%N%n%O%n%A%n%S\","
"\"require\":\"AS\","
"\"state_name_type\":\"area\""
"}"));
@@ -461,38 +553,46 @@ std::map<std::string, std::string> InitRegionData() {
"}"));
region_data.insert(std::make_pair("HN", "{"
"\"name\":\"HONDURAS\","
+ "\"input_languages\":\"es\","
"\"fmt\":\"%N%n%O%n%A%n%C, %S%n%Z\","
"\"require\":\"ACS\""
"}"));
region_data.insert(std::make_pair("HR", "{"
"\"name\":\"CROATIA\","
+ "\"input_languages\":\"hr\","
"\"fmt\":\"%N%n%O%n%A%nHR-%Z %C\""
"}"));
region_data.insert(std::make_pair("HT", "{"
"\"name\":\"HAITI\","
+ "\"input_languages\":\"fr~ht\","
"\"fmt\":\"%N%n%O%n%A%nHT%Z %C %X\""
"}"));
region_data.insert(std::make_pair("HU", "{"
"\"name\":\"HUNGARY (Rep.)\","
+ "\"input_languages\":\"hu\","
"\"fmt\":\"%N%n%O%n%C%n%A%n%Z\""
"}"));
region_data.insert(std::make_pair("ID", "{"
"\"name\":\"INDONESIA\","
+ "\"input_languages\":\"id~su\","
"\"fmt\":\"%N%n%O%n%A%n%C %Z%n%S\""
"}"));
region_data.insert(std::make_pair("IE", "{"
"\"name\":\"IRELAND\","
"\"lang\":\"en\","
"\"languages\":\"en\","
+ "\"input_languages\":\"en~ga\","
"\"fmt\":\"%N%n%O%n%A%n%C%n%S\","
"\"state_name_type\":\"county\""
"}"));
region_data.insert(std::make_pair("IL", "{"
"\"name\":\"ISRAEL\","
+ "\"input_languages\":\"ar~he\","
"\"fmt\":\"%N%n%O%n%A%n%C %Z\""
"}"));
region_data.insert(std::make_pair("IM", "{"
"\"name\":\"ISLE OF MAN\","
+ "\"input_languages\":\"en~gv\","
"\"fmt\":\"%N%n%O%n%A%n%X%n%C%n%Z\","
"\"require\":\"ACZ\""
"}"));
@@ -500,33 +600,39 @@ std::map<std::string, std::string> InitRegionData() {
"\"name\":\"INDIA\","
"\"lang\":\"en\","
"\"languages\":\"en\","
+ "\"input_languages\":\"en~hi\","
"\"fmt\":\"%N%n%O%n%A%n%C %Z%n%S\","
"\"require\":\"ACSZ\","
"\"state_name_type\":\"state\""
"}"));
region_data.insert(std::make_pair("IO", "{"
"\"name\":\"BRITISH INDIAN OCEAN TERRITORY\","
+ "\"input_languages\":\"en\","
"\"fmt\":\"%N%n%O%n%A%n%X%n%C%n%Z\","
"\"require\":\"ACZ\""
"}"));
region_data.insert(std::make_pair("IQ", "{"
"\"name\":\"IRAQ\","
+ "\"input_languages\":\"ar\","
"\"fmt\":\"%O%n%N%n%A%n%C, %S%n%Z\","
"\"require\":\"ACS\""
"}"));
region_data.insert(std::make_pair("IS", "{"
"\"name\":\"ICELAND\","
+ "\"input_languages\":\"is\","
"\"fmt\":\"%N%n%O%n%A%n%Z %C\""
"}"));
region_data.insert(std::make_pair("IT", "{"
"\"name\":\"ITALY\","
"\"lang\":\"it\","
"\"languages\":\"it\","
+ "\"input_languages\":\"it\","
"\"fmt\":\"%N%n%O%n%A%n%Z %C %S\","
"\"require\":\"ACSZ\""
"}"));
region_data.insert(std::make_pair("JE", "{"
"\"name\":\"CHANNEL ISLANDS\","
+ "\"input_languages\":\"en\","
"\"fmt\":\"%N%n%O%n%A%n%X%n%C%nJERSEY%n%Z\","
"\"require\":\"ACZ\""
"}"));
@@ -534,46 +640,56 @@ std::map<std::string, std::string> InitRegionData() {
"\"name\":\"JAMAICA\","
"\"lang\":\"en\","
"\"languages\":\"en\","
+ "\"input_languages\":\"en\","
"\"fmt\":\"%N%n%O%n%A%n%C%n%S %X\","
"\"require\":\"ACS\","
"\"state_name_type\":\"parish\""
"}"));
region_data.insert(std::make_pair("JO", "{"
"\"name\":\"JORDAN\","
+ "\"input_languages\":\"ar\","
"\"fmt\":\"%N%n%O%n%A%n%C %Z\""
"}"));
region_data.insert(std::make_pair("JP", "{"
"\"name\":\"JAPAN\","
"\"lang\":\"ja\","
"\"languages\":\"ja\","
+ "\"input_languages\":\"ja\","
"\"fmt\":\"\xE3\x80\x92%Z%n%S%C%n%A%n%O%n%N\"," // \xE3\x80\x92 is 〒.
+ "\"lfmt\":\"%N%n%O%n%A%n%C, %S%n%Z\","
"\"require\":\"ACSZ\","
"\"state_name_type\":\"prefecture\""
"}"));
region_data.insert(std::make_pair("KE", "{"
"\"name\":\"KENYA\","
+ "\"input_languages\":\"en~sw\","
"\"fmt\":\"%N%n%O%n%A%n%C%n%Z\""
"}"));
region_data.insert(std::make_pair("KG", "{"
"\"name\":\"KYRGYZSTAN\","
+ "\"input_languages\":\"ky~ru\","
"\"fmt\":\"%Z %C %X%n%A%n%O%n%N\""
"}"));
region_data.insert(std::make_pair("KH", "{"
"\"name\":\"CAMBODIA\","
+ "\"input_languages\":\"km\","
"\"fmt\":\"%N%n%O%n%A%n%C %Z\""
"}"));
region_data.insert(std::make_pair("KI", "{"
"\"name\":\"KIRIBATI\","
+ "\"input_languages\":\"en~gil\","
"\"fmt\":\"%N%n%O%n%A%n%S%n%C\","
"\"state_name_type\":\"island\""
"}"));
region_data.insert(std::make_pair("KM", "{"
- "\"name\":\"COMOROS\""
+ "\"name\":\"COMOROS\","
+ "\"input_languages\":\"ar~fr~zdj\""
"}"));
region_data.insert(std::make_pair("KN", "{"
"\"name\":\"SAINT KITTS AND NEVIS\","
"\"lang\":\"en\","
"\"languages\":\"en\","
+ "\"input_languages\":\"en\","
"\"fmt\":\"%N%n%O%n%A%n%C, %S\","
"\"require\":\"ACS\","
"\"state_name_type\":\"island\""
@@ -582,97 +698,120 @@ std::map<std::string, std::string> InitRegionData() {
"\"name\":\"KOREA (REP.)\","
"\"lang\":\"ko\","
"\"languages\":\"ko\","
+ "\"input_languages\":\"ko\","
"\"fmt\":\"%S %C%D%n%A%n%O%n%N%nSEOUL %Z\","
+ "\"lfmt\":\"%N%n%O%n%A%n%D%n%C%n%S%nSEOUL %Z\","
"\"require\":\"ACSZ\","
"\"state_name_type\":\"do_si\""
"}"));
region_data.insert(std::make_pair("KW", "{"
"\"name\":\"KUWAIT\","
+ "\"input_languages\":\"ar\","
"\"fmt\":\"%N%n%O%n%A%n%Z %C\""
"}"));
region_data.insert(std::make_pair("KY", "{"
"\"name\":\"CAYMAN ISLANDS\","
"\"lang\":\"en\","
"\"languages\":\"en\","
+ "\"input_languages\":\"en\","
"\"fmt\":\"%N%n%O%n%A%n%S\","
"\"require\":\"AS\","
"\"state_name_type\":\"island\""
"}"));
region_data.insert(std::make_pair("KZ", "{"
"\"name\":\"KAZAKHSTAN\","
+ "\"input_languages\":\"kk~ru\","
"\"fmt\":\"%Z%n%S%n%C%n%A%n%O%n%N\""
"}"));
region_data.insert(std::make_pair("LA", "{"
"\"name\":\"LAO (PEOPLE'S DEM. REP.)\","
+ "\"input_languages\":\"lo\","
"\"fmt\":\"%N%n%O%n%A%n%Z %C\""
"}"));
region_data.insert(std::make_pair("LB", "{"
"\"name\":\"LEBANON\","
+ "\"input_languages\":\"ar\","
"\"fmt\":\"%N%n%O%n%A%n%C %Z\""
"}"));
region_data.insert(std::make_pair("LC", "{"
- "\"name\":\"SAINT LUCIA\""
+ "\"name\":\"SAINT LUCIA\","
+ "\"input_languages\":\"en\""
"}"));
region_data.insert(std::make_pair("LI", "{"
"\"name\":\"LIECHTENSTEIN\","
+ "\"input_languages\":\"de~gsw\","
"\"fmt\":\"%O%n%N%n%A%nFL-%Z %C\","
"\"require\":\"ACZ\""
"}"));
region_data.insert(std::make_pair("LK", "{"
"\"name\":\"SRI LANKA\","
+ "\"input_languages\":\"si~ta\","
"\"fmt\":\"%N%n%O%n%A%n%C%n%Z\""
"}"));
region_data.insert(std::make_pair("LR", "{"
"\"name\":\"LIBERIA\","
+ "\"input_languages\":\"en\","
"\"fmt\":\"%N%n%O%n%A%n%Z %C %X\""
"}"));
region_data.insert(std::make_pair("LS", "{"
"\"name\":\"LESOTHO\","
+ "\"input_languages\":\"en~st\","
"\"fmt\":\"%N%n%O%n%A%n%C %Z\""
"}"));
region_data.insert(std::make_pair("LT", "{"
"\"name\":\"LITHUANIA\","
+ "\"input_languages\":\"lt\","
"\"fmt\":\"%O%n%N%n%A%nLT-%Z %C\""
"}"));
region_data.insert(std::make_pair("LU", "{"
"\"name\":\"LUXEMBOURG\","
+ "\"input_languages\":\"de~fr~lb\","
"\"fmt\":\"%O%n%N%n%A%nL-%Z %C\","
"\"require\":\"ACZ\""
"}"));
region_data.insert(std::make_pair("LV", "{"
"\"name\":\"LATVIA\","
+ "\"input_languages\":\"lv\","
"\"fmt\":\"%N%n%O%n%A%n%C, %Z\""
"}"));
region_data.insert(std::make_pair("LY", "{"
- "\"name\":\"LIBYA\""
+ "\"name\":\"LIBYA\","
+ "\"input_languages\":\"ar\""
"}"));
region_data.insert(std::make_pair("MA", "{"
"\"name\":\"MOROCCO\","
+ "\"input_languages\":\"ar~fr~tzm\","
"\"fmt\":\"%N%n%O%n%A%n%Z %C\""
"}"));
region_data.insert(std::make_pair("MC", "{"
"\"name\":\"MONACO\","
+ "\"input_languages\":\"fr\","
"\"fmt\":\"%N%n%O%n%A%nMC-%Z %C %X\""
"}"));
region_data.insert(std::make_pair("MD", "{"
"\"name\":\"Rep. MOLDOVA\","
+ "\"input_languages\":\"ro\","
"\"fmt\":\"%N%n%O%n%A%nMD-%Z %C\""
"}"));
region_data.insert(std::make_pair("ME", "{"
"\"name\":\"MONTENEGRO\","
+ "\"input_languages\":\"sr\","
"\"fmt\":\"%N%n%O%n%A%n%Z %C\""
"}"));
region_data.insert(std::make_pair("MF", "{"
"\"name\":\"SAINT MARTIN\","
+ "\"input_languages\":\"fr\","
"\"fmt\":\"%O%n%N%n%A%n%Z %C %X\","
"\"require\":\"ACZ\""
"}"));
region_data.insert(std::make_pair("MG", "{"
"\"name\":\"MADAGASCAR\","
+ "\"input_languages\":\"en~fr~mg\","
"\"fmt\":\"%N%n%O%n%A%n%Z %C\""
"}"));
region_data.insert(std::make_pair("MH", "{"
"\"name\":\"MARSHALL ISLANDS\","
+ "\"input_languages\":\"en~mh\","
"\"fmt\":\"%N%n%O%n%A%n%C %S %Z\","
"\"require\":\"ACSZ\","
"\"zip_name_type\":\"zip\","
@@ -680,24 +819,30 @@ std::map<std::string, std::string> InitRegionData() {
"}"));
region_data.insert(std::make_pair("MK", "{"
"\"name\":\"MACEDONIA\","
+ "\"input_languages\":\"mk~sq\","
"\"fmt\":\"%N%n%O%n%A%n%Z %C\""
"}"));
region_data.insert(std::make_pair("ML", "{"
- "\"name\":\"MALI\""
+ "\"name\":\"MALI\","
+ "\"input_languages\":\"fr\""
"}"));
region_data.insert(std::make_pair("MN", "{"
"\"name\":\"MONGOLIA\","
+ "\"input_languages\":\"mn\","
"\"fmt\":\"%N%n%O%n%A%n%S %C-%X%n%Z\""
"}"));
region_data.insert(std::make_pair("MO", "{"
"\"name\":\"MACAO\","
"\"lang\":\"zh-hant\","
"\"languages\":\"zh-hant\","
+ "\"input_languages\":\"pt~zh\","
"\"fmt\":\"%A%n%O%n%N\","
+ "\"lfmt\":\"%N%n%O%n%A\","
"\"require\":\"A\""
"}"));
region_data.insert(std::make_pair("MP", "{"
"\"name\":\"NORTHERN MARIANA ISLANDS\","
+ "\"input_languages\":\"en\","
"\"fmt\":\"%N%n%O%n%A%n%C %S %Z\","
"\"require\":\"ACSZ\","
"\"zip_name_type\":\"zip\","
@@ -705,35 +850,43 @@ std::map<std::string, std::string> InitRegionData() {
"}"));
region_data.insert(std::make_pair("MQ", "{"
"\"name\":\"MARTINIQUE\","
+ "\"input_languages\":\"fr\","
"\"fmt\":\"%O%n%N%n%A%n%Z %C %X\","
"\"require\":\"ACZ\""
"}"));
region_data.insert(std::make_pair("MR", "{"
- "\"name\":\"MAURITANIA\""
+ "\"name\":\"MAURITANIA\","
+ "\"input_languages\":\"ar\""
"}"));
region_data.insert(std::make_pair("MS", "{"
- "\"name\":\"MONTSERRAT\""
+ "\"name\":\"MONTSERRAT\","
+ "\"input_languages\":\"en\""
"}"));
region_data.insert(std::make_pair("MT", "{"
"\"name\":\"MALTA\","
+ "\"input_languages\":\"en~mt\","
"\"fmt\":\"%N%n%O%n%A%n%C %Z\""
"}"));
region_data.insert(std::make_pair("MU", "{"
"\"name\":\"MAURITIUS\","
+ "\"input_languages\":\"en~fr\","
"\"fmt\":\"%N%n%O%n%A%n%Z%n%C\""
"}"));
region_data.insert(std::make_pair("MV", "{"
"\"name\":\"MALDIVES\","
+ "\"input_languages\":\"dv\","
"\"fmt\":\"%N%n%O%n%A%n%C %Z\""
"}"));
region_data.insert(std::make_pair("MW", "{"
"\"name\":\"MALAWI\","
+ "\"input_languages\":\"en~ny\","
"\"fmt\":\"%N%n%O%n%A%n%C %X\""
"}"));
region_data.insert(std::make_pair("MX", "{"
"\"name\":\"MEXICO\","
"\"lang\":\"es\","
"\"languages\":\"es\","
+ "\"input_languages\":\"es\","
"\"fmt\":\"%N%n%O%n%A%n%Z %C, %S\","
"\"require\":\"ACZ\","
"\"state_name_type\":\"state\""
@@ -742,34 +895,41 @@ std::map<std::string, std::string> InitRegionData() {
"\"name\":\"MALAYSIA\","
"\"lang\":\"ms\","
"\"languages\":\"ms\","
+ "\"input_languages\":\"ms\","
"\"fmt\":\"%N%n%O%n%A%n%Z %C, %S\","
"\"require\":\"ACZ\","
"\"state_name_type\":\"state\""
"}"));
region_data.insert(std::make_pair("MZ", "{"
"\"name\":\"MOZAMBIQUE\","
+ "\"input_languages\":\"pt\","
"\"fmt\":\"%N%n%O%n%A%n%C\""
"}"));
region_data.insert(std::make_pair("NA", "{"
- "\"name\":\"NAMIBIA\""
+ "\"name\":\"NAMIBIA\","
+ "\"input_languages\":\"af~en\""
"}"));
region_data.insert(std::make_pair("NC", "{"
"\"name\":\"NEW CALEDONIA\","
+ "\"input_languages\":\"fr\","
"\"fmt\":\"%O%n%N%n%A%n%Z %C %X\","
"\"require\":\"ACZ\""
"}"));
region_data.insert(std::make_pair("NE", "{"
"\"name\":\"NIGER\","
+ "\"input_languages\":\"fr\","
"\"fmt\":\"%N%n%O%n%A%n%Z %C\""
"}"));
region_data.insert(std::make_pair("NF", "{"
"\"name\":\"NORFOLK ISLAND\","
+ "\"input_languages\":\"en\","
"\"fmt\":\"%O%n%N%n%A%n%C %S %Z\""
"}"));
region_data.insert(std::make_pair("NG", "{"
"\"name\":\"NIGERIA\","
"\"lang\":\"fr\","
"\"languages\":\"fr\","
+ "\"input_languages\":\"efi~en~ha~ig~yo\","
"\"fmt\":\"%N%n%O%n%A%n%C %Z%n%S\","
"\"state_name_type\":\"state\""
"}"));
@@ -777,101 +937,122 @@ std::map<std::string, std::string> InitRegionData() {
"\"name\":\"NICARAGUA\","
"\"lang\":\"es\","
"\"languages\":\"es\","
+ "\"input_languages\":\"es\","
"\"fmt\":\"%N%n%O%n%A%n%Z%n%C, %S\","
"\"state_name_type\":\"department\""
"}"));
region_data.insert(std::make_pair("NL", "{"
"\"name\":\"NETHERLANDS\","
+ "\"input_languages\":\"nl\","
"\"fmt\":\"%O%n%N%n%A%n%Z %C\","
"\"require\":\"ACZ\""
"}"));
region_data.insert(std::make_pair("NO", "{"
"\"name\":\"NORWAY\","
+ "\"input_languages\":\"nb~nn\","
"\"fmt\":\"%N%n%O%n%A%n%Z %C\","
"\"require\":\"ACZ\""
"}"));
region_data.insert(std::make_pair("NP", "{"
"\"name\":\"NEPAL\","
+ "\"input_languages\":\"ne\","
"\"fmt\":\"%N%n%O%n%A%n%C %Z\""
"}"));
region_data.insert(std::make_pair("NR", "{"
"\"name\":\"NAURU CENTRAL PACIFIC\","
"\"lang\":\"en\","
"\"languages\":\"en\","
+ "\"input_languages\":\"en~na\","
"\"fmt\":\"%N%n%O%n%A%n%S\","
"\"require\":\"AS\","
"\"state_name_type\":\"district\""
"}"));
region_data.insert(std::make_pair("NU", "{"
- "\"name\":\"NIUE\""
+ "\"name\":\"NIUE\","
+ "\"input_languages\":\"en~niu\""
"}"));
region_data.insert(std::make_pair("NZ", "{"
"\"name\":\"NEW ZEALAND\","
+ "\"input_languages\":\"en~mi\","
"\"fmt\":\"%N%n%O%n%A%n%C %Z\","
"\"require\":\"ACZ\""
"}"));
region_data.insert(std::make_pair("OM", "{"
"\"name\":\"OMAN\","
+ "\"input_languages\":\"ar\","
"\"fmt\":\"%N%n%O%n%A%n%Z%n%C\""
"}"));
region_data.insert(std::make_pair("PA", "{"
"\"name\":\"PANAMA (REP.)\","
+ "\"input_languages\":\"es\","
"\"fmt\":\"%N%n%O%n%A%n%C%n%S\""
"}"));
region_data.insert(std::make_pair("PE", "{"
- "\"name\":\"PERU\""
+ "\"name\":\"PERU\","
+ "\"input_languages\":\"es~qu\""
"}"));
region_data.insert(std::make_pair("PF", "{"
"\"name\":\"FRENCH POLYNESIA\","
+ "\"input_languages\":\"fr~ty\","
"\"fmt\":\"%N%n%O%n%A%n%Z %C %S\","
"\"require\":\"ACSZ\","
"\"state_name_type\":\"island\""
"}"));
region_data.insert(std::make_pair("PG", "{"
"\"name\":\"PAPUA NEW GUINEA\","
+ "\"input_languages\":\"en~ho~tpi\","
"\"fmt\":\"%N%n%O%n%A%n%C %Z %S\","
"\"require\":\"ACS\""
"}"));
region_data.insert(std::make_pair("PH", "{"
"\"name\":\"PHILIPPINES\","
+ "\"input_languages\":\"en~fil\","
"\"fmt\":\"%N%n%O%n%A%n%Z %C%n%S\","
"\"require\":\"AC\""
"}"));
region_data.insert(std::make_pair("PK", "{"
"\"name\":\"PAKISTAN\","
+ "\"input_languages\":\"en~ur\","
"\"fmt\":\"%N%n%O%n%A%n%C-%Z\""
"}"));
region_data.insert(std::make_pair("PL", "{"
"\"name\":\"POLAND\","
+ "\"input_languages\":\"pl\","
"\"fmt\":\"%N%n%O%n%A%n%Z %C\","
"\"require\":\"ACZ\""
"}"));
region_data.insert(std::make_pair("PM", "{"
"\"name\":\"ST. PIERRE AND MIQUELON\","
+ "\"input_languages\":\"fr\","
"\"fmt\":\"%O%n%N%n%A%n%Z %C %X\","
"\"require\":\"ACZ\""
"}"));
region_data.insert(std::make_pair("PN", "{"
"\"name\":\"PITCAIRN\","
+ "\"input_languages\":\"en\","
"\"fmt\":\"%N%n%O%n%A%n%X%n%C%n%Z\","
"\"require\":\"ACZ\""
"}"));
region_data.insert(std::make_pair("PR", "{"
"\"name\":\"PUERTO RICO\","
+ "\"input_languages\":\"en~es\","
"\"fmt\":\"%N%n%O%n%A%n%C PR %Z\","
"\"require\":\"ACZ\","
"\"zip_name_type\":\"zip\""
"}"));
region_data.insert(std::make_pair("PS", "{"
- "\"name\":\"PALESTINIAN TERRITORY\""
+ "\"name\":\"PALESTINIAN TERRITORY\","
+ "\"input_languages\":\"ar\""
"}"));
region_data.insert(std::make_pair("PT", "{"
"\"name\":\"PORTUGAL\","
+ "\"input_languages\":\"pt\","
"\"fmt\":\"%N%n%O%n%A%n%Z %C\","
"\"require\":\"ACZ\""
"}"));
region_data.insert(std::make_pair("PW", "{"
"\"name\":\"PALAU\","
+ "\"input_languages\":\"en~pau\","
"\"fmt\":\"%N%n%O%n%A%n%C %S %Z\","
"\"require\":\"ACSZ\","
"\"zip_name_type\":\"zip\","
@@ -879,88 +1060,108 @@ std::map<std::string, std::string> InitRegionData() {
"}"));
region_data.insert(std::make_pair("PY", "{"
"\"name\":\"PARAGUAY\","
+ "\"input_languages\":\"es~gn\","
"\"fmt\":\"%N%n%O%n%A%n%Z %C\""
"}"));
region_data.insert(std::make_pair("QA", "{"
- "\"name\":\"QATAR\""
+ "\"name\":\"QATAR\","
+ "\"input_languages\":\"ar\""
"}"));
region_data.insert(std::make_pair("RE", "{"
"\"name\":\"REUNION\","
+ "\"input_languages\":\"fr\","
"\"fmt\":\"%O%n%N%n%A%n%Z %C %X\","
"\"require\":\"ACZ\""
"}"));
region_data.insert(std::make_pair("RO", "{"
"\"name\":\"ROMANIA\","
+ "\"input_languages\":\"ro\","
"\"fmt\":\"%N%n%O%n%A%n%Z %C\""
"}"));
region_data.insert(std::make_pair("RS", "{"
"\"name\":\"REPUBLIC OF SERBIA\","
+ "\"input_languages\":\"sr\","
"\"fmt\":\"%N%n%O%n%A%n%Z %C\""
"}"));
region_data.insert(std::make_pair("RU", "{"
"\"name\":\"RUSSIAN FEDERATION\","
+ "\"input_languages\":\"ru\","
"\"fmt\":\"%Z %C %n%A%n%O%n%N\","
"\"require\":\"ACZ\""
"}"));
region_data.insert(std::make_pair("RW", "{"
- "\"name\":\"RWANDA\""
+ "\"name\":\"RWANDA\","
+ "\"input_languages\":\"en~fr~rw\""
"}"));
region_data.insert(std::make_pair("SA", "{"
"\"name\":\"SAUDI ARABIA\","
+ "\"input_languages\":\"ar\","
"\"fmt\":\"%N%n%O%n%A%n%C %Z\""
"}"));
region_data.insert(std::make_pair("SB", "{"
- "\"name\":\"SOLOMON ISLANDS\""
+ "\"name\":\"SOLOMON ISLANDS\","
+ "\"input_languages\":\"en\""
"}"));
region_data.insert(std::make_pair("SC", "{"
"\"name\":\"SEYCHELLES\","
+ "\"input_languages\":\"en~fr\","
"\"fmt\":\"%N%n%O%n%A%n%C%n%S\","
"\"state_name_type\":\"island\""
"}"));
region_data.insert(std::make_pair("SE", "{"
"\"name\":\"SWEDEN\","
+ "\"input_languages\":\"sv\","
"\"fmt\":\"%O%n%N%n%A%nSE-%Z %C\","
"\"require\":\"ACZ\""
"}"));
region_data.insert(std::make_pair("SG", "{"
"\"name\":\"REP. OF SINGAPORE\","
+ "\"input_languages\":\"en~ms~ta~zh\","
"\"fmt\":\"%N%n%O%n%A%nSINGAPORE %Z\","
"\"require\":\"AZ\""
"}"));
region_data.insert(std::make_pair("SH", "{"
"\"name\":\"SAINT HELENA\","
+ "\"input_languages\":\"en\","
"\"fmt\":\"%N%n%O%n%A%n%X%n%C%n%Z\","
"\"require\":\"ACZ\""
"}"));
region_data.insert(std::make_pair("SI", "{"
"\"name\":\"SLOVENIA\","
+ "\"input_languages\":\"sl\","
"\"fmt\":\"%N%n%O%n%A%nSI- %Z %C\""
"}"));
region_data.insert(std::make_pair("SJ", "{"
"\"name\":\"SVALBARD AND JAN MAYEN ISLANDS\","
+ "\"input_languages\":\"nb\","
"\"fmt\":\"%N%n%O%n%A%n%Z %C\","
"\"require\":\"ACZ\""
"}"));
region_data.insert(std::make_pair("SK", "{"
"\"name\":\"SLOVAKIA\","
+ "\"input_languages\":\"sk\","
"\"fmt\":\"%N%n%O%n%A%n%Z %C\""
"}"));
region_data.insert(std::make_pair("SL", "{"
- "\"name\":\"SIERRA LEONE\""
+ "\"name\":\"SIERRA LEONE\","
+ "\"input_languages\":\"en\""
"}"));
region_data.insert(std::make_pair("SM", "{"
"\"name\":\"SAN MARINO\","
+ "\"input_languages\":\"it\","
"\"fmt\":\"%N%n%O%n%A%n%Z %C\","
"\"require\":\"AZ\""
"}"));
region_data.insert(std::make_pair("SN", "{"
"\"name\":\"SENEGAL\","
+ "\"input_languages\":\"fr~wo\","
"\"fmt\":\"%N%n%O%n%A%n%Z %C\""
"}"));
region_data.insert(std::make_pair("SO", "{"
"\"name\":\"SOMALIA\","
"\"lang\":\"so\","
"\"languages\":\"so\","
+ "\"input_languages\":\"ar~so\","
"\"fmt\":\"%N%n%O%n%A%n%C, %S %Z\","
"\"require\":\"ACS\""
"}"));
@@ -968,76 +1169,94 @@ std::map<std::string, std::string> InitRegionData() {
"\"name\":\"SURINAME\","
"\"lang\":\"nl\","
"\"languages\":\"nl\","
+ "\"input_languages\":\"nl\","
"\"fmt\":\"%N%n%O%n%A%n%C %X%n%S\""
"}"));
region_data.insert(std::make_pair("ST", "{"
"\"name\":\"SAO TOME AND PRINCIPE\","
+ "\"input_languages\":\"pt\","
"\"fmt\":\"%N%n%O%n%A%n%C %X\""
"}"));
region_data.insert(std::make_pair("SV", "{"
"\"name\":\"EL SALVADOR\","
"\"lang\":\"es\","
"\"languages\":\"es\","
+ "\"input_languages\":\"es\","
"\"fmt\":\"%N%n%O%n%A%n%Z-%C%n%S\","
"\"require\":\"ACS\""
"}"));
region_data.insert(std::make_pair("SZ", "{"
"\"name\":\"SWAZILAND\","
+ "\"input_languages\":\"en~ss\","
"\"fmt\":\"%N%n%O%n%A%n%C%n%Z\""
"}"));
region_data.insert(std::make_pair("TC", "{"
"\"name\":\"TURKS AND CAICOS ISLANDS\","
+ "\"input_languages\":\"en\","
"\"fmt\":\"%N%n%O%n%A%n%X%n%C%n%Z\","
"\"require\":\"ACZ\""
"}"));
region_data.insert(std::make_pair("TD", "{"
- "\"name\":\"CHAD\""
+ "\"name\":\"CHAD\","
+ "\"input_languages\":\"ar~fr\""
"}"));
region_data.insert(std::make_pair("TF", "{"
"\"name\":\"FRENCH SOUTHERN TERRITORIES\""
"}"));
region_data.insert(std::make_pair("TG", "{"
- "\"name\":\"TOGO\""
+ "\"name\":\"TOGO\","
+ "\"input_languages\":\"fr\""
"}"));
region_data.insert(std::make_pair("TH", "{"
"\"name\":\"THAILAND\","
"\"lang\":\"th\","
"\"languages\":\"th\","
- "\"fmt\":\"%N%n%O%n%A%n%C%n%S %Z\""
+ "\"input_languages\":\"th\","
+ "\"fmt\":\"%N%n%O%n%A%n%C%n%S %Z\","
+ "\"lfmt\":\"%N%n%O%n%A%n%C%n%S %Z\""
"}"));
region_data.insert(std::make_pair("TJ", "{"
"\"name\":\"TAJIKISTAN\","
+ "\"input_languages\":\"tg\","
"\"fmt\":\"%N%n%O%n%A%n%Z %C\""
"}"));
region_data.insert(std::make_pair("TK", "{"
- "\"name\":\"TOKELAU\""
+ "\"name\":\"TOKELAU\","
+ "\"input_languages\":\"en~tkl\""
"}"));
region_data.insert(std::make_pair("TL", "{"
- "\"name\":\"TIMOR-LESTE\""
+ "\"name\":\"TIMOR-LESTE\","
+ "\"input_languages\":\"pt~tet\""
"}"));
region_data.insert(std::make_pair("TM", "{"
"\"name\":\"TURKMENISTAN\","
+ "\"input_languages\":\"tk\","
"\"fmt\":\"%N%n%O%n%A%n%Z %C\""
"}"));
region_data.insert(std::make_pair("TN", "{"
"\"name\":\"TUNISIA\","
+ "\"input_languages\":\"ar~fr\","
"\"fmt\":\"%N%n%O%n%A%n%Z %C\""
"}"));
region_data.insert(std::make_pair("TO", "{"
- "\"name\":\"TONGA\""
+ "\"name\":\"TONGA\","
+ "\"input_languages\":\"en~to\""
"}"));
region_data.insert(std::make_pair("TR", "{"
"\"name\":\"TURKEY\","
+ "\"input_languages\":\"tr\","
"\"fmt\":\"%N%n%O%n%A%n%Z %C/%S\","
"\"require\":\"ACZ\""
"}"));
region_data.insert(std::make_pair("TT", "{"
- "\"name\":\"TRINIDAD AND TOBAGO\""
+ "\"name\":\"TRINIDAD AND TOBAGO\","
+ "\"input_languages\":\"en\""
"}"));
region_data.insert(std::make_pair("TV", "{"
"\"name\":\"TUVALU\","
"\"lang\":\"tyv\","
"\"languages\":\"tyv\","
+ "\"input_languages\":\"en~tvl\","
"\"fmt\":\"%N%n%O%n%A%n%X%n%C%n%S\","
"\"state_name_type\":\"island\""
"}"));
@@ -1045,24 +1264,30 @@ std::map<std::string, std::string> InitRegionData() {
"\"name\":\"TAIWAN\","
"\"lang\":\"zh-hant\","
"\"languages\":\"zh-hant\","
+ "\"input_languages\":\"zh\","
"\"fmt\":\"%Z%n%S%C%n%A%n%O%n%N\","
+ "\"lfmt\":\"%N%n%O%n%A%n%C, %S %Z\","
"\"require\":\"ACSZ\","
"\"state_name_type\":\"county\""
"}"));
region_data.insert(std::make_pair("TZ", "{"
- "\"name\":\"TANZANIA (UNITED REP.)\""
+ "\"name\":\"TANZANIA (UNITED REP.)\","
+ "\"input_languages\":\"en~sw\""
"}"));
region_data.insert(std::make_pair("UA", "{"
"\"name\":\"UKRAINE\","
+ "\"input_languages\":\"ru~uk\","
"\"fmt\":\"%Z %C%n%A%n%O%n%N\""
"}"));
region_data.insert(std::make_pair("UG", "{"
- "\"name\":\"UGANDA\""
+ "\"name\":\"UGANDA\","
+ "\"input_languages\":\"en~sw\""
"}"));
// NOTE: The fmt value for UM and US differs from the i18napis fmt by the
// insertion of a comma separating city and state.
region_data.insert(std::make_pair("UM", "{"
"\"name\":\"UNITED STATES MINOR OUTLYING ISLANDS\","
+ "\"input_languages\":\"en\","
"\"fmt\":\"%N%n%O%n%A%n%C, %S %Z\","
"\"require\":\"ACS\","
"\"zip_name_type\":\"zip\","
@@ -1072,6 +1297,7 @@ std::map<std::string, std::string> InitRegionData() {
"\"name\":\"UNITED STATES\","
"\"lang\":\"en\","
"\"languages\":\"en\","
+ "\"input_languages\":\"en\","
"\"fmt\":\"%N%n%O%n%A%n%C, %S %Z\","
"\"require\":\"ACSZ\","
"\"zip_name_type\":\"zip\","
@@ -1081,32 +1307,39 @@ std::map<std::string, std::string> InitRegionData() {
"\"name\":\"URUGUAY\","
"\"lang\":\"es\","
"\"languages\":\"es\","
+ "\"input_languages\":\"es\","
"\"fmt\":\"%N%n%O%n%A%n%Z %C %S\""
"}"));
region_data.insert(std::make_pair("UZ", "{"
"\"name\":\"UZBEKISTAN\","
+ "\"input_languages\":\"uz\","
"\"fmt\":\"%N%n%O%n%A%n%Z %C%n%S\""
"}"));
region_data.insert(std::make_pair("VA", "{"
"\"name\":\"VATICAN\","
+ "\"input_languages\":\"la\","
"\"fmt\":\"%N%n%O%n%A%n%Z %C\""
"}"));
region_data.insert(std::make_pair("VC", "{"
- "\"name\":\"SAINT VINCENT AND THE GRENADINES (ANTILLES)\""
+ "\"name\":\"SAINT VINCENT AND THE GRENADINES (ANTILLES)\","
+ "\"input_languages\":\"en\""
"}"));
region_data.insert(std::make_pair("VE", "{"
"\"name\":\"VENEZUELA\","
"\"lang\":\"es\","
"\"languages\":\"es\","
+ "\"input_languages\":\"es\","
"\"fmt\":\"%N%n%O%n%A%n%C %Z, %S\","
"\"require\":\"ACS\""
"}"));
region_data.insert(std::make_pair("VG", "{"
"\"name\":\"VIRGIN ISLANDS (BRITISH)\","
+ "\"input_languages\":\"en\","
"\"require\":\"A\""
"}"));
region_data.insert(std::make_pair("VI", "{"
"\"name\":\"VIRGIN ISLANDS (U.S.)\","
+ "\"input_languages\":\"en\","
"\"fmt\":\"%N%n%O%n%A%n%C %S %Z\","
"\"require\":\"ACSZ\","
"\"zip_name_type\":\"zip\","
@@ -1116,41 +1349,51 @@ std::map<std::string, std::string> InitRegionData() {
"\"name\":\"VIET NAM\","
"\"lang\":\"vi\","
"\"languages\":\"vi\","
+ "\"input_languages\":\"vi\","
"\"fmt\":\"%N%n%O%n%A%n%C%n%S\","
+ "\"lfmt\":\"%N%n%O%n%A%n%C%n%S\","
"\"require\":\"AC\""
"}"));
region_data.insert(std::make_pair("VU", "{"
- "\"name\":\"VANUATU\""
+ "\"name\":\"VANUATU\","
+ "\"input_languages\":\"bi~en~fr\""
"}"));
region_data.insert(std::make_pair("WF", "{"
"\"name\":\"WALLIS AND FUTUNA ISLANDS\","
+ "\"input_languages\":\"fr\","
"\"fmt\":\"%O%n%N%n%A%n%Z %C %X\","
"\"require\":\"ACZ\""
"}"));
region_data.insert(std::make_pair("WS", "{"
- "\"name\":\"SAMOA\""
+ "\"name\":\"SAMOA\","
+ "\"input_languages\":\"en~sm\""
"}"));
region_data.insert(std::make_pair("YE", "{"
"\"name\":\"YEMEN\","
+ "\"input_languages\":\"ar\","
"\"require\":\"AC\""
"}"));
region_data.insert(std::make_pair("YT", "{"
"\"name\":\"MAYOTTE\","
+ "\"input_languages\":\"fr\","
"\"fmt\":\"%O%n%N%n%A%n%Z %C %X\","
"\"require\":\"ACZ\""
"}"));
region_data.insert(std::make_pair("ZA", "{"
"\"name\":\"SOUTH AFRICA\","
+ "\"input_languages\":\"af~en~nr~nso~ss~st~tn~ts~ve~xh~zu\","
"\"fmt\":\"%N%n%O%n%A%n%C%n%Z\","
"\"require\":\"ACZ\""
"}"));
region_data.insert(std::make_pair("ZM", "{"
"\"name\":\"ZAMBIA\","
+ "\"input_languages\":\"en\","
"\"fmt\":\"%N%n%O%n%A%n%Z %C\","
"\"require\":\"AC\""
"}"));
region_data.insert(std::make_pair("ZW", "{"
- "\"name\":\"ZIMBABWE\""
+ "\"name\":\"ZIMBABWE\","
+ "\"input_languages\":\"en~nd~sn\""
"}"));
return region_data;
}
diff --git a/third_party/libaddressinput/chromium/cpp/src/retriever.cc b/third_party/libaddressinput/chromium/cpp/src/retriever.cc
index 7722ef2..90dfc24 100644
--- a/third_party/libaddressinput/chromium/cpp/src/retriever.cc
+++ b/third_party/libaddressinput/chromium/cpp/src/retriever.cc
@@ -28,9 +28,9 @@
#include <string>
#include "fallback_data_store.h"
-#include "time_to_string.h"
#include "util/md5.h"
#include "util/stl_util.h"
+#include "util/string_util.h"
namespace i18n {
namespace addressinput {
diff --git a/third_party/libaddressinput/chromium/cpp/src/rule.cc b/third_party/libaddressinput/chromium/cpp/src/rule.cc
index a94e44d..791ac9e 100644
--- a/third_party/libaddressinput/chromium/cpp/src/rule.cc
+++ b/third_party/libaddressinput/chromium/cpp/src/rule.cc
@@ -26,8 +26,7 @@
#include "grit/libaddressinput_strings.h"
#include "region_data_constants.h"
#include "util/json.h"
-#include "util/string_compare.h"
-#include "util/string_split.h"
+#include "util/string_util.h"
namespace i18n {
namespace addressinput {
@@ -219,11 +218,13 @@ Rule::Rule()
name_(),
latin_name_(),
format_(),
+ latin_format_(),
required_(),
sub_keys_(),
sub_names_(),
sub_lnames_(),
languages_(),
+ input_languages_(),
language_(),
postal_code_format_(),
admin_area_name_message_id_(INVALID_MESSAGE_ID),
@@ -250,9 +251,11 @@ void Rule::CopyFrom(const Rule& rule) {
name_ = rule.name_;
latin_name_ = rule.latin_name_;
format_ = rule.format_;
+ latin_format_ = rule.latin_format_;
required_ = rule.required_;
sub_keys_ = rule.sub_keys_;
languages_ = rule.languages_;
+ input_languages_ = rule.input_languages_;
language_ = rule.language_;
sub_keys_ = rule.sub_keys_;
sub_names_ = rule.sub_names_;
@@ -291,6 +294,10 @@ void Rule::ParseJsonRule(const Json& json_rule) {
ParseAddressFieldsFormat(value, &format_);
}
+ if (json_rule.GetStringValueForKey("lfmt", &value)) {
+ ParseAddressFieldsFormat(value, &latin_format_);
+ }
+
if (json_rule.GetStringValueForKey("require", &value)) {
ParseAddressFieldsRequired(value, &required_);
}
@@ -316,6 +323,10 @@ void Rule::ParseJsonRule(const Json& json_rule) {
SplitString(value, kSeparator, &languages_);
}
+ if (json_rule.GetStringValueForKey("input_languages", &value)) {
+ SplitString(value, kSeparator, &input_languages_);
+ }
+
if (json_rule.GetStringValueForKey("lang", &value)) {
language_.swap(value);
}
diff --git a/third_party/libaddressinput/chromium/cpp/src/rule.h b/third_party/libaddressinput/chromium/cpp/src/rule.h
index 80cc830..cc0a3d7 100644
--- a/third_party/libaddressinput/chromium/cpp/src/rule.h
+++ b/third_party/libaddressinput/chromium/cpp/src/rule.h
@@ -108,6 +108,12 @@ class Rule {
return format_;
}
+ // Returns the latinized format of the address as it should appear on an
+ // envelope.
+ const std::vector<std::vector<FormatElement> >& GetLatinFormat() const {
+ return latin_format_;
+ }
+
// Returns the required fields for this rule.
const std::vector<AddressField>& GetRequired() const { return required_; }
@@ -121,6 +127,12 @@ class Rule {
// example ["de", "fr", "it"].
const std::vector<std::string>& GetLanguages() const { return languages_; }
+ // Returns all of the languages codes for addresses that adhere to this rule,
+ // for example ["de", "fr", "gsw", "it"].
+ const std::vector<std::string>& GetInputLanguages() const {
+ return input_languages_;
+ }
+
// Returns the language code of this rule, for example "de".
const std::string& GetLanguage() const { return language_; }
@@ -168,12 +180,14 @@ class Rule {
std::string name_;
std::string latin_name_;
std::vector<std::vector<FormatElement> > format_;
+ std::vector<std::vector<FormatElement> > latin_format_;
std::vector<AddressField> required_;
std::vector<std::string> sub_keys_;
std::vector<std::string> sub_names_;
// The Latin names (when |sub_names_| is not in Latin characters).
std::vector<std::string> sub_lnames_;
std::vector<std::string> languages_;
+ std::vector<std::string> input_languages_;
std::string language_;
std::string postal_code_format_;
int admin_area_name_message_id_;
diff --git a/third_party/libaddressinput/chromium/cpp/src/time_to_string.cc b/third_party/libaddressinput/chromium/cpp/src/time_to_string.cc
deleted file mode 100644
index f1c2097..0000000
--- a/third_party/libaddressinput/chromium/cpp/src/time_to_string.cc
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright (C) 2014 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "time_to_string.h"
-
-#include <cstdio>
-#include <ctime>
-#include <string>
-
-#ifdef _MSC_VER
-// http://msdn.microsoft.com/en-us/library/2ts7cx93%28v=vs.110%29.aspx
-#define snprintf _snprintf
-#endif // _MSC_VER
-
-namespace i18n {
-namespace addressinput {
-
-std::string TimeToString(time_t time) {
- char time_string[2 + 3 * sizeof time];
- snprintf(time_string, sizeof time_string, "%ld", time);
- return time_string;
-}
-
-} // namespace addressinput
-} // namespace i18n
diff --git a/third_party/libaddressinput/chromium/cpp/src/time_to_string.h b/third_party/libaddressinput/chromium/cpp/src/time_to_string.h
deleted file mode 100644
index ccd7ad9..0000000
--- a/third_party/libaddressinput/chromium/cpp/src/time_to_string.h
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright (C) 2014 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef I18N_ADDRESSINPUT_TIME_TO_STRING_H_
-#define I18N_ADDRESSINPUT_TIME_TO_STRING_H_
-
-#include <ctime>
-#include <string>
-
-namespace i18n {
-namespace addressinput {
-
-// Returns |time| serialized into a string.
-std::string TimeToString(time_t time);
-
-} // namespace addressinput
-} // namespace i18n
-
-#endif // I18N_ADDRESSINPUT_TIME_TO_STRING_H_
diff --git a/third_party/libaddressinput/chromium/cpp/src/util/string_compare.cc b/third_party/libaddressinput/chromium/cpp/src/util/string_compare.cc
deleted file mode 100644
index d5f6a18..0000000
--- a/third_party/libaddressinput/chromium/cpp/src/util/string_compare.cc
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright (C) 2014 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "string_compare.h"
-
-#include <libaddressinput/util/scoped_ptr.h>
-
-#include "canonicalize_string.h"
-
-namespace i18n {
-namespace addressinput {
-
-bool LooseStringCompare(const std::string& a, const std::string& b) {
- scoped_ptr<StringCanonicalizer> canonicalizer(StringCanonicalizer::Build());
- return canonicalizer->CanonicalizeString(a) ==
- canonicalizer->CanonicalizeString(b);
-}
-
-} // namespace addressinput
-} // namespace i18n
diff --git a/third_party/libaddressinput/chromium/cpp/src/util/string_compare.h b/third_party/libaddressinput/chromium/cpp/src/util/string_compare.h
deleted file mode 100644
index 4e0ecf7..0000000
--- a/third_party/libaddressinput/chromium/cpp/src/util/string_compare.h
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright (C) 2014 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef I18N_ADDRESSINPUT_UTIL_STRING_COMPARE_H_
-#define I18N_ADDRESSINPUT_UTIL_STRING_COMPARE_H_
-
-#include <string>
-
-namespace i18n {
-namespace addressinput {
-
-// Unicode (UTF-8) approximate string comparison. Designed for matching user
-// input against canonical data. Returns true for a match.
-bool LooseStringCompare(const std::string& a, const std::string& b);
-
-} // namespace addressinput
-} // namespace i18n
-
-#endif // I18N_ADDRESSINPUT_UTIL_STRING_COMPARE_H_
diff --git a/third_party/libaddressinput/chromium/cpp/src/util/string_split.cc b/third_party/libaddressinput/chromium/cpp/src/util/string_split.cc
deleted file mode 100644
index 114cd92..0000000
--- a/third_party/libaddressinput/chromium/cpp/src/util/string_split.cc
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-// The original source code is from:
-// http://src.chromium.org/viewvc/chrome/trunk/src/base/strings/string_split.cc?revision=216633
-
-#include "string_split.h"
-
-#include <cassert>
-#include <cstddef>
-#include <string>
-#include <vector>
-
-namespace i18n {
-namespace addressinput {
-
-void SplitString(const std::string& str, char s, std::vector<std::string>* r) {
- assert(r != NULL);
- r->clear();
- size_t last = 0;
- size_t c = str.size();
- for (size_t i = 0; i <= c; ++i) {
- if (i == c || str[i] == s) {
- std::string tmp(str, last, i - last);
- // Avoid converting an empty or all-whitespace source string into a vector
- // of one empty string.
- if (i != c || !r->empty() || !tmp.empty()) {
- r->push_back(tmp);
- }
- last = i + 1;
- }
- }
-}
-
-} // namespace addressinput
-} // namespace i18n
diff --git a/third_party/libaddressinput/chromium/cpp/src/util/string_split.h b/third_party/libaddressinput/chromium/cpp/src/util/string_split.h
deleted file mode 100644
index 6809296..0000000
--- a/third_party/libaddressinput/chromium/cpp/src/util/string_split.h
+++ /dev/null
@@ -1,34 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-// The original source code is from:
-// http://src.chromium.org/viewvc/chrome/trunk/src/base/strings/string_split.h?revision=236210
-//
-// Modifications from original:
-// 1) Supports only std::string type.
-// 2) Does not trim whitespace.
-
-#ifndef I18N_ADDRESSINPUT_UTIL_STRING_SPLIT_H_
-#define I18N_ADDRESSINPUT_UTIL_STRING_SPLIT_H_
-
-#include <string>
-#include <vector>
-
-namespace i18n {
-namespace addressinput {
-
-// Splits |str| into a vector of strings delimited by |c|, placing the results
-// in |r|. If several instances of |c| are contiguous, or if |str| begins with
-// or ends with |c|, then an empty string is inserted.
-//
-// |str| should not be in a multi-byte encoding like Shift-JIS or GBK in which
-// the trailing byte of a multi-byte character can be in the ASCII range.
-// UTF-8, and other single/multi-byte ASCII-compatible encodings are OK.
-// Note: |c| must be in the ASCII range.
-void SplitString(const std::string& str, char c, std::vector<std::string>* r);
-
-} // namespace addressinput
-} // namespace i18n
-
-#endif // I18N_ADDRESSINPUT_UTIL_STRING_SPLIT_H_
diff --git a/third_party/libaddressinput/chromium/cpp/src/util/string_util.cc b/third_party/libaddressinput/chromium/cpp/src/util/string_util.cc
new file mode 100644
index 0000000..ac10b10
--- /dev/null
+++ b/third_party/libaddressinput/chromium/cpp/src/util/string_util.cc
@@ -0,0 +1,80 @@
+// Copyright (C) 2014 Google Inc.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#include "string_util.h"
+
+#include <libaddressinput/util/scoped_ptr.h>
+
+#include <cassert>
+#include <cstddef>
+#include <cstdio>
+#include <ctime>
+#include <string>
+#include <vector>
+
+#include "canonicalize_string.h"
+
+#ifdef _MSC_VER
+// http://msdn.microsoft.com/en-us/library/2ts7cx93%28v=vs.110%29.aspx
+#define snprintf _snprintf
+#endif // _MSC_VER
+
+namespace i18n {
+namespace addressinput {
+
+std::string NormalizeLanguageCode(const std::string& language_code) {
+ std::string::size_type pos = language_code.find('-');
+ if (pos == std::string::npos) {
+ return language_code;
+ }
+ if (language_code.substr(pos) == "-latn") {
+ return language_code;
+ }
+ return language_code.substr(0, pos);
+}
+
+std::string TimeToString(time_t time) {
+ char time_string[2 + 3 * sizeof time];
+ snprintf(time_string, sizeof time_string, "%ld", time);
+ return time_string;
+}
+
+bool LooseStringCompare(const std::string& a, const std::string& b) {
+ scoped_ptr<StringCanonicalizer> canonicalizer(StringCanonicalizer::Build());
+ return canonicalizer->CanonicalizeString(a) ==
+ canonicalizer->CanonicalizeString(b);
+}
+
+// The original source code is from:
+// http://src.chromium.org/viewvc/chrome/trunk/src/base/strings/string_split.cc?revision=216633
+void SplitString(const std::string& str, char s, std::vector<std::string>* r) {
+ assert(r != NULL);
+ r->clear();
+ size_t last = 0;
+ size_t c = str.size();
+ for (size_t i = 0; i <= c; ++i) {
+ if (i == c || str[i] == s) {
+ std::string tmp(str, last, i - last);
+ // Avoid converting an empty or all-whitespace source string into a vector
+ // of one empty string.
+ if (i != c || !r->empty() || !tmp.empty()) {
+ r->push_back(tmp);
+ }
+ last = i + 1;
+ }
+ }
+}
+
+} // namespace addressinput
+} // namespace i18n
diff --git a/third_party/libaddressinput/chromium/cpp/src/util/string_util.h b/third_party/libaddressinput/chromium/cpp/src/util/string_util.h
new file mode 100644
index 0000000..7ebc630
--- /dev/null
+++ b/third_party/libaddressinput/chromium/cpp/src/util/string_util.h
@@ -0,0 +1,56 @@
+// Copyright (C) 2014 Google Inc.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef I18N_ADDRESSINPUT_UTIL_STRING_UTIL_H_
+#define I18N_ADDRESSINPUT_UTIL_STRING_UTIL_H_
+
+#include <string>
+#include <vector>
+
+namespace i18n {
+namespace addressinput {
+
+// Removes the language variation from |language_code|, unless the variation is
+// "latn". For example, returns "zh" for "zh-hans". Returns "zh-latn" for
+// "zh-latn".
+std::string NormalizeLanguageCode(const std::string& language_code);
+
+// Returns |time| serialized into a string.
+std::string TimeToString(time_t time);
+
+// Unicode (UTF-8) approximate string comparison. Designed for matching user
+// input against canonical data. Returns true for a match.
+bool LooseStringCompare(const std::string& a, const std::string& b);
+
+// Splits |str| into a vector of strings delimited by |c|, placing the results
+// in |r|. If several instances of |c| are contiguous, or if |str| begins with
+// or ends with |c|, then an empty string is inserted.
+//
+// |str| should not be in a multi-byte encoding like Shift-JIS or GBK in which
+// the trailing byte of a multi-byte character can be in the ASCII range.
+// UTF-8, and other single/multi-byte ASCII-compatible encodings are OK.
+// Note: |c| must be in the ASCII range.
+//
+// The original source code is from:
+// http://src.chromium.org/viewvc/chrome/trunk/src/base/strings/string_split.h?revision=236210
+//
+// Modifications from original:
+// 1) Supports only std::string type.
+// 2) Does not trim whitespace.
+void SplitString(const std::string& str, char c, std::vector<std::string>* r);
+
+} // namespace addressinput
+} // namespace i18n
+
+#endif // I18N_ADDRESSINPUT_UTIL_STRING_UTIL_H_
diff --git a/third_party/libaddressinput/chromium/cpp/test/address_data_test.cc b/third_party/libaddressinput/chromium/cpp/test/address_data_test.cc
index a4d61c3..26659fa 100644
--- a/third_party/libaddressinput/chromium/cpp/test/address_data_test.cc
+++ b/third_party/libaddressinput/chromium/cpp/test/address_data_test.cc
@@ -85,6 +85,7 @@ TEST(AddressDataTest, FormatForDisplayAr) {
TEST(AddressDataTest, FormatForDisplayJp) {
AddressData address;
address.country_code = "JP";
+ address.language_code = "ja";
address.administrative_area = "東京都";
address.locality = "渋谷区";
address.postal_code = "150-8512";
@@ -108,6 +109,33 @@ TEST(AddressDataTest, FormatForDisplayJp) {
EXPECT_EQ(expected, actual);
}
+TEST(AddressDataTest, FormatForDisplayJpLatn) {
+ AddressData address;
+ address.country_code = "JP";
+ address.language_code = "ja-latn";
+ address.administrative_area = "Tokyo";
+ address.locality = "Shibuya-ku";
+ address.postal_code = "150-8512";
+ address.address_lines.push_back("26-1 Sakuragaoka-cho");
+ address.address_lines.push_back("Cerulean Tower 6F");
+ address.organization = "Google Japan Inc.";
+ address.recipient = "Miki Murakami";
+
+ std::vector<std::string> actual;
+ address.FormatForDisplay(&actual);
+
+ std::vector<std::string> expected;
+ expected.push_back(address.recipient);
+ expected.push_back(address.organization);
+ expected.insert(expected.end(),
+ address.address_lines.begin(),
+ address.address_lines.end());
+ expected.push_back(address.locality + ", "+ address.administrative_area);
+ expected.push_back(address.postal_code);
+
+ EXPECT_EQ(expected, actual);
+}
+
TEST(AddressDataTest, FormatForDisplayWithStreetCi) {
AddressData address;
address.country_code = "CI";
diff --git a/third_party/libaddressinput/chromium/cpp/test/address_ui_test.cc b/third_party/libaddressinput/chromium/cpp/test/address_ui_test.cc
index 8fa508a..dadd8e7 100644
--- a/third_party/libaddressinput/chromium/cpp/test/address_ui_test.cc
+++ b/third_party/libaddressinput/chromium/cpp/test/address_ui_test.cc
@@ -75,7 +75,8 @@ TEST(AddressUiTest, RegionsAndComponentsAreValid) {
for (size_t i = 0; i < region_codes.size(); ++i) {
SCOPED_TRACE("Region code: " + region_codes[i]);
EXPECT_EQ(2U, region_codes[i].size());
- EXPECT_TRUE(ComponentsAreValid(BuildComponents(region_codes[i])));
+ EXPECT_TRUE(ComponentsAreValid(
+ BuildComponents(region_codes[i], std::string(), NULL)));
EXPECT_FALSE(GetRequiredFields(region_codes[i]).empty());
}
}
@@ -83,7 +84,8 @@ TEST(AddressUiTest, RegionsAndComponentsAreValid) {
// Verifies that BuildComponents() and GetRequiredFields() return an empty
// vector for an invalid region code.
TEST(AddressUiTest, InvalidRegionCodeReturnsEmptyVector) {
- EXPECT_TRUE(BuildComponents("INVALID-REGION-CODE").empty());
+ EXPECT_TRUE(
+ BuildComponents("INVALID-REGION-CODE", std::string(), NULL).empty());
EXPECT_TRUE(GetRequiredFields("INVALID-REGION-CODE").empty());
}
@@ -119,6 +121,53 @@ INSTANTIATE_TEST_CASE_P(
SeparatorData("th", " "),
SeparatorData("en", ", ")));
+TEST(AddressUiTest, ComponentLanguageCodeTest) {
+ static const struct LanguageCodeData {
+ const char* region_code;
+ const char* ui_language_code;
+ const char* components_language_code;
+ } kLangugeCodes[] = {
+ {"AM", "", "hy"},
+ {"AM", "hy", "hy"},
+ {"AM", "en", "hy-latn"},
+ {"CN", "zh-hans", "zh-hans"},
+ {"CN", "zh-hant", "zh-hant"},
+ {"CN", "zh", "zh"},
+ {"CN", "zh-latn", "zh-latn"},
+ {"CN", "en", "zh-latn"},
+ {"CN", "ja", "zh-latn"},
+ {"CN", "ko", "zh-latn"},
+ {"HK", "zh", "zh"},
+ {"HK", "zh-hans", "zh-hans"},
+ {"HK", "zh-hant", "zh-hant"},
+ {"HK", "zh-latn", "zh-latn"},
+ {"HK", "en", "en"},
+ {"HK", "fr", "zh-latn"},
+ {"HK", "ja", "zh-latn"},
+ {"HK", "ko", "zh-latn"},
+ {"MO", "zh", "zh"},
+ {"MO", "pt", "pt"},
+ {"MO", "en", "zh-latn"},
+ {"AQ", "en", "en"},
+ {"AQ", "fr", "fr"},
+ {"AQ", "es", "es"},
+ {"AQ", "zh", "zh"}
+ };
+ static const size_t kArraySize =
+ sizeof kLangugeCodes / sizeof (LanguageCodeData);
+ for (size_t i = 0; i < kArraySize; ++i) {
+ SCOPED_TRACE(std::string("region code = ") +
+ kLangugeCodes[i].region_code + ", ui language code = " +
+ kLangugeCodes[i].ui_language_code + ", components language code = " +
+ kLangugeCodes[i].components_language_code);
+ std::string components_language_code;
+ EXPECT_FALSE(BuildComponents(kLangugeCodes[i].region_code,
+ kLangugeCodes[i].ui_language_code,
+ &components_language_code).empty());
+ EXPECT_EQ(
+ kLangugeCodes[i].components_language_code, components_language_code);
+ }
+}
} // namespace
diff --git a/third_party/libaddressinput/chromium/cpp/test/countryinfo_example_addresses_test.cc b/third_party/libaddressinput/chromium/cpp/test/countryinfo_example_addresses_test.cc
index 32a2deb..31ffefd5 100644
--- a/third_party/libaddressinput/chromium/cpp/test/countryinfo_example_addresses_test.cc
+++ b/third_party/libaddressinput/chromium/cpp/test/countryinfo_example_addresses_test.cc
@@ -32,7 +32,7 @@
#include "fake_downloader.h"
#include "fake_storage.h"
#include "util/json.h"
-#include "util/string_split.h"
+#include "util/string_util.h"
namespace i18n {
namespace addressinput {
diff --git a/third_party/libaddressinput/chromium/cpp/test/retriever_test.cc b/third_party/libaddressinput/chromium/cpp/test/retriever_test.cc
index 5caff83..90c9099 100644
--- a/third_party/libaddressinput/chromium/cpp/test/retriever_test.cc
+++ b/third_party/libaddressinput/chromium/cpp/test/retriever_test.cc
@@ -28,7 +28,7 @@
#include "fake_downloader.h"
#include "fake_storage.h"
#include "region_data_constants.h"
-#include "time_to_string.h"
+#include "util/string_util.h"
namespace i18n {
namespace addressinput {
diff --git a/third_party/libaddressinput/chromium/cpp/test/util/string_split_unittest.cc b/third_party/libaddressinput/chromium/cpp/test/util/string_util_test.cc
index 73ca595..e5d4a1a 100644
--- a/third_party/libaddressinput/chromium/cpp/test/util/string_split_unittest.cc
+++ b/third_party/libaddressinput/chromium/cpp/test/util/string_util_test.cc
@@ -1,11 +1,11 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// The original source code is from:
// http://src.chromium.org/viewvc/chrome/trunk/src/base/strings/string_split_unittest.cc?revision=216633
-#include "util/string_split.h"
+#include "util/string_util.h"
#include <string>
#include <vector>
diff --git a/third_party/libaddressinput/libaddressinput.gyp b/third_party/libaddressinput/libaddressinput.gyp
index b0dfee2..3c89615 100644
--- a/third_party/libaddressinput/libaddressinput.gyp
+++ b/third_party/libaddressinput/libaddressinput.gyp
@@ -86,17 +86,13 @@
'<(libaddressinput_dir)/cpp/src/rule.h',
'<(libaddressinput_dir)/cpp/src/ruleset.cc',
'<(libaddressinput_dir)/cpp/src/ruleset.h',
- '<(libaddressinput_dir)/cpp/src/time_to_string.cc',
- '<(libaddressinput_dir)/cpp/src/time_to_string.h',
+ '<(libaddressinput_dir)/cpp/src/util/canonicalize_string.h',
'<(libaddressinput_dir)/cpp/src/util/json.h',
'<(libaddressinput_dir)/cpp/src/util/md5.cc',
'<(libaddressinput_dir)/cpp/src/util/md5.h',
'<(libaddressinput_dir)/cpp/src/util/stl_util.h',
- '<(libaddressinput_dir)/cpp/src/util/canonicalize_string.h',
- '<(libaddressinput_dir)/cpp/src/util/string_compare.cc',
- '<(libaddressinput_dir)/cpp/src/util/string_compare.h',
- '<(libaddressinput_dir)/cpp/src/util/string_split.cc',
- '<(libaddressinput_dir)/cpp/src/util/string_split.h',
+ '<(libaddressinput_dir)/cpp/src/util/string_util.cc',
+ '<(libaddressinput_dir)/cpp/src/util/string_util.h',
'<(libaddressinput_dir)/cpp/src/util/trie.cc',
'<(libaddressinput_dir)/cpp/src/util/trie.h',
],
@@ -155,7 +151,7 @@
'<(libaddressinput_dir)/cpp/test/util/md5_unittest.cc',
'<(libaddressinput_dir)/cpp/test/util/scoped_ptr_unittest.cc',
'<(libaddressinput_dir)/cpp/test/util/stl_util_unittest.cc',
- '<(libaddressinput_dir)/cpp/test/util/string_split_unittest.cc',
+ '<(libaddressinput_dir)/cpp/test/util/string_util_test.cc',
'<(libaddressinput_dir)/cpp/test/util/trie_test.cc',
],
'defines': [