diff --git a/java/release_notes.txt b/java/release_notes.txt index 860459587..3460a14f1 100644 --- a/java/release_notes.txt +++ b/java/release_notes.txt @@ -1,3 +1,20 @@ +Mar 31st, 2011 +* New functionality: + - Can parse and format numbers in RFC-3966 format. + - Added isAlphaNumber to check to see if a number is a "vanity" or "alpha" number + - Can format a number made up of alpha-characters in an "out-of-country" format (e.g. 0011 1 + 800-SIX-FLAG to dial an American alpha-number from Australia). +* Code changes: + - Renamed private vars, private methods and fixed comments to try and differentiate between country + (calling) codes and region codes. + == Non-backwards-compatible API changes: == + - Renamed getSupportedCountries to getSupportedRegions, as this more accurately reflects that the + library is based around region codes. + - getNationalSignificantNumber is no longer a static method, but is instead an instance method. +* Metadata changes: + - Bug-fixes and updates for AU, AZ, EE, FI, IN, JO, KW, KZ, MV, RU, RR, VA + - New country: ME + Mar 22nd, 2011 * Metadata changes: - New mobile-number pattern for AU diff --git a/java/resources/com/google/i18n/phonenumbers/BuildMetadataFromXml.java b/java/resources/com/google/i18n/phonenumbers/BuildMetadataFromXml.java index 04f7849d1..7f552d922 100644 --- a/java/resources/com/google/i18n/phonenumbers/BuildMetadataFromXml.java +++ b/java/resources/com/google/i18n/phonenumbers/BuildMetadataFromXml.java @@ -154,6 +154,9 @@ public class BuildMetadataFromXml { if (element.hasAttribute("mainCountryForCode")) { metadata.setMainCountryForCode(true); } + if (element.hasAttribute("leadingZeroPossible")) { + metadata.setLeadingZeroPossible(true); + } // Extract availableFormats NodeList numberFormatElements = element.getElementsByTagName("numberFormat"); diff --git a/java/resources/com/google/i18n/phonenumbers/BuildMetadataJsonFromXml.java b/java/resources/com/google/i18n/phonenumbers/BuildMetadataJsonFromXml.java index 81d6ad5a7..5120311dd 100644 --- a/java/resources/com/google/i18n/phonenumbers/BuildMetadataJsonFromXml.java +++ b/java/resources/com/google/i18n/phonenumbers/BuildMetadataJsonFromXml.java @@ -182,7 +182,7 @@ public class BuildMetadataJsonFromXml { // required string format = 2; jsArrayBuilder.append(format.getFormat()); // repeated string leading_digits_pattern = 3; - int leadingDigitsPatternSize = format.getLeadingDigitsPatternCount(); + int leadingDigitsPatternSize = format.leadingDigitsPatternSize(); if (leadingDigitsPatternSize > 0) { jsArrayBuilder.beginArray(); for (int i = 0; i < leadingDigitsPatternSize; i++) { @@ -310,7 +310,7 @@ public class BuildMetadataJsonFromXml { jsArrayBuilder.append(null); } // repeated NumberFormat number_format = 19; - int numberFormatSize = metadata.getNumberFormatCount(); + int numberFormatSize = metadata.numberFormatSize(); if (numberFormatSize > 0) { jsArrayBuilder.beginArray(); for (int i = 0; i < numberFormatSize; i++) { @@ -321,7 +321,7 @@ public class BuildMetadataJsonFromXml { jsArrayBuilder.append(null); } // repeated NumberFormat intl_number_format = 20; - int intlNumberFormatSize = metadata.getIntlNumberFormatCount(); + int intlNumberFormatSize = metadata.intlNumberFormatSize(); if (intlNumberFormatSize > 0) { jsArrayBuilder.beginArray(); for (int i = 0; i < intlNumberFormatSize; i++) { diff --git a/java/resources/com/google/i18n/phonenumbers/proto/phonemetadata.proto b/java/resources/com/google/i18n/phonenumbers/proto/phonemetadata.proto index 42f0a994d..0cf1faee1 100644 --- a/java/resources/com/google/i18n/phonenumbers/proto/phonemetadata.proto +++ b/java/resources/com/google/i18n/phonenumbers/proto/phonemetadata.proto @@ -218,6 +218,15 @@ message PhoneMetadata { // numbers are valid for all NANPA countries.) This field should be a regular // expression of the expected prefix match. optional string leading_digits = 23; + + // The leading zero in a phone number is meaningful in some countries (e.g. + // Italy). This means they cannot be dropped from the national number when + // converting into international format. If leading zeros are possible for + // valid international numbers for this region/country then set this to true. + // This only needs to be set for the region that is the main_country_for_code + // and all regions associated with that calling code will use the same + // setting. + optional bool leading_zero_possible = 26 [default=false]; } message PhoneMetadataCollection { diff --git a/java/resources/com/google/i18n/phonenumbers/src/PhoneNumberMetaData.xml b/java/resources/com/google/i18n/phonenumbers/src/PhoneNumberMetaData.xml index 80bb09fb0..e4fd71f2e 100644 --- a/java/resources/com/google/i18n/phonenumbers/src/PhoneNumberMetaData.xml +++ b/java/resources/com/google/i18n/phonenumbers/src/PhoneNumberMetaData.xml @@ -73,6 +73,7 @@ + @@ -1365,7 +1366,8 @@ + numbers. Also includes the area code 44 for CDMA regions, which are classified under + "Fixed Network" by the national plan. --> (?: 1(?: @@ -1390,7 +1392,8 @@ 6[56]| 79 )| - 365?\d + 365?\d| + 44\d{2} )\d{5} 123123456 @@ -1398,9 +1401,8 @@ (?: - 4[04]| + [46]0| 5[015]| - 60| 7[07] )\d{7} @@ -2718,7 +2720,7 @@ - + [2-8] @@ -2764,8 +2766,7 @@ - + @@ -2961,7 +2962,7 @@ - + [02] @@ -3053,7 +3054,7 @@ - + @@ -4668,20 +4669,19 @@ - - [3679]| + [369]| 4[3-8]| 5(?: [0-2]| 5[0-478]| 6[45] - ) + )| + 7[1-9] - [3679]| + [369]| 4[3-8]| 5(?: [02]| @@ -4694,7 +4694,8 @@ 4[0-4]| 5[1-589] ) - ) + )| + 7[1-9] $1 $2 @@ -4732,7 +4733,7 @@ [3-9]\d{6,7}| 800\d{6,7} - \d{6,10} + \d{7,10} 800[2-9]\d{3} @@ -4795,10 +4796,8 @@ 9001234 - - 70[0-2]?\d{5} - \d{7,8} + 70[0-2]\d{5} + \d{8} 70012345 @@ -5171,7 +5170,10 @@ - [1-9]\d{4,11} + + 1\d{4,11}| + [2-9]\d{4,10} + \d{5,12} @@ -5377,7 +5379,7 @@ - + [4-9] @@ -7875,10 +7877,13 @@ 7(?: + 2[0579]| 39| - 5[5-9]| - [67][02-9]| - 8[0-6] + 4[0-389]| + 5[04-9]| + 6| + 7[02-9]| + 8[0-79] )| 8(?: 0[01589]| @@ -7890,13 +7895,18 @@ 7(?: + 2[0579]| 39| + 4[0-389]| 5(?: + 0[0-5]| + 49| 50| [6-9] )| - [67][02-9]| - 8[0-6] + 6| + 7[02-9]| + 8[0-79] )| 8(?: 0[01589]| @@ -8255,37 +8265,58 @@ [013-8]\d ) ) - )[2-6]\d{5} + )[2-6]\d{5} + \d{6,10} 1123456789 - + - + (?: 7(?: - 39[89]| + 2(?: + 0[04-9]| + 5[09]| + 7[568]| + 9[39] + )| + 3(?: + 07| + 7[3679]| + 9[689] + )| + 4(?: + 05| + 1[15-9]| + [29][89]| + 39| + 8[389] + )| 5(?: + 0[0-5]| + [47]9| 50| - 6[6-8]| - 79| + 6[6-9]| [89][7-9] )| 6(?: 0[027]| + 12| 20| 3[19]| - 54| - 65| + 5[45]| + 6[5-9]| 7[67]| 9[6-9] )| 7(?: - 0[89]| - 3[589]| + 0[289]| + 3[5-9]| 42| 60| 9[5-9] @@ -8295,14 +8326,21 @@ 14| 2[7-9]| 4[25]| - 6[09] + 6[09]| + 7[015689]| + 9[0357-9] ) )\d| 9\d{4}| 8(?: (?: 0[01589]| - 1[024] + 1[24]| + 2[2369]| + 4[023458]| + 52| + 6[0589]| + 7[2569] )\d| 8(?: [079]\d| @@ -8625,7 +8663,7 @@ - + @@ -9046,7 +9084,7 @@ [235-9]\d{7,8} - \d{8,9} + \d{7,9} + + 8(?: + 10| + [78]\d + )\d{5} + + \d{8} + 87101234 + @@ -10593,18 +10633,20 @@ (?: 5(?: - 0[02]| + 0[0-2]| 5\d )| 6(?: 0[034679]| 5[015-9]| 6\d| - 7[067] + 7[067]| + 99 )| 9(?: 0[09]| 4[049]| + 66| [79]\d ) )\d{5} @@ -10716,19 +10758,24 @@ - + (?: - [67]\d{2}| + 7\d{2}| 80[09] )\d{7} \d{10} + + 751\d{7} + \d{10} + 7511234567 + @@ -10751,14 +10798,14 @@ )| 3(?: 2\d| - 3[1-7]| - 4[1235-9]| + 3[1-79]| + 4[0-35-9]| 59 )| 4(?: 2\d| 3[013-79]| - 4[0-58]| + 4[0-8]| 5[1-79] )| 5(?: @@ -10768,15 +10815,16 @@ 59 )| 6(?: - 22| + 2\d| [34]\d| - 5[19] + 5[19]| + 61 )| 72\d| 8(?: [27]\d| 3[1-46-9]| - 4[0-4]| + 4[0-5]| ) )| 2(?: @@ -10796,16 +10844,18 @@ 5[139]| )| 4(?: - 22| - 3[1235-8] + 2\d| + 3[1235-9]| + 59 )| 5(?: [23]\d| - 4[0124-8]| - 59 + 4[01246-8]| + 59| + 61 )| 6(?: - 22| + 2\d| 3[1-9]| 4[0-4]| 59 @@ -10823,7 +10873,7 @@ )| 9(?: 2\d| - 3[12478]| + 3[124578]| 59 ) )| @@ -10833,25 +10883,14 @@ 7123456789 - 7(?: 0[01257]\d{2}| - 1[2-578]9[01]| - 2(?: - [13-6]9[01]| - 7(?: - 58| - 9[01] - ) - )| 6[02-4]\d{2}| 7[157]\d{2} - )\d{5}| - 6\d{9} + )\d{5} - 7129012345 + 7710009998 800\d{7} @@ -10861,6 +10900,10 @@ 809\d{7} 8091234567 + + 751\d{7} + 7511234567 + @@ -11882,8 +11925,130 @@ - + + + + + [2-57-9]|6[3789] + + [2-57-9]| + 6(?: + [389]| + 7(?: + [0-8]| + 9[3-9] + ) + ) + + $1 $2 $3 + + + 679 + 679[0-2] + $1 $2 $3 $4 + + + + [2-9]\d{7,8} + \d{6,9} + + + + + (?: + 20[2-8]| + 3(?: + 0[2-7]| + 1[35-7]| + 2[367]| + 3[4-7] + )| + 4(?: + 0[237]| + 1[2467] + )| + 5(?: + 0[47]| + 1[27]| + 2[378] + ) + )\d{5} + + \d{6,8} + 30234567 + + + + + 6(?: + 32\d| + [89]\d{2}| + 7(?: + [0-8]\d| + 9(?: + [3-9]| + [0-2]\d + ) + ) + )\d{4} + + + \d{8,9} + 67622901 + + + + 800[28]\d{4} + \d{8} + 80080002 + + + + + (?: + 88\d| + 9(?: + 4[13-8]| + 5[16-8] + ) + )\d{5} + + \d{8} + 94515151 + + + + 78[134579]\d{5} + \d{8} + 78108780 + + + + 77\d{6} + \d{8} + 77273012 + + + + + 1(?: + 16\d{3}| + 2\d{1,2}| + [0135]\d{2}| + 4\d{2,3}| + 9\d{3} + ) + + \d{3,6} + 123 + @@ -12644,46 +12809,69 @@ preferredInternationalPrefix="00"> + + [367]| + 9(?: + [1-9]| + 0[1-9] + ) + $1-$2 + + 900 + $1 $2 $3 + - [3679]\d{6} - \d{7} + + [367]\d{6}| + 9(?: + 00\d{7}| + \d{6} + ) + + \d{7,10} - + (?: 3(?: - 00| + 0[01]| 3[0-59]| )| 6(?: [567][02468]| - 8[024689] + 8[024689]| + 90 ) )\d{4} + \d{7} 6701234 (?: - 7(?: - [679]\d| - 8[02-9] - )| - 9[6-9]\d - )\d{4} + 7[36-9]| + 9[6-9] + )\d{5} + \d{7} 7712345 781\d{4} + \d{7} 7812345 + + 900\d{7} + \d{10} + 9001234567 + 1(?: @@ -13309,7 +13497,7 @@ - + @@ -13558,7 +13746,7 @@ - + [489] @@ -14979,8 +15167,8 @@ [34689] $1 $2-$3-$4 - - [67] + + 7 $1 $2 $3 @@ -15887,7 +16075,8 @@ and without this area code. The nationalPrefixForParsing and nationalPrefixTransformRule are used to ensure that if the 0549 is not present, it will be added. --> + nationalPrefixForParsing="(?:0549)?([89]\d{5})" nationalPrefixTransformRule="0549$1" + leadingZeroPossible="true"> [5-7] @@ -16151,7 +16340,7 @@ - + [2-6] @@ -16350,7 +16539,7 @@ - + $1 $2 $3 @@ -16764,6 +16953,7 @@ 2[1-4] )| 6(?: + 07| 1[4-6]| 2[1-9]| [3-6]\d| @@ -17488,7 +17678,7 @@ - + $1 $2 $3 diff --git a/java/resources/com/google/i18n/phonenumbers/test/PhoneNumberMetaDataForTesting.xml b/java/resources/com/google/i18n/phonenumbers/test/PhoneNumberMetaDataForTesting.xml index c01acf742..81969118f 100644 --- a/java/resources/com/google/i18n/phonenumbers/test/PhoneNumberMetaDataForTesting.xml +++ b/java/resources/com/google/i18n/phonenumbers/test/PhoneNumberMetaDataForTesting.xml @@ -194,7 +194,7 @@ [34]0|[68]9 - $1 $2 + $1/$2 - + 0[26] diff --git a/java/src/com/google/i18n/phonenumbers/AsYouTypeFormatter.java b/java/src/com/google/i18n/phonenumbers/AsYouTypeFormatter.java index 11b8ba08f..15d9313d2 100644 --- a/java/src/com/google/i18n/phonenumbers/AsYouTypeFormatter.java +++ b/java/src/com/google/i18n/phonenumbers/AsYouTypeFormatter.java @@ -133,9 +133,9 @@ public class AsYouTypeFormatter { private void getAvailableFormats(String leadingThreeDigits) { List formatList = - (isInternationalFormatting && currentMetaData.getIntlNumberFormatCount() > 0) - ? currentMetaData.getIntlNumberFormatList() - : currentMetaData.getNumberFormatList(); + (isInternationalFormatting && currentMetaData.intlNumberFormatSize() > 0) + ? currentMetaData.intlNumberFormats() + : currentMetaData.numberFormats(); possibleFormats.addAll(formatList); narrowDownPossibleFormats(leadingThreeDigits); } @@ -146,7 +146,7 @@ public class AsYouTypeFormatter { Iterator it = possibleFormats.iterator(); while (it.hasNext()) { NumberFormat format = it.next(); - if (format.getLeadingDigitsPatternCount() > indexOfLeadingDigitsPattern) { + if (format.leadingDigitsPatternSize() > indexOfLeadingDigitsPattern) { Pattern leadingDigitsPattern = regexCache.getPatternForRegex( format.getLeadingDigitsPattern(indexOfLeadingDigitsPattern)); diff --git a/java/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java b/java/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java index 52b826e07..13a5bc2e1 100644 --- a/java/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java +++ b/java/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java @@ -44,6 +44,9 @@ import java.util.regex.Pattern; * Utility for international phone numbers. Functionality includes formatting, parsing and * validation. * + *

If you use this library, and want to be notified about important changes, please sign up to + * our mailing list. + * * @author Shaopeng Jia * @author Lara Rennie */ @@ -53,36 +56,38 @@ public class PhoneNumberUtil { // The minimum and maximum length of the national significant number. private static final int MIN_LENGTH_FOR_NSN = 3; static final int MAX_LENGTH_FOR_NSN = 15; - // The maximum length of the country code. + // The maximum length of the country calling code. static final int MAX_LENGTH_COUNTRY_CODE = 3; static final String META_DATA_FILE_PREFIX = "/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto"; private String currentFilePrefix = META_DATA_FILE_PREFIX; private static final Logger LOGGER = Logger.getLogger(PhoneNumberUtil.class.getName()); - // A mapping from a country code to the region codes which denote the country/region - // represented by that country code. In the case of multiple countries sharing a calling code, - // such as the NANPA countries, the one indicated with "isMainCountryForCode" in the metadata - // should be first. - private Map> countryCodeToRegionCodeMap = null; + // A mapping from a country calling code to the region codes which denote the region represented + // by that country calling code. In the case of multiple regions sharing a calling code, such as + // the NANPA regions, the one indicated with "isMainCountryForCode" in the metadata should be + // first. + private Map> countryCallingCodeToRegionCodeMap = null; - // The set of countries the library supports. + // The set of regions the library supports. // There are roughly 220 of them and we set the initial capacity of the HashSet to 300 to offer a // load factor of roughly 0.75. - private final Set supportedCountries = new HashSet(300); + private final Set supportedRegions = new HashSet(300); // Region-code for the unknown region. private static final String UNKNOWN_REGION = "ZZ"; - // The set of countries that share country code 1. - // There are roughly 26 countries of them and we set the initial capacity of the HashSet to 35 - // to offer a load factor of roughly 0.75. - private final Set nanpaCountries = new HashSet(35); + // The set of regions that share country code 1. + // There are roughly 26 regions and we set the initial capacity of the HashSet to 35 to offer a + // load factor of roughly 0.75. + private final Set nanpaRegions = new HashSet(35); private static final int NANPA_COUNTRY_CODE = 1; // The PLUS_SIGN signifies the international prefix. static final char PLUS_SIGN = '+'; + private static final String RFC3966_EXTN_PREFIX = ";ext="; + // These mappings map a character (key) to a specific digit that should replace it for // normalization purposes. Non-European digits that may be used in phone numbers are mapped to a // European equivalent. @@ -94,45 +99,53 @@ public class PhoneNumberUtil { // For performance reasons, amalgamate both into one map. private static final Map ALL_NORMALIZATION_MAPPINGS; + // Separate map of all symbols that we wish to retain when formatting alpha numbers. This + // includes digits, ASCII letters and number grouping symbols such as "-" and " ". + private static final Map ALL_PLUS_NUMBER_GROUPING_SYMBOLS; + static { + // Simple ASCII digits map used to populate DIGIT_MAPPINGS and ALPHA_MAPPINGS. + HashMap asciiDigitMappings = new HashMap(); + asciiDigitMappings.put('0', '0'); + asciiDigitMappings.put('1', '1'); + asciiDigitMappings.put('2', '2'); + asciiDigitMappings.put('3', '3'); + asciiDigitMappings.put('4', '4'); + asciiDigitMappings.put('5', '5'); + asciiDigitMappings.put('6', '6'); + asciiDigitMappings.put('7', '7'); + asciiDigitMappings.put('8', '8'); + asciiDigitMappings.put('9', '9'); + HashMap digitMap = new HashMap(50); - digitMap.put('0', '0'); + digitMap.putAll(asciiDigitMappings); digitMap.put('\uFF10', '0'); // Fullwidth digit 0 digitMap.put('\u0660', '0'); // Arabic-indic digit 0 digitMap.put('\u06F0', '0'); // Eastern-Arabic digit 0 - digitMap.put('1', '1'); digitMap.put('\uFF11', '1'); // Fullwidth digit 1 digitMap.put('\u0661', '1'); // Arabic-indic digit 1 digitMap.put('\u06F1', '1'); // Eastern-Arabic digit 1 - digitMap.put('2', '2'); digitMap.put('\uFF12', '2'); // Fullwidth digit 2 digitMap.put('\u0662', '2'); // Arabic-indic digit 2 digitMap.put('\u06F2', '2'); // Eastern-Arabic digit 2 - digitMap.put('3', '3'); digitMap.put('\uFF13', '3'); // Fullwidth digit 3 digitMap.put('\u0663', '3'); // Arabic-indic digit 3 digitMap.put('\u06F3', '3'); // Eastern-Arabic digit 3 - digitMap.put('4', '4'); digitMap.put('\uFF14', '4'); // Fullwidth digit 4 digitMap.put('\u0664', '4'); // Arabic-indic digit 4 digitMap.put('\u06F4', '4'); // Eastern-Arabic digit 4 - digitMap.put('5', '5'); digitMap.put('\uFF15', '5'); // Fullwidth digit 5 digitMap.put('\u0665', '5'); // Arabic-indic digit 5 digitMap.put('\u06F5', '5'); // Eastern-Arabic digit 5 - digitMap.put('6', '6'); digitMap.put('\uFF16', '6'); // Fullwidth digit 6 digitMap.put('\u0666', '6'); // Arabic-indic digit 6 digitMap.put('\u06F6', '6'); // Eastern-Arabic digit 6 - digitMap.put('7', '7'); digitMap.put('\uFF17', '7'); // Fullwidth digit 7 digitMap.put('\u0667', '7'); // Arabic-indic digit 7 digitMap.put('\u06F7', '7'); // Eastern-Arabic digit 7 - digitMap.put('8', '8'); digitMap.put('\uFF18', '8'); // Fullwidth digit 8 digitMap.put('\u0668', '8'); // Arabic-indic digit 8 digitMap.put('\u06F8', '8'); // Eastern-Arabic digit 8 - digitMap.put('9', '9'); digitMap.put('\uFF19', '9'); // Fullwidth digit 9 digitMap.put('\u0669', '9'); // Arabic-indic digit 9 digitMap.put('\u06F9', '9'); // Eastern-Arabic digit 9 @@ -171,31 +184,38 @@ public class PhoneNumberUtil { combinedMap.putAll(alphaMap); combinedMap.putAll(digitMap); ALL_NORMALIZATION_MAPPINGS = Collections.unmodifiableMap(combinedMap); - } - // A list of all country codes where national significant numbers (excluding any national prefix) - // exist that start with a leading zero. - private static final Set LEADING_ZERO_COUNTRIES; - static { - HashSet aSet = new HashSet(10); - aSet.add(39); // Italy - aSet.add(47); // Norway - aSet.add(225); // Cote d'Ivoire - aSet.add(227); // Niger - aSet.add(228); // Togo - aSet.add(241); // Gabon - aSet.add(242); // Congo (Rep. of the) - aSet.add(268); // Swaziland - aSet.add(378); // San Marino - aSet.add(379); // Vatican City - aSet.add(501); // Belize - LEADING_ZERO_COUNTRIES = Collections.unmodifiableSet(aSet); - } - - // Pattern that makes it easy to distinguish whether a country has a unique international dialing - // prefix or not. If a country has a unique international prefix (e.g. 011 in USA), it will be + HashMap allPlusNumberGroupings = new HashMap(); + // Put (lower letter -> upper letter) and (upper letter -> upper letter) mappings. + for (char c : ALPHA_MAPPINGS.keySet()) { + allPlusNumberGroupings.put(Character.toLowerCase(c), c); + allPlusNumberGroupings.put(c, c); + } + allPlusNumberGroupings.putAll(asciiDigitMappings); + // Put grouping symbols. + allPlusNumberGroupings.put('-', '-'); + allPlusNumberGroupings.put('\uFF0D', '-'); + allPlusNumberGroupings.put('\u2010', '-'); + allPlusNumberGroupings.put('\u2011', '-'); + allPlusNumberGroupings.put('\u2012', '-'); + allPlusNumberGroupings.put('\u2013', '-'); + allPlusNumberGroupings.put('\u2014', '-'); + allPlusNumberGroupings.put('\u2015', '-'); + allPlusNumberGroupings.put('\u2212', '-'); + allPlusNumberGroupings.put('/', '/'); + allPlusNumberGroupings.put('\uFF0F', '/'); + allPlusNumberGroupings.put(' ', ' '); + allPlusNumberGroupings.put('\u3000', ' '); + allPlusNumberGroupings.put('\u2060', ' '); + allPlusNumberGroupings.put('.', '.'); + allPlusNumberGroupings.put('\uFF0E', '.'); + ALL_PLUS_NUMBER_GROUPING_SYMBOLS = Collections.unmodifiableMap(allPlusNumberGroupings); + } + + // Pattern that makes it easy to distinguish whether a region has a unique international dialing + // prefix or not. If a region has a unique international prefix (e.g. 011 in USA), it will be // represented as a string that contains a sequence of ASCII digits. If there are multiple - // available international prefixes in a country, they will be represented as a regex string that + // available international prefixes in a region, they will be represented as a regex string that // always contains character(s) other than ASCII digits. // Note this regex also includes tilde, which signals waiting for the tone. private static final Pattern UNIQUE_INTERNATIONAL_PREFIX = @@ -218,6 +238,7 @@ public class PhoneNumberUtil { Arrays.toString(ALPHA_MAPPINGS.keySet().toArray()).toLowerCase().replaceAll("[, \\[\\]]", ""); static final String PLUS_CHARS = "+\uFF0B"; private static final Pattern PLUS_CHARS_PATTERN = Pattern.compile("[" + PLUS_CHARS + "]+"); + private static final Pattern SEPARATOR_PATTERN = Pattern.compile("[" + VALID_PUNCTUATION + "]+"); private static final Pattern CAPTURING_DIGIT_PATTERN = Pattern.compile("([" + VALID_DIGITS + "])"); @@ -264,27 +285,30 @@ public class PhoneNumberUtil { // Default extension prefix to use when formatting. This will be put in front of any extension // component of the number, after the main national number is formatted. For example, if you wish // the default extension formatting to be " extn: 3456", then you should specify " extn: " here - // as the default extension prefix. This can be overridden by country-specific preferences. + // as the default extension prefix. This can be overridden by region-specific preferences. private static final String DEFAULT_EXTN_PREFIX = " ext. "; // Regexp of all possible ways to write extensions, for use when parsing. This will be run as a - // case-insensitive regexp match. Wide character versions are also provided after each ascii - // version. There are two regular expressions here: the more generic one starts with optional - // white space and ends with an optional full stop (.), followed by zero or more spaces/tabs and - // then the numbers themselves. The other one covers the special case of American numbers where - // the extension is written with a hash at the end, such as "- 503#". + // case-insensitive regexp match. Wide character versions are also provided after each ASCII + // version. There are three regular expressions here. The first covers RFC 3966 format, where the + // extension is added using ";ext=". The second more generic one starts with optional white space + // and ends with an optional full stop (.), followed by zero or more spaces/tabs and then the + // numbers themselves. The other one covers the special case of American numbers where the + // extension is written with a hash at the end, such as "- 503#". // Note that the only capturing groups should be around the digits that you want to capture as // part of the extension, or else parsing will fail! // Canonical-equivalence doesn't seem to be an option with Android java, so we allow two options // for representing the accented o - the character itself, and one in the unicode decomposed form // with the combining acute accent. - static final String KNOWN_EXTN_PATTERNS = "[ \u00A0\\t,]*" + - "(?:ext(?:ensi(?:o\u0301?|\u00F3))?n?|" + + private static final String CAPTURING_EXTN_DIGITS = "([" + VALID_DIGITS + "]{1,7})"; + static final String KNOWN_EXTN_PATTERNS = + RFC3966_EXTN_PREFIX + CAPTURING_EXTN_DIGITS + "|" + + "[ \u00A0\\t,]*(?:ext(?:ensi(?:o\u0301?|\u00F3))?n?|" + "\uFF45\uFF58\uFF54\uFF4E?|[,x\uFF58#\uFF03~\uFF5E]|int|anexo|\uFF49\uFF4E\uFF54)" + - "[:\\.\uFF0E]?[ \u00A0\\t,-]*([" + VALID_DIGITS + "]{1,7})#?|[- ]+([" + VALID_DIGITS + - "]{1,5})#"; + "[:\\.\uFF0E]?[ \u00A0\\t,-]*" + CAPTURING_EXTN_DIGITS + "#?|" + + "[- ]+([" + VALID_DIGITS + "]{1,5})#"; - // Regexp of all known extension prefixes used by different countries followed by 1 or more valid + // Regexp of all known extension prefixes used by different regions followed by 1 or more valid // digits, for use when parsing. private static final Pattern EXTN_PATTERN = Pattern.compile("(?:" + KNOWN_EXTN_PATTERNS + ")$", REGEX_FLAGS); @@ -303,10 +327,9 @@ public class PhoneNumberUtil { private static PhoneNumberUtil instance = null; // A mapping from a region code to the PhoneMetadata for that region. - private Map countryToMetadataMap = - new HashMap(); + private Map regionToMetadataMap = new HashMap(); - // A cache for frequently used country-specific regular expressions. + // A cache for frequently used region-specific regular expressions. // As most people use phone numbers primarily from one to two countries, and there are roughly 60 // regular expressions needed, the initial capacity of 100 offers a rough load factor of 0.75. private RegexCache regexCache = new RegexCache(100); @@ -316,14 +339,17 @@ public class PhoneNumberUtil { * E. 123. For example, the number of the Google Zurich office will be written as * "+41 44 668 1800" in INTERNATIONAL format, and as "044 668 1800" in NATIONAL format. * E164 format is as per INTERNATIONAL format but with no formatting applied, e.g. +41446681800. + * RFC3966 is as per INTERNATIONAL format, but with all spaces and other separating symbols + * replaced with a hyphen, and with any phone number extension appended with ";ext=". * * Note: If you are considering storing the number in a neutral format, you are highly advised to - * use the phonenumber.proto. + * use the PhoneNumber class. */ public enum PhoneNumberFormat { E164, INTERNATIONAL, - NATIONAL + NATIONAL, + RFC3966 } /** @@ -332,7 +358,7 @@ public class PhoneNumberUtil { public enum PhoneNumberType { FIXED_LINE, MOBILE, - // In some countries (e.g. the USA), it is impossible to distinguish between fixed-line and + // In some regions (e.g. the USA), it is impossible to distinguish between fixed-line and // mobile numbers by looking at the phone number itself. FIXED_LINE_OR_MOBILE, // Freephone lines @@ -353,7 +379,7 @@ public class PhoneNumberUtil { // specific offices, but allow one number to be used for a company. UAN, // A phone number is of type UNKNOWN when it does not fit any of the known patterns for a - // specific country. + // specific region. UNKNOWN } @@ -416,10 +442,10 @@ public class PhoneNumberUtil { private void init(String filePrefix) { currentFilePrefix = filePrefix; - for (List regionCodes : countryCodeToRegionCodeMap.values()) { - supportedCountries.addAll(regionCodes); + for (List regionCodes : countryCallingCodeToRegionCodeMap.values()) { + supportedRegions.addAll(regionCodes); } - nanpaCountries.addAll(countryCodeToRegionCodeMap.get(NANPA_COUNTRY_CODE)); + nanpaRegions.addAll(countryCallingCodeToRegionCodeMap.get(NANPA_COUNTRY_CODE)); } private void loadMetadataForRegionFromFile(String filePrefix, String regionCode) { @@ -431,7 +457,7 @@ public class PhoneNumberUtil { PhoneMetadataCollection metadataCollection = new PhoneMetadataCollection(); metadataCollection.readExternal(in); for (PhoneMetadata metadata : metadataCollection.getMetadataList()) { - countryToMetadataMap.put(regionCode, metadata); + regionToMetadataMap.put(regionCode, metadata); } } catch (IOException e) { LOGGER.log(Level.WARNING, e.toString()); @@ -461,6 +487,7 @@ public class PhoneNumberUtil { Matcher trailingCharsMatcher = UNWANTED_END_CHAR_PATTERN.matcher(number); if (trailingCharsMatcher.find()) { number = number.substring(0, trailingCharsMatcher.start()); + LOGGER.log(Level.FINER, "Stripped trailing characters: " + number); } // Check for extra numbers at the end. Matcher secondNumber = SECOND_NUMBER_START_PATTERN.matcher(number); @@ -547,15 +574,16 @@ public class PhoneNumberUtil { } /** - * Gets the length of the geographical area code from the national_number field of the PhoneNumber - * object passed in, so that clients could use it to split a national significant number into - * geographical area code and subscriber number. It works in such a way that the resultant - * subscriber number should be diallable, at least on some devices. An example of how this could - * be used: + * Gets the length of the geographical area code in the {@code nationalNumber_} field of the + * PhoneNumber object passed in, so that clients could use it to split a national significant + * number into geographical area code and subscriber number. It works in such a way that the + * resultant subscriber number should be diallable, at least on some devices. An example of how + * this could be used: * + *

    * PhoneNumberUtil phoneUtil = PhoneNumberUtil.getInstance();
    * PhoneNumber number = phoneUtil.parse("16502530000", "US");
-   * String nationalSignificantNumber = PhoneNumberUtil.getNationalSignificantNumber(number);
+   * String nationalSignificantNumber = phoneUtil.getNationalSignificantNumber(number);
    * String areaCode;
    * String subscriberNumber;
    *
@@ -567,10 +595,10 @@ public class PhoneNumberUtil {
    *   areaCode = "";
    *   subscriberNumber = nationalSignificantNumber;
    * }
+   * 
* * N.B.: area code is a very ambiguous concept, so the I18N team generally recommends against - * using it for most purposes, but recommends using the more general national_number instead. Read - * the following carefully before deciding to use this method: + * using it for most purposes. Read the following carefully before deciding to use this method: * * - geographical area codes change over time, and this method honors those changes; therefore, * it doesn't guarantee the stability of the result it produces. @@ -607,12 +635,12 @@ public class PhoneNumberUtil { * Gets the length of the national destination code (NDC) from the PhoneNumber object passed in, * so that clients could use it to split a national significant number into NDC and subscriber * number. The NDC of a phone number is normally the first group of digit(s) right after the - * country code when the number is formatted in the international format, if there is a subscriber - * number part that follows. An example of how this could be used: + * country calling code when the number is formatted in the international format, if there is a + * subscriber number part that follows. An example of how this could be used: * * PhoneNumberUtil phoneUtil = PhoneNumberUtil.getInstance(); * PhoneNumber number = phoneUtil.parse("18002530000", "US"); - * String nationalSignificantNumber = PhoneNumberUtil.getNationalSignificantNumber(number); + * String nationalSignificantNumber = phoneUtil.getNationalSignificantNumber(number); * String nationalDestinationCode; * String subscriberNumber; * @@ -625,9 +653,10 @@ public class PhoneNumberUtil { * nationalDestinationCode = ""; * subscriberNumber = nationalSignificantNumber; * } + * * * Refer to the unittests to see the difference between this function and - * getLengthOfGeographicalAreaCode(). + * {@link getLengthOfGeographicalAreaCode()}. * * @param number the PhoneNumber object for which clients want to know the length of the NDC. * @return the length of NDC of the PhoneNumber object passed in. @@ -648,8 +677,8 @@ public class PhoneNumberUtil { PhoneNumberUtil.PhoneNumberFormat.INTERNATIONAL); String[] numberGroups = NON_DIGITS_PATTERN.split(nationalSignificantNumber); // The pattern will start with "+COUNTRY_CODE " so the first group will always be the empty - // string (before the + symbol) and the second group will be the country code. The third group - // will be area code if it is not the last group. + // string (before the + symbol) and the second group will be the country calling code. The third + // group will be area code if it is not the last group. if (numberGroups.length <= 3) { return 0; } @@ -699,10 +728,10 @@ public class PhoneNumberUtil { static synchronized PhoneNumberUtil getInstance( String baseFileLocation, - Map> countryCodeToRegionCodeMap) { + Map> countryCallingCodeToRegionCodeMap) { if (instance == null) { instance = new PhoneNumberUtil(); - instance.countryCodeToRegionCodeMap = countryCodeToRegionCodeMap; + instance.countryCallingCodeToRegionCodeMap = countryCallingCodeToRegionCodeMap; instance.init(baseFileLocation); } return instance; @@ -716,20 +745,19 @@ public class PhoneNumberUtil { } /** - * Convenience method to enable tests to get a list of what countries the library has metadata - * for. + * Convenience method to enable tests to get a list of what regions the library has metadata for. */ - public Set getSupportedCountries() { - return supportedCountries; + public Set getSupportedRegions() { + return supportedRegions; } /** - * Gets a PhoneNumberUtil instance to carry out international phone number formatting, parsing, - * or validation. The instance is loaded with phone number metadata for a number of most commonly - * used countries/regions. + * Gets a {@link PhoneNumberUtil} instance to carry out international phone number formatting, + * parsing, or validation. The instance is loaded with phone number metadata for a number of most + * commonly used regions. * - * The PhoneNumberUtil is implemented as a singleton. Therefore, calling getInstance multiple - * times will only result in one instance being created. + *

The {@link PhoneNumberUtil} is implemented as a singleton. Therefore, calling getInstance + * multiple times will only result in one instance being created. * * @return a PhoneNumberUtil instance */ @@ -745,7 +773,23 @@ public class PhoneNumberUtil { * Helper function to check region code is not unknown or null. */ private boolean isValidRegionCode(String regionCode) { - return regionCode != null && supportedCountries.contains(regionCode.toUpperCase()); + return regionCode != null && supportedRegions.contains(regionCode.toUpperCase()); + } + + /** + * Helper function to check region code is not unknown or null and log an error message. The + * {@code countryCallingCode} and {@code number} supplied is used only for the resultant log + * message. + */ + private boolean hasValidRegionCode(String regionCode, + int countryCallingCode, String number) { + if (!isValidRegionCode(regionCode)) { + LOGGER.log(Level.WARNING, + "Number " + number + " has invalid or missing country calling code (" + + countryCallingCode + ")"); + return false; + } + return true; } /** @@ -754,8 +798,9 @@ public class PhoneNumberUtil { * format in either 'national' or 'international' format depending on what the client asks for, we * do not currently support a more abbreviated format, such as for users in the same "area" who * could potentially dial the number without area code. Note that if the phone number has a - * country code of 0 or an otherwise invalid country code, we cannot work out which formatting - * rules to apply so we return the national significant number with no formatting applied. + * country calling code of 0 or an otherwise invalid country calling code, we cannot work out + * which formatting rules to apply so we return the national significant number with no formatting + * applied. * * @param number the phone number to be formatted * @param numberFormat the format the phone number should be formatted into @@ -782,9 +827,9 @@ public class PhoneNumberUtil { formatNumberByFormat(countryCode, PhoneNumberFormat.E164, formattedNumber); return; } - // Note getRegionCodeForCountryCode() is used because formatting information for countries which - // share a country code is contained by only one country for performance reasons. For example, - // for NANPA countries it will be contained in the metadata for US. + // Note getRegionCodeForCountryCode() is used because formatting information for regions which + // share a country calling code is contained by only one region for performance reasons. For + // example, for NANPA regions it will be contained in the metadata for US. String regionCode = getRegionCodeForCountryCode(countryCode); if (!isValidRegionCode(regionCode)) { formattedNumber.append(nationalSignificantNumber); @@ -793,15 +838,15 @@ public class PhoneNumberUtil { formattedNumber.append(formatNationalNumber(nationalSignificantNumber, regionCode, numberFormat)); - maybeGetFormattedExtension(number, regionCode, formattedNumber); + maybeGetFormattedExtension(number, regionCode, numberFormat, formattedNumber); formatNumberByFormat(countryCode, numberFormat, formattedNumber); } /** * Formats a phone number in the specified format using client-defined formatting rules. Note that - * if the phone number has a country code of zero or an otherwise invalid country code, we cannot - * work out things like whether there should be a national prefix applied, or how to format - * extensions, so we return the national significant number with no formatting applied. + * if the phone number has a country calling code of zero or an otherwise invalid country calling + * code, we cannot work out things like whether there should be a national prefix applied, or how + * to format extensions, so we return the national significant number with no formatting applied. * * @param number the phone number to be formatted * @param numberFormat the format the phone number should be formatted into @@ -811,13 +856,13 @@ public class PhoneNumberUtil { public String formatByPattern(PhoneNumber number, PhoneNumberFormat numberFormat, List userDefinedFormats) { - int countryCode = number.getCountryCode(); + int countryCallingCode = number.getCountryCode(); String nationalSignificantNumber = getNationalSignificantNumber(number); - // Note getRegionCodeForCountryCode() is used because formatting information for countries which - // share a country code is contained by only one country for performance reasons. For example, - // for NANPA countries it will be contained in the metadata for US. - String regionCode = getRegionCodeForCountryCode(countryCode); - if (!isValidRegionCode(regionCode)) { + // Note getRegionCodeForCountryCode() is used because formatting information for regions which + // share a country calling code is contained by only one region for performance reasons. For + // example, for NANPA regions it will be contained in the metadata for US. + String regionCode = getRegionCodeForCountryCode(countryCallingCode); + if (!hasValidRegionCode(regionCode, countryCallingCode, nationalSignificantNumber)) { return nationalSignificantNumber; } List userDefinedFormatsCopy = @@ -853,30 +898,30 @@ public class PhoneNumberUtil { new StringBuffer(formatAccordingToFormats(nationalSignificantNumber, userDefinedFormatsCopy, numberFormat)); - maybeGetFormattedExtension(number, regionCode, formattedNumber); - formatNumberByFormat(countryCode, numberFormat, formattedNumber); + maybeGetFormattedExtension(number, regionCode, numberFormat, formattedNumber); + formatNumberByFormat(countryCallingCode, numberFormat, formattedNumber); return formattedNumber.toString(); } /** * Formats a phone number in national format for dialing using the carrier as specified in the - * carrierCode. The carrierCode will always be used regardless of whether the phone number already - * has a preferred domestic carrier code stored. If carrierCode contains an empty string, return - * the number in national format without any carrier code. + * {@code carrierCode}. The {@code carrierCode} will always be used regardless of whether the + * phone number already has a preferred domestic carrier code stored. If {@code carrierCode} + * contains an empty string, returns the number in national format without any carrier code. * * @param number the phone number to be formatted * @param carrierCode the carrier selection code to be used * @return the formatted phone number in national format for dialing using the carrier as - * specified in the carrierCode + * specified in the {@code carrierCode} */ public String formatNationalNumberWithCarrierCode(PhoneNumber number, String carrierCode) { - int countryCode = number.getCountryCode(); + int countryCallingCode = number.getCountryCode(); String nationalSignificantNumber = getNationalSignificantNumber(number); - // Note getRegionCodeForCountryCode() is used because formatting information for countries which - // share a country code is contained by only one country for performance reasons. For example, - // for NANPA countries it will be contained in the metadata for US. - String regionCode = getRegionCodeForCountryCode(countryCode); - if (!isValidRegionCode(regionCode)) { + // Note getRegionCodeForCountryCode() is used because formatting information for regions which + // share a country calling code is contained by only one region for performance reasons. For + // example, for NANPA regions it will be contained in the metadata for US. + String regionCode = getRegionCodeForCountryCode(countryCallingCode); + if (!hasValidRegionCode(regionCode, countryCallingCode, nationalSignificantNumber)) { return nationalSignificantNumber; } @@ -885,26 +930,27 @@ public class PhoneNumberUtil { regionCode, PhoneNumberFormat.NATIONAL, carrierCode)); - maybeGetFormattedExtension(number, regionCode, formattedNumber); - formatNumberByFormat(countryCode, PhoneNumberFormat.NATIONAL, formattedNumber); + maybeGetFormattedExtension(number, regionCode, PhoneNumberFormat.NATIONAL, formattedNumber); + formatNumberByFormat(countryCallingCode, PhoneNumberFormat.NATIONAL, formattedNumber); return formattedNumber.toString(); } /** * Formats a phone number in national format for dialing using the carrier as specified in the - * preferred_domestic_carrier_code field of the PhoneNumber object passed in. If that is missing, - * use the fallbackCarrierCode passed in instead. If there is no preferred_domestic_carrier_code, - * and the fallbackCarrierCode contains an empty string, return the number in national format - * without any carrier code. + * preferredDomesticCarrierCode field of the PhoneNumber object passed in. If that is missing, + * use the {@code fallbackCarrierCode} passed in instead. If there is no + * {@code preferredDomesticCarrierCode}, and the {@code fallbackCarrierCode} contains an empty + * string, return the number in national format without any carrier code. * - * Use formatNationalNumberWithCarrierCode instead if the carrier code passed in should take - * precedence over the number's preferred_domestic_carrier_code when formatting. + *

Use {@link #formatNationalNumberWithCarrierCode} instead if the carrier code passed in + * should take precedence over the number's {@code preferredDomesticCarrierCode} when formatting. * * @param number the phone number to be formatted * @param fallbackCarrierCode the carrier selection code to be used, if none is found in the - * phone number itself + * phone number itself * @return the formatted phone number in national format for dialing using the number's - * preferred_domestic_carrier_code, or the fallbackCarrierCode passed in if none is found + * {@code preferredDomesticCarrierCode}, or the {@code fallbackCarrierCode} passed in if + * none is found */ public String formatNationalNumberWithPreferredCarrierCode(PhoneNumber number, String fallbackCarrierCode) { @@ -914,56 +960,55 @@ public class PhoneNumberUtil { } /** - * Formats a phone number for out-of-country dialing purpose. If no countryCallingFrom - * is supplied, we format the number in its INTERNATIONAL format. If the countryCallingFrom is - * the same as the country where the number is from, then NATIONAL formatting will be applied. + * Formats a phone number for out-of-country dialing purposes. If no countryCallingFrom is + * supplied, we format the number in its INTERNATIONAL format. If the country calling code is the + * same as the region where the number is from, then NATIONAL formatting will be applied. * - * If the number itself has a country code of zero or an otherwise invalid country code, then we - * return the number with no formatting applied. + *

If the number itself has a country calling code of zero or an otherwise invalid country + * calling code, then we return the number with no formatting applied. * - * Note this function takes care of the case for calling inside of NANPA and between Russia and - * Kazakhstan (who share the same country code). In those cases, no international prefix is used. - * For countries which have multiple international prefixes, the number in its INTERNATIONAL - * format will be returned instead. + *

Note this function takes care of the case for calling inside of NANPA and between Russia and + * Kazakhstan (who share the same country calling code). In those cases, no international prefix + * is used. For regions which have multiple international prefixes, the number in its + * INTERNATIONAL format will be returned instead. * * @param number the phone number to be formatted - * @param countryCallingFrom the ISO 3166-1 two-letter country code that denotes - * the foreign country where the call is being placed + * @param regionCallingFrom the ISO 3166-1 two-letter region code that denotes the region + * where the call is being placed * @return the formatted phone number */ - public String formatOutOfCountryCallingNumber(PhoneNumber number, - String countryCallingFrom) { - if (!isValidRegionCode(countryCallingFrom)) { + public String formatOutOfCountryCallingNumber(PhoneNumber number, String regionCallingFrom) { + if (!isValidRegionCode(regionCallingFrom)) { return format(number, PhoneNumberFormat.INTERNATIONAL); } - int countryCode = number.getCountryCode(); - String regionCode = getRegionCodeForCountryCode(countryCode); + int countryCallingCode = number.getCountryCode(); + String regionCode = getRegionCodeForCountryCode(countryCallingCode); String nationalSignificantNumber = getNationalSignificantNumber(number); if (!isValidRegionCode(regionCode)) { return nationalSignificantNumber; } - if (countryCode == NANPA_COUNTRY_CODE) { - if (isNANPACountry(countryCallingFrom)) { - // For NANPA countries, return the national format for these countries but prefix it with - // the country code. - return countryCode + " " + format(number, PhoneNumberFormat.NATIONAL); + if (countryCallingCode == NANPA_COUNTRY_CODE) { + if (isNANPACountry(regionCallingFrom)) { + // For NANPA regions, return the national format for these regions but prefix it with the + // country calling code. + return countryCallingCode + " " + format(number, PhoneNumberFormat.NATIONAL); } - } else if (countryCode == getCountryCodeForRegion(countryCallingFrom)) { - // For countries that share a country calling code, the country code need not be dialled. This - // also applies when dialling within a country, so this if clause covers both these cases. - // Technically this is the case for dialling from la Reunion to other overseas departments of + } else if (countryCallingCode == getCountryCodeForRegion(regionCallingFrom)) { + // For regions that share a country calling code, the country calling code need not be dialled. + // This also applies when dialling within a region, so this if clause covers both these cases. + // Technically this is the case for dialling from La Reunion to other overseas departments of // France (French Guiana, Martinique, Guadeloupe), but not vice versa - so we don't cover this - // edge case for now and for those cases return the version including country code. + // edge case for now and for those cases return the version including country calling code. // Details here: http://www.petitfute.com/voyage/225-info-pratiques-reunion return format(number, PhoneNumberFormat.NATIONAL); } String formattedNationalNumber = formatNationalNumber(nationalSignificantNumber, regionCode, PhoneNumberFormat.INTERNATIONAL); - PhoneMetadata metadata = getMetadataForRegion(countryCallingFrom); + PhoneMetadata metadata = getMetadataForRegion(regionCallingFrom); String internationalPrefix = metadata.getInternationalPrefix(); - // For countries that have multiple international prefixes, the international format of the + // For regions that have multiple international prefixes, the international format of the // number is returned, unless there is a preferred international prefix. String internationalPrefixForFormatting = ""; if (UNIQUE_INTERNATIONAL_PREFIX.matcher(internationalPrefix).matches()) { @@ -973,12 +1018,13 @@ public class PhoneNumberUtil { } StringBuffer formattedNumber = new StringBuffer(formattedNationalNumber); - maybeGetFormattedExtension(number, regionCode, formattedNumber); + maybeGetFormattedExtension(number, regionCode, PhoneNumberFormat.INTERNATIONAL, + formattedNumber); if (internationalPrefixForFormatting.length() > 0) { - formattedNumber.insert(0, " ").insert(0, countryCode).insert(0, " ") + formattedNumber.insert(0, " ").insert(0, countryCallingCode).insert(0, " ") .insert(0, internationalPrefixForFormatting); } else { - formatNumberByFormat(countryCode, + formatNumberByFormat(countryCallingCode, PhoneNumberFormat.INTERNATIONAL, formattedNumber); } @@ -991,12 +1037,12 @@ public class PhoneNumberUtil { * passed in. If such information is missing, the number will be formatted into the NATIONAL * format by default. * - * @param number the PhoneNumber that needs to be formatted in its original number format - * @param countryCallingFrom the country whose IDD needs to be prefixed if the original number + * @param number the phone number that needs to be formatted in its original number format + * @param regionCallingFrom the region whose IDD needs to be prefixed if the original number * has one * @return the formatted phone number in its original number format */ - public String formatInOriginalFormat(PhoneNumber number, String countryCallingFrom) { + public String formatInOriginalFormat(PhoneNumber number, String regionCallingFrom) { if (!number.hasCountryCodeSource()) { return format(number, PhoneNumberFormat.NATIONAL); } @@ -1004,7 +1050,7 @@ public class PhoneNumberUtil { case FROM_NUMBER_WITH_PLUS_SIGN: return format(number, PhoneNumberFormat.INTERNATIONAL); case FROM_NUMBER_WITH_IDD: - return formatOutOfCountryCallingNumber(number, countryCallingFrom); + return formatOutOfCountryCallingNumber(number, regionCallingFrom); case FROM_NUMBER_WITHOUT_PLUS_SIGN: return format(number, PhoneNumberFormat.INTERNATIONAL).substring(1); case FROM_DEFAULT_COUNTRY: @@ -1013,6 +1059,105 @@ public class PhoneNumberUtil { } } + /** + * Formats a phone number for out-of-country dialing purposes. + * + * Note that in this version, if the number was entered originally using alpha characters and + * this version of the number is stored in raw_input, this representation of the number will be + * used rather than the digit representation. Grouping information, as specified by characters + * such as "-" and " ", will be retained. + * + *

Caveats:

+ *
    + *
  • This will not produce good results if the country calling code is both present in the raw + * input _and_ is the start of the national number. This is not a problem in the regions + * which typically use alpha numbers. + *
  • This will also not produce good results if the raw input has any grouping information + * within the first three digits of the national number, and if the function needs to strip + * preceding digits/words in the raw input before these digits. Normally people group the + * first three digits together so this is not a huge problem - and will be fixed if it + * proves to be so. + *
+ * + * @param number the phone number that needs to be formatted + * @param regionCallingFrom the region where the call is being placed + * @return the formatted phone number + */ + public String formatOutOfCountryKeepingAlphaChars(PhoneNumber number, String regionCallingFrom) { + String rawInput = number.getRawInput(); + // If there is no raw input, then we can't keep alpha characters because there aren't any. + // In this case, we return formatOutOfCountryCallingNumber. + if (rawInput.length() == 0) { + return formatOutOfCountryCallingNumber(number, regionCallingFrom); + } + int countryCode = number.getCountryCode(); + String regionCode = getRegionCodeForCountryCode(countryCode); + if (!hasValidRegionCode(regionCode, countryCode, rawInput)) { + return rawInput; + } + // Strip any prefix such as country calling code, IDD, that was present. We do this by comparing + // the number in raw_input with the parsed number. + // To do this, first we normalize punctuation. We retain number grouping symbols such as " " + // only. + rawInput = normalizeHelper(rawInput, ALL_PLUS_NUMBER_GROUPING_SYMBOLS, true); + // Now we trim everything before the first three digits in the parsed number. We choose three + // because all valid alpha numbers have 3 digits at the start - if it does not, then we don't + // trim anything at all. Similarly, if the national number was less than three digits, we don't + // trim anything at all. + String nationalNumber = getNationalSignificantNumber(number); + if (nationalNumber.length() > 3) { + int firstNationalNumberDigit = rawInput.indexOf(nationalNumber.substring(0, 3)); + if (firstNationalNumberDigit != -1) { + rawInput = rawInput.substring(firstNationalNumberDigit); + } + } + PhoneMetadata metadata = getMetadataForRegion(regionCallingFrom); + if (countryCode == NANPA_COUNTRY_CODE) { + if (isNANPACountry(regionCallingFrom)) { + return countryCode + " " + rawInput; + } + } else if (countryCode == getCountryCodeForRegion(regionCallingFrom)) { + // Here we copy the formatting rules so we can modify the pattern we expect to match against. + List availableFormats = + new ArrayList(metadata.numberFormatSize()); + for (NumberFormat format : metadata.numberFormats()) { + NumberFormat newFormat = new NumberFormat(); + newFormat.mergeFrom(format); + // The first group is the first group of digits that the user determined. + newFormat.setPattern("(\\d+)(.*)"); + // Here we just concatenate them back together after the national prefix has been fixed. + newFormat.setFormat("$1$2"); + availableFormats.add(newFormat); + } + // Now we format using these patterns instead of the default pattern, but with the national + // prefix prefixed if necessary, by choosing the format rule based on the leading digits + // present in the unformatted national number. + // This will not work in the cases where the pattern (and not the leading digits) decide + // whether a national prefix needs to be used, since we have overridden the pattern to match + // anything, but that is not the case in the metadata to date. + return formatAccordingToFormats(rawInput, availableFormats, PhoneNumberFormat.NATIONAL); + } + String internationalPrefix = metadata.getInternationalPrefix(); + // For countries that have multiple international prefixes, the international format of the + // number is returned, unless there is a preferred international prefix. + String internationalPrefixForFormatting = + UNIQUE_INTERNATIONAL_PREFIX.matcher(internationalPrefix).matches() + ? internationalPrefix + : metadata.getPreferredInternationalPrefix(); + StringBuffer formattedNumber = new StringBuffer(rawInput); + maybeGetFormattedExtension(number, regionCode, PhoneNumberFormat.INTERNATIONAL, + formattedNumber); + if (internationalPrefixForFormatting.length() > 0) { + formattedNumber.insert(0, " ").insert(0, countryCode).insert(0, " ") + .insert(0, internationalPrefixForFormatting); + } else { + formatNumberByFormat(countryCode, + PhoneNumberFormat.INTERNATIONAL, + formattedNumber); + } + return formattedNumber.toString(); + } + /** * Gets the national significant number of the a phone number. Note a national significant number * doesn't contain a national prefix or any formatting. @@ -1020,17 +1165,17 @@ public class PhoneNumberUtil { * @param number the PhoneNumber object for which the national significant number is needed * @return the national significant number of the PhoneNumber object passed in */ - public static String getNationalSignificantNumber(PhoneNumber number) { + public String getNationalSignificantNumber(PhoneNumber number) { // The leading zero in the national (significant) number of an Italian phone number has a // special meaning. Unlike the rest of the world, it indicates the number is a landline // number. There have been plans to migrate landline numbers to start with the digit two since // December 2000, but it has not yet happened. // See http://en.wikipedia.org/wiki/%2B39 for more details. - // Other countries such as Cote d'Ivoire and Gabon use this for their mobile numbers. + // Other regions such as Cote d'Ivoire and Gabon use this for their mobile numbers. StringBuffer nationalNumber = new StringBuffer( (number.hasItalianLeadingZero() && number.getItalianLeadingZero() && - isLeadingZeroCountry(number.getCountryCode())) + isLeadingZeroPossible(number.getCountryCode())) ? "0" : "" ); nationalNumber.append(number.getNationalNumber()); @@ -1040,15 +1185,18 @@ public class PhoneNumberUtil { /** * A helper function that is used by format and formatByPattern. */ - private void formatNumberByFormat(int countryCode, + private void formatNumberByFormat(int countryCallingCode, PhoneNumberFormat numberFormat, StringBuffer formattedNumber) { switch (numberFormat) { case E164: - formattedNumber.insert(0, countryCode).insert(0, PLUS_SIGN); + formattedNumber.insert(0, countryCallingCode).insert(0, PLUS_SIGN); return; case INTERNATIONAL: - formattedNumber.insert(0, " ").insert(0, countryCode).insert(0, PLUS_SIGN); + formattedNumber.insert(0, " ").insert(0, countryCallingCode).insert(0, PLUS_SIGN); + return; + case RFC3966: + formattedNumber.insert(0, "-").insert(0, countryCallingCode) .insert(0, PLUS_SIGN); return; case NATIONAL: default: @@ -1063,7 +1211,7 @@ public class PhoneNumberUtil { return formatNationalNumber(number, regionCode, numberFormat, null); } - // Note in some countries, the national number can be written in two completely different ways + // Note in some regions, the national number can be written in two completely different ways // depending on whether it forms part of the NATIONAL format or INTERNATIONAL format. The // numberFormat parameter here is used to specify which format to use for those cases. If a // carrierCode is specified, this will be inserted into the formatted string to replace $CC. @@ -1072,14 +1220,20 @@ public class PhoneNumberUtil { PhoneNumberFormat numberFormat, String carrierCode) { PhoneMetadata metadata = getMetadataForRegion(regionCode); - List intlNumberFormats = metadata.getIntlNumberFormatList(); + List intlNumberFormats = metadata.intlNumberFormats(); // When the intlNumberFormats exists, we use that to format national number for the // INTERNATIONAL format instead of using the numberDesc.numberFormats. List availableFormats = (intlNumberFormats.size() == 0 || numberFormat == PhoneNumberFormat.NATIONAL) - ? metadata.getNumberFormatList() - : metadata.getIntlNumberFormatList(); - return formatAccordingToFormats(number, availableFormats, numberFormat, carrierCode); + ? metadata.numberFormats() + : metadata.intlNumberFormats(); + String formattedNationalNumber = + formatAccordingToFormats(number, availableFormats, numberFormat, carrierCode); + if (numberFormat == PhoneNumberFormat.RFC3966) { + formattedNationalNumber = + SEPARATOR_PATTERN.matcher(formattedNationalNumber).replaceAll("-"); + } + return formattedNationalNumber; } // Simple wrapper of formatAccordingToFormats for the common case of no carrier code. @@ -1096,7 +1250,7 @@ public class PhoneNumberUtil { PhoneNumberFormat numberFormat, String carrierCode) { for (NumberFormat numFormat : availableFormats) { - int size = numFormat.getLeadingDigitsPatternCount(); + int size = numFormat.leadingDigitsPatternSize(); if (size == 0 || regexCache.getPatternForRegex( // We always use the last leading_digits_pattern, as it is the most detailed. numFormat.getLeadingDigitsPattern(size - 1)).matcher(nationalNumber).lookingAt()) { @@ -1136,11 +1290,11 @@ public class PhoneNumberUtil { } /** - * Gets a valid number for the specified country. + * Gets a valid number for the specified region. * - * @param regionCode the ISO 3166-1 two-letter country code that denotes - * the country for which an example number is needed - * @return a valid fixed-line number for the specified country. Returns null when the metadata + * @param regionCode the ISO 3166-1 two-letter region code that denotes + * the region for which an example number is needed + * @return a valid fixed-line number for the specified region. Returns null when the metadata * does not contain such information. */ public PhoneNumber getExampleNumber(String regionCode) { @@ -1148,12 +1302,12 @@ public class PhoneNumberUtil { } /** - * Gets a valid number for the specified country and number type. + * Gets a valid number for the specified region and number type. * - * @param regionCode the ISO 3166-1 two-letter country code that denotes - * the country for which an example number is needed + * @param regionCode the ISO 3166-1 two-letter region code that denotes + * the region for which an example number is needed * @param type the type of number that is needed - * @return a valid number for the specified country and type. Returns null when the metadata + * @return a valid number for the specified region and type. Returns null when the metadata * does not contain such information. */ public PhoneNumber getExampleNumberForType(String regionCode, PhoneNumberType type) { @@ -1173,18 +1327,28 @@ public class PhoneNumberUtil { * an extension specified. */ private void maybeGetFormattedExtension(PhoneNumber number, String regionCode, + PhoneNumberFormat numberFormat, StringBuffer formattedNumber) { - if (number.hasExtension()) { - // Formats the extension part of the phone number by prefixing it with the appropriate - // extension prefix. This will be the default extension prefix, unless overridden by a - // preferred extension prefix for this country. - PhoneMetadata metadata = getMetadataForRegion(regionCode); - if (metadata.hasPreferredExtnPrefix()) { - formattedNumber.append(metadata.getPreferredExtnPrefix()); + if (number.hasExtension() && number.getExtension().length() > 0) { + if (numberFormat == PhoneNumberFormat.RFC3966) { + formattedNumber.append(RFC3966_EXTN_PREFIX).append(number.getExtension()); } else { - formattedNumber.append(DEFAULT_EXTN_PREFIX); + formatExtension(number.getExtension(), regionCode, formattedNumber); } - formattedNumber.append(number.getExtension()); + } + } + + /** + * Formats the extension part of the phone number by prefixing it with the appropriate extension + * prefix. This will be the default extension prefix, unless overridden by a preferred + * extension prefix for this region. + */ + private void formatExtension(String extensionDigits, String regionCode, StringBuffer extension) { + PhoneMetadata metadata = getMetadataForRegion(regionCode); + if (metadata.hasPreferredExtnPrefix()) { + extension.append(metadata.getPreferredExtnPrefix()).append(extensionDigits); + } else { + extension.append(DEFAULT_EXTN_PREFIX).append(extensionDigits); } } @@ -1281,10 +1445,10 @@ public class PhoneNumberUtil { return null; } regionCode = regionCode.toUpperCase(); - if (!countryToMetadataMap.containsKey(regionCode)) { + if (!regionToMetadataMap.containsKey(regionCode)) { loadMetadataForRegionFromFile(currentFilePrefix, regionCode); } - return countryToMetadataMap.get(regionCode); + return regionToMetadataMap.get(regionCode); } private boolean isNumberMatchingDesc(String nationalNumber, PhoneNumberDesc numberDesc) { @@ -1312,14 +1476,14 @@ public class PhoneNumberUtil { /** * Tests whether a phone number is valid for a certain region. Note this doesn't verify the number * is actually in use, which is impossible to tell by just looking at a number itself. If the - * country code is not the same as the country code for the region, this immediately exits with - * false. After this, the specific number pattern rules for the region are examined. This is - * useful for determining for example whether a particular number is valid for Canada, rather than - * just a valid NANPA number. + * country calling code is not the same as the country calling code for the region, this + * immediately exits with false. After this, the specific number pattern rules for the region are + * examined. This is useful for determining for example whether a particular number is valid for + * Canada, rather than just a valid NANPA number. * * @param number the phone number that we want to validate - * @param regionCode the ISO 3166-1 two-letter country code that denotes - * the region/country that we want to validate the phone number for + * @param regionCode the ISO 3166-1 two-letter region code that denotes the region that we want + * to validate the phone number for * @return a boolean that indicates whether the number is of a valid pattern */ public boolean isValidNumberForRegion(PhoneNumber number, String regionCode) { @@ -1330,8 +1494,8 @@ public class PhoneNumberUtil { PhoneNumberDesc generalNumDesc = metadata.getGeneralDesc(); String nationalSignificantNumber = getNationalSignificantNumber(number); - // For countries where we don't have metadata for PhoneNumberDesc, we treat any number passed - // in as a valid number if its national significant number is between the minimum and maximum + // For regions where we don't have metadata for PhoneNumberDesc, we treat any number passed in + // as a valid number if its national significant number is between the minimum and maximum // lengths defined by ITU for a national significant number. if (!generalNumDesc.hasNationalNumberPattern()) { int numberLength = nationalSignificantNumber.length(); @@ -1341,16 +1505,16 @@ public class PhoneNumberUtil { } /** - * Returns the country/region where a phone number is from. This could be used for geo-coding in - * the country/region level. + * Returns the region where a phone number is from. This could be used for geocoding at the region + * level. * * @param number the phone number whose origin we want to know - * @return the country/region where the phone number is from, or null if no country matches this - * calling code. + * @return the region where the phone number is from, or null if no region matches this calling + * code */ public String getRegionCodeForNumber(PhoneNumber number) { int countryCode = number.getCountryCode(); - List regions = countryCodeToRegionCodeMap.get(countryCode); + List regions = countryCallingCodeToRegionCodeMap.get(countryCode); if (regions == null) { return null; } @@ -1380,12 +1544,12 @@ public class PhoneNumberUtil { } /** - * Returns the region code that matches the specific country code. In the case of no region code - * being found, ZZ will be returned. In the case of multiple regions, the one designated in the - * metadata as the "main" country for this calling code will be returned. + * Returns the region code that matches the specific country calling code. In the case of no + * region code being found, ZZ will be returned. In the case of multiple regions, the one + * designated in the metadata as the "main" region for this calling code will be returned. */ - public String getRegionCodeForCountryCode(int countryCode) { - List regionCodes = countryCodeToRegionCodeMap.get(countryCode); + public String getRegionCodeForCountryCode(int countryCallingCode) { + List regionCodes = countryCallingCodeToRegionCodeMap.get(countryCallingCode); return regionCodes == null ? UNKNOWN_REGION : regionCodes.get(0); } @@ -1393,9 +1557,9 @@ public class PhoneNumberUtil { * Returns the country calling code for a specific region. For example, this would be 1 for the * United States, and 64 for New Zealand. * - * @param regionCode the ISO 3166-1 two-letter country code that denotes - * the country/region that we want to get the country code for - * @return the country calling code for the country/region denoted by regionCode + * @param regionCode the ISO 3166-1 two-letter region code that denotes + * the region that we want to get the country calling code for + * @return the country calling code for the region denoted by regionCode */ public int getCountryCodeForRegion(String regionCode) { if (!isValidRegionCode(regionCode)) { @@ -1414,23 +1578,23 @@ public class PhoneNumberUtil { * (which indicates a wait for a dialling tone) from the prefix returned. If no national prefix is * present, we return null. * - * Warning: Do not use this method for do-your-own formatting - for some countries, the national - * dialling prefix is used only for certain types of numbers. Use the library's formatting - * functions to prefix the national prefix when required. + *

Warning: Do not use this method for do-your-own formatting - for some regions, the + * national dialling prefix is used only for certain types of numbers. Use the library's + * formatting functions to prefix the national prefix when required. * - * @param regionCode the ISO 3166-1 two-letter country code that denotes - * the country/region that we want to get the dialling prefix for + * @param regionCode the ISO 3166-1 two-letter region code that denotes + * the region that we want to get the dialling prefix for * @param stripNonDigits true to strip non-digits from the national dialling prefix - * @return the dialling prefix for the country/region denoted by regionCode + * @return the dialling prefix for the region denoted by regionCode */ public String getNddPrefixForRegion(String regionCode, boolean stripNonDigits) { if (!isValidRegionCode(regionCode)) { - LOGGER.log(Level.SEVERE, "Invalid or missing country code provided."); + LOGGER.log(Level.SEVERE, "Invalid or missing region code provided."); return null; } PhoneMetadata metadata = getMetadataForRegion(regionCode); if (metadata == null) { - LOGGER.log(Level.SEVERE, "Unsupported country code provided."); + LOGGER.log(Level.SEVERE, "Unsupported region code provided."); return null; } String nationalPrefix = metadata.getNationalPrefix(); @@ -1447,26 +1611,51 @@ public class PhoneNumberUtil { } /** - * Check if a country is one of the countries under the North American Numbering Plan - * Administration (NANPA). + * Checks if this is a region under the North American Numbering Plan Administration (NANPA). * - * @return true if regionCode is one of the countries under NANPA + * @return true if regionCode is one of the regions under NANPA */ public boolean isNANPACountry(String regionCode) { - return regionCode != null && nanpaCountries.contains(regionCode.toUpperCase()); + return regionCode != null && nanpaRegions.contains(regionCode.toUpperCase()); } /** - * Check whether countryCode represents the country calling code from a country whose national - * significant number could contain a leading zero. An example of such a country is Italy. + * Checks whether countryCode represents the country calling code from a region whose national + * significant number could contain a leading zero. An example of such a region is Italy. Returns + * false if no metadata for the country is found. + */ + boolean isLeadingZeroPossible(int countryCallingCode) { + PhoneMetadata mainMetadataForCallingCode = getMetadataForRegion( + getRegionCodeForCountryCode(countryCallingCode)); + if (mainMetadataForCallingCode == null) { + return false; + } + return mainMetadataForCallingCode.isLeadingZeroPossible(); + } + + /** + * Checks if the number is a valid vanity (alpha) number such as 800 MICROSOFT. A valid vanity + * number will start with at least 3 digits and will have three or more alpha characters. This + * does not do region-specific checks - to work out if this number is actually valid for a region, + * it should be parsed and methods such as {@link #isPossibleNumberWithReason} and + * {@link #isValidNumber} should be used. + * + * @param number the number that needs to be checked + * @return true if the number is a valid vanity number */ - public static boolean isLeadingZeroCountry(int countryCode) { - return LEADING_ZERO_COUNTRIES.contains(countryCode); + public boolean isAlphaNumber(String number) { + if (!isViablePhoneNumber(number)) { + // Number is too short, or doesn't match the basic phone number pattern. + return false; + } + StringBuffer strippedNumber = new StringBuffer(number); + maybeStripExtension(strippedNumber); + return VALID_ALPHA_PHONE_PATTERN.matcher(strippedNumber).matches(); } /** - * Convenience wrapper around isPossibleNumberWithReason. Instead of returning the reason for - * failure, this method returns a boolean value. + * Convenience wrapper around {@link #isPossibleNumberWithReason}. Instead of returning the reason + * for failure, this method returns a boolean value. * @param number the number that needs to be checked * @return true if the number is possible */ @@ -1476,13 +1665,14 @@ public class PhoneNumberUtil { /** * Check whether a phone number is a possible number. It provides a more lenient check than - * isValidNumber in the following sense: - * 1. It only checks the length of phone numbers. In particular, it doesn't check starting + * {@link #isValidNumber} in the following sense: + *

    + *
  1. It only checks the length of phone numbers. In particular, it doesn't check starting * digits of the number. - * 2. It doesn't attempt to figure out the type of the number, but uses general rules which - * applies to all types of phone numbers in a country. Therefore, it is much faster than + *
  2. It doesn't attempt to figure out the type of the number, but uses general rules which + * applies to all types of phone numbers in a region. Therefore, it is much faster than * isValidNumber. - * 3. For fixed line numbers, many countries have the concept of area code, which together with + *
  3. For fixed line numbers, many regions have the concept of area code, which together with * subscriber number constitute the national significant number. It is sometimes okay to dial * the subscriber number only when dialing in the same area. This function will return * true if the subscriber-number-only version is passed in. On the other hand, because @@ -1490,21 +1680,21 @@ public class PhoneNumberUtil { * numbers, that would most likely be area codes) and length (obviously includes the * length of area codes for fixed line numbers), it will return false for the * subscriber-number-only version. - * + *
This method first parses the number, then invokes {@link #isPossibleNumber(PhoneNumber + * number)} with the resultant PhoneNumber object. * * @param number the number that needs to be checked, in the form of a string - * @param countryDialingFrom the ISO 3166-1 two-letter country code that denotes - * the country that we are expecting the number to be dialed from. - * Note this is different from the country where the number belongs. For example, the number + * @param regionDialingFrom the ISO 3166-1 two-letter region code that denotes the region that + * we are expecting the number to be dialed from. + * Note this is different from the region where the number belongs. For example, the number * +1 650 253 0000 is a number that belongs to US. When written in this form, it could be - * dialed from any country. When it is written as 00 1 650 253 0000, it could be dialed from - * any country which uses an international dialling prefix of 00. When it is written as 650 + * dialed from any region. When it is written as 00 1 650 253 0000, it could be dialed from + * any region which uses an international dialling prefix of 00. When it is written as 650 * 253 0000, it could only be dialed from within the US, and when written as 253 0000, it * could only be dialed from within a smaller area in the US (Mountain View, CA, to be more * specific). * @return true if the number is possible */ - public boolean isPossibleNumber(String number, String countryDialingFrom) { + public boolean isPossibleNumber(String number, String regionDialingFrom) { try { - return isPossibleNumber(parse(number, countryDialingFrom)); + return isPossibleNumber(parse(number, regionDialingFrom)); } catch (NumberParseException e) { return false; } @@ -1583,27 +1773,28 @@ public class PhoneNumberUtil { } /** - * Gets an AsYouTypeFormatter for the specific country. + * Gets an {@link com.google.i18n.phonenumbers.AsYouTypeFormatter} for the specific region. * - * @param regionCode the ISO 3166-1 two-letter country code that denotes the - * country/region where the phone number is being entered + * @param regionCode the ISO 3166-1 two-letter region code that denotes the region where + * the phone number is being entered * - * @return an AsYouTypeFormatter object, which could be used to format phone numbers in the - * specific country "as you type" + * @return an {@link com.google.i18n.phonenumbers.AsYouTypeFormatter} object, which could be used + * to format phone numbers in the specific region "as you type" */ public AsYouTypeFormatter getAsYouTypeFormatter(String regionCode) { return new AsYouTypeFormatter(regionCode); } - // Extracts country code from fullNumber, returns it and places the remaining number in + // Extracts country calling code from fullNumber, returns it and places the remaining number in // nationalNumber. It assumes that the leading plus sign or IDD has already been removed. Returns - // 0 if fullNumber doesn't start with a valid country code, and leaves nationalNumber unmodified. + // 0 if fullNumber doesn't start with a valid country calling code, and leaves nationalNumber + // unmodified. int extractCountryCode(StringBuffer fullNumber, StringBuffer nationalNumber) { int potentialCountryCode; int numberLength = fullNumber.length(); for (int i = 1; i <= MAX_LENGTH_COUNTRY_CODE && i <= numberLength; i++) { potentialCountryCode = Integer.parseInt(fullNumber.substring(0, i)); - if (countryCodeToRegionCodeMap.containsKey(potentialCountryCode)) { + if (countryCallingCodeToRegionCodeMap.containsKey(potentialCountryCode)) { nationalNumber.append(fullNumber.substring(i)); return potentialCountryCode; } @@ -1612,32 +1803,35 @@ public class PhoneNumberUtil { } /** - * Tries to extract a country code from a number. This method will return zero if no country code - * is considered to be present. Country codes are extracted in the following ways: - * - by stripping the international dialing prefix of the country the person is dialing from, + * Tries to extract a country calling code from a number. This method will return zero if no + * country calling code is considered to be present. Country calling codes are extracted in the + * following ways: + *
    + *
  • by stripping the international dialing prefix of the region the person is dialing from, * if this is present in the number, and looking at the next digits - * - by stripping the '+' sign if present and then looking at the next digits - * - by comparing the start of the number and the country code of the default region. If the - * number is not considered possible for the numbering plan of the default region initially, - * but starts with the country code of this region, validation will be reattempted after - * stripping this country code. If this number is considered a possible number, then the - * first digits will be considered the country code and removed as such. - * - * It will throw a NumberParseException if the number starts with a '+' but the country code - * supplied after this does not match that of any known country. + *
  • by stripping the '+' sign if present and then looking at the next digits + *
  • by comparing the start of the number and the country calling code of the default region. + * If the number is not considered possible for the numbering plan of the default region + * initially, but starts with the country calling code of this region, validation will be + * reattempted after stripping this country calling code. If this number is considered a + * possible number, then the first digits will be considered the country calling code and + * removed as such. + *
+ * It will throw a NumberParseException if the number starts with a '+' but the country calling + * code supplied after this does not match that of any known region. * - * @param number non-normalized telephone number that we wish to extract a country + * @param number non-normalized telephone number that we wish to extract a country calling * code from - may begin with '+' * @param defaultRegionMetadata metadata about the region this number may be from * @param nationalNumber a string buffer to store the national significant number in, in the case - * that a country code was extracted. The number is appended to any existing contents. If no - * country code was extracted, this will be left unchanged. + * that a country calling code was extracted. The number is appended to any existing contents. + * If no country calling code was extracted, this will be left unchanged. * @param keepRawInput true if the country_code_source and preferred_carrier_code fields of * phoneNumber should be populated. - * @param phoneNumber the PhoneNumber object that needs to be populated with country code and - * country code source. Note the country code is always populated, whereas country code source - * is only populated when keepCountryCodeSource is true. - * @return the country code extracted or 0 if none could be extracted + * @param phoneNumber the PhoneNumber object where the country_code and country_code_source need + * to be populated. Note the country_code is always populated, whereas country_code_source is + * only populated when keepCountryCodeSource is true. + * @return the country calling code extracted or 0 if none could be extracted */ int maybeExtractCountryCode(String number, PhoneMetadata defaultRegionMetadata, StringBuffer nationalNumber, boolean keepRawInput, @@ -1670,13 +1864,14 @@ public class PhoneNumberUtil { return potentialCountryCode; } - // If this fails, they must be using a strange country code that we don't recognize, or - // that doesn't exist. + // If this fails, they must be using a strange country calling code that we don't recognize, + // or that doesn't exist. throw new NumberParseException(NumberParseException.ErrorType.INVALID_COUNTRY_CODE, - "Country code supplied was not recognised."); + "Country calling code supplied was not recognised."); } else if (defaultRegionMetadata != null) { // Check to see if the number is valid for the default region already. If not, we check to - // see if the country code for the default region is present at the start of the number. + // see if the country calling code for the default region is present at the start of the + // number. PhoneNumberDesc generalDesc = defaultRegionMetadata.getGeneralDesc(); Pattern validNumberPattern = regexCache.getPatternForRegex(generalDesc.getNationalNumberPattern()); @@ -1692,8 +1887,9 @@ public class PhoneNumberUtil { Matcher possibleNumberMatcher = regexCache.getPatternForRegex(generalDesc.getPossibleNumberPattern()).matcher( potentialNationalNumber); - // If the resultant number is either valid, or still too long even with the country code - // stripped, we consider this a better result and keep the potential national number. + // If the resultant number is either valid, or still too long even with the country + // calling code stripped, we consider this a better result and keep the potential national + // number. if (validNumberPattern.matcher(potentialNationalNumber).matches() || (possibleNumberMatcher.lookingAt() && possibleNumberMatcher.end() != potentialNationalNumber.length())) { @@ -1707,7 +1903,7 @@ public class PhoneNumberUtil { } } } - // No country code present. + // No country calling code present. phoneNumber.setCountryCode(0); return 0; } @@ -1720,8 +1916,8 @@ public class PhoneNumberUtil { Matcher m = iddPattern.matcher(number); if (m.lookingAt()) { int matchEnd = m.end(); - // Only strip this if the first digit after the match is not a 0, since country codes cannot - // begin with 0. + // Only strip this if the first digit after the match is not a 0, since country calling codes + // cannot begin with 0. Matcher digitMatcher = CAPTURING_DIGIT_PATTERN.matcher(number.substring(matchEnd)); if (digitMatcher.find()) { String normalizedGroup = normalizeHelper(digitMatcher.group(1), DIGIT_MAPPINGS, true); @@ -1741,7 +1937,7 @@ public class PhoneNumberUtil { * * @param number the non-normalized telephone number that we wish to strip any international * dialing prefix from. - * @param possibleIddPrefix the international direct dialing prefix from the country we + * @param possibleIddPrefix the international direct dialing prefix from the region we * think this number may be dialed in * @return the corresponding CountryCodeSource if an international dialing prefix could be * removed from the number, otherwise CountryCodeSource.FROM_DEFAULT_COUNTRY if the @@ -1781,7 +1977,7 @@ public class PhoneNumberUtil { * * @param number the normalized telephone number that we wish to strip any national * dialing prefix from - * @param metadata the metadata for the country that we think this number is from + * @param metadata the metadata for the region that we think this number is from * @return the carrier code extracted if it is present, otherwise return an empty string. */ String maybeStripNationalPrefixAndCarrierCode(StringBuffer number, PhoneMetadata metadata) { @@ -1859,12 +2055,12 @@ public class PhoneNumberUtil { /** * Checks to see that the region code used is valid, or if it is not valid, that the number to - * parse starts with a + symbol so that we can attempt to infer the country from the number. + * parse starts with a + symbol so that we can attempt to infer the region from the number. * Returns false if it cannot use the region provided and the region cannot be inferred. */ - private boolean checkRegionForParsing(String numberToParse, String defaultCountry) { - if (!isValidRegionCode(defaultCountry)) { - // If the number is null or empty, we can't guess the country code. + private boolean checkRegionForParsing(String numberToParse, String defaultRegion) { + if (!isValidRegionCode(defaultRegion)) { + // If the number is null or empty, we can't infer the region. if (numberToParse == null || numberToParse.length() == 0 || !PLUS_CHARS_PATTERN.matcher(numberToParse).lookingAt()) { return false; @@ -1875,95 +2071,95 @@ public class PhoneNumberUtil { /** * Parses a string and returns it in proto buffer format. This method will throw a - * NumberParseException exception if the number is not considered to be a possible number. Note - * that validation of whether the number is actually a valid number for a particular - * country/region is not performed. This can be done separately with isValidNumber. + * {@link com.google.i18n.phonenumbers.NumberParseException} if the number is not considered to be + * a possible number. Note that validation of whether the number is actually a valid number for a + * particular region is not performed. This can be done separately with {@link #isValidNumber}. * * @param numberToParse number that we are attempting to parse. This can contain formatting * such as +, ( and -, as well as a phone number extension. - * @param defaultCountry the ISO 3166-1 two-letter country code that denotes the - * country that we are expecting the number to be from. This is only used - * if the number being parsed is not written in international format. - * The country code for the number in this case would be stored as that - * of the default country supplied. If the number is guaranteed to - * start with a '+' followed by the country code, then "ZZ" or + * @param defaultRegion the ISO 3166-1 two-letter region code that denotes the region that we + * are expecting the number to be from. This is only used if the number + * being parsed is not written in international format. + * The country_code for the number in this case would be stored as that + * of the default region supplied. If the number is guaranteed to + * start with a '+' followed by the country calling code, then "ZZ" or * null can be supplied. * @return a phone number proto buffer filled with the parsed number * @throws NumberParseException if the string is not considered to be a viable phone number or if - * no default country was supplied and the number is not in + * no default region was supplied and the number is not in * international format (does not start with +) */ - public PhoneNumber parse(String numberToParse, String defaultCountry) + public PhoneNumber parse(String numberToParse, String defaultRegion) throws NumberParseException { PhoneNumber phoneNumber = new PhoneNumber(); - parse(numberToParse, defaultCountry, phoneNumber); + parse(numberToParse, defaultRegion, phoneNumber); return phoneNumber; } // Same as parse(String, String), but accepts mutable PhoneNumber as a parameter to // decrease object creation when invoked many times. - public void parse(String numberToParse, String defaultCountry, PhoneNumber phoneNumber) + public void parse(String numberToParse, String defaultRegion, PhoneNumber phoneNumber) throws NumberParseException { - parseHelper(numberToParse, defaultCountry, false, true, phoneNumber); + parseHelper(numberToParse, defaultRegion, false, true, phoneNumber); } /** - * Parses a string and returns it in proto buffer format. This method differs from parse() in that - * it always populates the raw_input field of the protocol buffer with numberToParse as well as - * the country_code_source field. + * Parses a string and returns it in proto buffer format. This method differs from {@link #parse} + * in that it always populates the raw_input field of the protocol buffer with numberToParse as + * well as the country_code_source field. * * @param numberToParse number that we are attempting to parse. This can contain formatting * such as +, ( and -, as well as a phone number extension. - * @param defaultCountry the ISO 3166-1 two-letter country code that denotes the country that + * @param defaultRegion the ISO 3166-1 two-letter region code that denotes the region that * we are expecting the number to be from. This is only used if the * number being parsed is not written in international format. The - * country code for the number in this case would be stored as that of - * the default country supplied. + * country calling code for the number in this case would be stored as + * that of the default region supplied. * @return a phone number proto buffer filled with the parsed number * @throws NumberParseException if the string is not considered to be a viable phone number or if - * no default country was supplied + * no default region was supplied */ - public PhoneNumber parseAndKeepRawInput(String numberToParse, String defaultCountry) + public PhoneNumber parseAndKeepRawInput(String numberToParse, String defaultRegion) throws NumberParseException { PhoneNumber phoneNumber = new PhoneNumber(); - parseAndKeepRawInput(numberToParse, defaultCountry, phoneNumber); + parseAndKeepRawInput(numberToParse, defaultRegion, phoneNumber); return phoneNumber; } // Same as parseAndKeepRawInput(String, String), but accepts mutable PhoneNumber as a parameter to // decrease object creation when invoked many times. - public void parseAndKeepRawInput(String numberToParse, String defaultCountry, + public void parseAndKeepRawInput(String numberToParse, String defaultRegion, PhoneNumber phoneNumber) throws NumberParseException { - parseHelper(numberToParse, defaultCountry, true, true, phoneNumber); + parseHelper(numberToParse, defaultRegion, true, true, phoneNumber); } /** * Returns an iterable over all {@link PhoneNumberMatch PhoneNumberMatches} in {@code text}. This * is a shortcut for {@link #findNumbers(CharSequence, String, Leniency, long) - * getMatcher(text, defaultCountry, Leniency.VALID, Long.MAX_VALUE)}. + * getMatcher(text, defaultRegion, Leniency.VALID, Long.MAX_VALUE)}. * * @param text the text to search for phone numbers, null for no text - * @param defaultCountry the ISO 3166-1 two-letter country code that denotes the country that + * @param defaultRegion the ISO 3166-1 two-letter region code that denotes the region that * we are expecting the number to be from. This is only used if the * number being parsed is not written in international format. The - * country code for the number in this case would be stored as that of - * the default country supplied. May be null if only international + * country calling code for the number in this case would be stored as + * that of the default region supplied. May be null if only international * numbers are expected. */ - public Iterable findNumbers(CharSequence text, String defaultCountry) { - return findNumbers(text, defaultCountry, Leniency.VALID, Long.MAX_VALUE); + public Iterable findNumbers(CharSequence text, String defaultRegion) { + return findNumbers(text, defaultRegion, Leniency.VALID, Long.MAX_VALUE); } /** * Returns an iterable over all {@link PhoneNumberMatch PhoneNumberMatches} in {@code text}. * * @param text the text to search for phone numbers, null for no text - * @param defaultCountry the ISO 3166-1 two-letter country code that denotes the country that + * @param defaultRegion the ISO 3166-1 two-letter region code that denotes the region that * we are expecting the number to be from. This is only used if the * number being parsed is not written in international format. The - * country code for the number in this case would be stored as that of - * the default country supplied. May be null if only international + * country calling code for the number in this case would be stored as + * that of the default region supplied. May be null if only international * numbers are expected. * @param leniency the leniency to use when evaluating candidate phone numbers * @param maxTries the maximum number of invalid numbers to try before giving up on the @@ -1971,24 +2167,24 @@ public class PhoneNumberUtil { * false positives in it. Must be {@code >= 0}. */ public Iterable findNumbers( - final CharSequence text, final String defaultCountry, final Leniency leniency, + final CharSequence text, final String defaultRegion, final Leniency leniency, final long maxTries) { return new Iterable() { public Iterator iterator() { return new PhoneNumberMatcher( - PhoneNumberUtil.this, text, defaultCountry, leniency, maxTries); + PhoneNumberUtil.this, text, defaultRegion, leniency, maxTries); } }; } /** * Parses a string and fills up the phoneNumber. This method is the same as the public - * parse() method, with the exception that it allows the default country to be null, for use by - * isNumberMatch(). checkRegion should be set to false if it is permitted for the default country + * parse() method, with the exception that it allows the default region to be null, for use by + * isNumberMatch(). checkRegion should be set to false if it is permitted for the default region * to be null or unknown ("ZZ"). */ - private void parseHelper(String numberToParse, String defaultCountry, boolean keepRawInput, + private void parseHelper(String numberToParse, String defaultRegion, boolean keepRawInput, boolean checkRegion, PhoneNumber phoneNumber) throws NumberParseException { if (numberToParse == null) { @@ -2003,42 +2199,42 @@ public class PhoneNumberUtil { "The string supplied did not seem to be a phone number."); } - // Check the country supplied is valid, or that the extracted number starts with some sort of + + // Check the region supplied is valid, or that the extracted number starts with some sort of + // sign so the number's region can be determined. - if (checkRegion && !checkRegionForParsing(number, defaultCountry)) { + if (checkRegion && !checkRegionForParsing(number, defaultRegion)) { throw new NumberParseException(NumberParseException.ErrorType.INVALID_COUNTRY_CODE, - "Missing or invalid default country."); + "Missing or invalid default region."); } if (keepRawInput) { phoneNumber.setRawInput(numberToParse); } StringBuffer nationalNumber = new StringBuffer(number); - // Attempt to parse extension first, since it doesn't require country-specific data and we want + // Attempt to parse extension first, since it doesn't require region-specific data and we want // to have the non-normalised number here. String extension = maybeStripExtension(nationalNumber); if (extension.length() > 0) { phoneNumber.setExtension(extension); } - PhoneMetadata countryMetadata = getMetadataForRegion(defaultCountry); + PhoneMetadata regionMetadata = getMetadataForRegion(defaultRegion); // Check to see if the number is given in international format so we know whether this number is - // from the default country or not. + // from the default region or not. StringBuffer normalizedNationalNumber = new StringBuffer(); - int countryCode = maybeExtractCountryCode(nationalNumber.toString(), countryMetadata, + int countryCode = maybeExtractCountryCode(nationalNumber.toString(), regionMetadata, normalizedNationalNumber, keepRawInput, phoneNumber); if (countryCode != 0) { String phoneNumberRegion = getRegionCodeForCountryCode(countryCode); - if (!phoneNumberRegion.equals(defaultCountry)) { - countryMetadata = getMetadataForRegion(phoneNumberRegion); + if (!phoneNumberRegion.equals(defaultRegion)) { + regionMetadata = getMetadataForRegion(phoneNumberRegion); } } else { - // If no extracted country code, use the region supplied instead. The national number is just - // the normalized version of the number we were given to parse. + // If no extracted country calling code, use the region supplied instead. The national number + // is just the normalized version of the number we were given to parse. normalize(nationalNumber); normalizedNationalNumber.append(nationalNumber); - if (defaultCountry != null) { - countryCode = countryMetadata.getCountryCode(); + if (defaultRegion != null) { + countryCode = regionMetadata.getCountryCode(); phoneNumber.setCountryCode(countryCode); } else if (keepRawInput) { phoneNumber.clearCountryCodeSource(); @@ -2048,9 +2244,9 @@ public class PhoneNumberUtil { throw new NumberParseException(NumberParseException.ErrorType.TOO_SHORT_NSN, "The string supplied is too short to be a phone number."); } - if (countryMetadata != null) { + if (regionMetadata != null) { String carrierCode = - maybeStripNationalPrefixAndCarrierCode(normalizedNationalNumber, countryMetadata); + maybeStripNationalPrefixAndCarrierCode(normalizedNationalNumber, regionMetadata); if (keepRawInput) { phoneNumber.setPreferredDomesticCarrierCode(carrierCode); } @@ -2065,7 +2261,8 @@ public class PhoneNumberUtil { "The string supplied is too long to be a phone number."); } if (normalizedNationalNumber.charAt(0) == '0' && - isLeadingZeroCountry(countryCode)) { + regionMetadata != null && + regionMetadata.isLeadingZeroPossible()) { phoneNumber.setItalianLeadingZero(true); } phoneNumber.setNationalNumber(Long.parseLong(normalizedNationalNumber.toString())); @@ -2074,12 +2271,12 @@ public class PhoneNumberUtil { /** * Takes two phone numbers and compares them for equality. * - * Returns EXACT_MATCH if the country code, NSN, presence of a leading zero for Italian numbers + *

Returns EXACT_MATCH if the country_code, NSN, presence of a leading zero for Italian numbers * and any extension present are the same. - * Returns NSN_MATCH if either or both has no country specified, and the NSNs and extensions are + * Returns NSN_MATCH if either or both has no region specified, and the NSNs and extensions are * the same. - * Returns SHORT_NSN_MATCH if either or both has no country specified, or the country specified - * is the same, and one NSN could be a shorter version of the other number. This includes the case + * Returns SHORT_NSN_MATCH if either or both has no region specified, or the region specified is + * the same, and one NSN could be a shorter version of the other number. This includes the case * where one has an extension specified, and the other does not. * Returns NO_MATCH otherwise. * For example, the numbers +1 345 657 1234 and 657 1234 are a SHORT_NSN_MATCH. @@ -2120,7 +2317,7 @@ public class PhoneNumberUtil { } int firstNumberCountryCode = firstNumber.getCountryCode(); int secondNumberCountryCode = secondNumber.getCountryCode(); - // Both had country code specified. + // Both had country_code specified. if (firstNumberCountryCode != 0 && secondNumberCountryCode != 0) { if (firstNumber.exactlySameAs(secondNumber)) { return MatchType.EXACT_MATCH; @@ -2134,8 +2331,8 @@ public class PhoneNumberUtil { // This is not a match. return MatchType.NO_MATCH; } - // Checks cases where one or both country codes were not specified. To make equality checks - // easier, we first set the country codes to be equal. + // Checks cases where one or both country_code fields were not specified. To make equality + // checks easier, we first set the country_code fields to be equal. firstNumber.setCountryCode(secondNumberCountryCode); // If all else was the same, then this is an NSN_MATCH. if (firstNumber.exactlySameAs(secondNumber)) { @@ -2159,11 +2356,10 @@ public class PhoneNumberUtil { /** * Takes two phone numbers as strings and compares them for equality. This is a convenience - * wrapper for isNumberMatch(PhoneNumber firstNumber, PhoneNumber secondNumber). No default region - * is known. + * wrapper for {@link #isNumberMatch(PhoneNumber, PhoneNumber)}. No default region is known. * - * @param firstNumber first number to compare. Can contain formatting, and can have country code - * specified with + at the start. + * @param firstNumber first number to compare. Can contain formatting, and can have country + * calling code specified with + at the start. * @param secondNumber second number to compare. Can contain formatting, and can have country * code specified with + at the start. * @return NOT_A_NUMBER, NO_MATCH, SHORT_NSN_MATCH, NSN_MATCH, EXACT_MATCH. See @@ -2208,13 +2404,14 @@ public class PhoneNumberUtil { * isNumberMatch(PhoneNumber firstNumber, PhoneNumber secondNumber) for more details. */ public MatchType isNumberMatch(PhoneNumber firstNumber, String secondNumber) { - // First see if the second number has an implicit country code, by attempting to parse it. + // First see if the second number has an implicit country calling code, by attempting to parse + // it. try { PhoneNumber secondNumberAsProto = parse(secondNumber, UNKNOWN_REGION); return isNumberMatch(firstNumber, secondNumberAsProto); } catch (NumberParseException e) { if (e.getErrorType() == NumberParseException.ErrorType.INVALID_COUNTRY_CODE) { - // The second number has no country code. EXACT_MATCH is no longer possible. + // The second number has no country calling code. EXACT_MATCH is no longer possible. // We parse it as if the region was the same as that for the first number, and if // EXACT_MATCH is returned, we replace this with NSN_MATCH. String firstNumberRegion = getRegionCodeForCountryCode(firstNumber.getCountryCode()); @@ -2227,8 +2424,8 @@ public class PhoneNumberUtil { } return match; } else { - // If the first number didn't have a valid country code, then we parse the second number - // without one as well. + // If the first number didn't have a valid country calling code, then we parse the + // second number without one as well. PhoneNumber secondNumberProto = new PhoneNumber(); parseHelper(secondNumber, null, false, false, secondNumberProto); return isNumberMatch(firstNumber, secondNumberProto); @@ -2243,14 +2440,14 @@ public class PhoneNumberUtil { } /** - * Returns true if the number can only be dialled from within the country. If unknown, or the - * number can be dialled from outside the country as well, returns false. Does not check the + * Returns true if the number can only be dialled from within the region. If unknown, or the + * number can be dialled from outside the region as well, returns false. Does not check the * number is a valid number. * TODO: Make this method public when we have enough metadata to make it worthwhile. Currently * visible for testing purposes only. * * @param number the phone-number for which we want to know whether it is only diallable from - * within the country + * within the region */ boolean canBeInternationallyDialled(PhoneNumber number) { String regionCode = getRegionCodeForNumber(number); diff --git a/java/src/com/google/i18n/phonenumbers/Phonemetadata.java b/java/src/com/google/i18n/phonenumbers/Phonemetadata.java index 98dd52fa2..d8da29608 100644 --- a/java/src/com/google/i18n/phonenumbers/Phonemetadata.java +++ b/java/src/com/google/i18n/phonenumbers/Phonemetadata.java @@ -57,10 +57,10 @@ public final class Phonemetadata { // repeated string leading_digits_pattern = 3; private java.util.List leadingDigitsPattern_ = new java.util.ArrayList(); - public java.util.List getLeadingDigitsPatternList() { + public java.util.List leadingDigitPatterns() { return leadingDigitsPattern_; } - public int getLeadingDigitsPatternCount() { return leadingDigitsPattern_.size(); } + public int leadingDigitsPatternSize() { return leadingDigitsPattern_.size(); } public String getLeadingDigitsPattern(int index) { return leadingDigitsPattern_.get(index); } @@ -108,7 +108,7 @@ public final class Phonemetadata { if (other.hasFormat()) { setFormat(other.getFormat()); } - int leadingDigitsPatternSize = other.getLeadingDigitsPatternCount(); + int leadingDigitsPatternSize = other.leadingDigitsPatternSize(); for (int i = 0; i < leadingDigitsPatternSize; i++) { addLeadingDigitsPattern(other.getLeadingDigitsPattern(i)); } @@ -124,7 +124,7 @@ public final class Phonemetadata { public void writeExternal(ObjectOutput objectOutput) throws IOException { objectOutput.writeUTF(pattern_); objectOutput.writeUTF(format_); - int leadingDigitsPatternSize = getLeadingDigitsPatternCount(); + int leadingDigitsPatternSize = leadingDigitsPatternSize(); objectOutput.writeInt(leadingDigitsPatternSize); for (int i = 0; i < leadingDigitsPatternSize; i++) { objectOutput.writeUTF(leadingDigitsPattern_.get(i)); @@ -503,10 +503,10 @@ public final class Phonemetadata { // repeated NumberFormat number_format = 19; private java.util.List numberFormat_ = new java.util.ArrayList(); - public java.util.List getNumberFormatList() { + public java.util.List numberFormats() { return numberFormat_; } - public int getNumberFormatCount() { return numberFormat_.size(); } + public int numberFormatSize() { return numberFormat_.size(); } public NumberFormat getNumberFormat(int index) { return numberFormat_.get(index); } @@ -521,10 +521,10 @@ public final class Phonemetadata { // repeated NumberFormat intl_number_format = 20; private java.util.List intlNumberFormat_ = new java.util.ArrayList(); - public java.util.List getIntlNumberFormatList() { + public java.util.List intlNumberFormats() { return intlNumberFormat_; } - public int getIntlNumberFormatCount() { return intlNumberFormat_.size(); } + public int intlNumberFormatSize() { return intlNumberFormat_.size(); } public NumberFormat getIntlNumberFormat(int index) { return intlNumberFormat_.get(index); } @@ -559,6 +559,17 @@ public final class Phonemetadata { return this; } + // optional bool leading_zero_possible = 26 [default = false]; + private boolean hasLeadingZeroPossible; + private boolean leadingZeroPossible_ = false; + public boolean hasLeadingZeroPossible() { return hasLeadingZeroPossible; } + public boolean isLeadingZeroPossible() { return leadingZeroPossible_; } + public PhoneMetadata setLeadingZeroPossible(boolean value) { + hasLeadingZeroPossible = true; + leadingZeroPossible_ = value; + return this; + } + public void writeExternal(ObjectOutput objectOutput) throws IOException { objectOutput.writeBoolean(hasGeneralDesc); if (hasGeneralDesc) { @@ -636,13 +647,13 @@ public final class Phonemetadata { objectOutput.writeBoolean(sameMobileAndFixedLinePattern_); - int numberFormatSize = getNumberFormatCount(); + int numberFormatSize = numberFormatSize(); objectOutput.writeInt(numberFormatSize); for (int i = 0; i < numberFormatSize; i++) { numberFormat_.get(i).writeExternal(objectOutput); } - int intlNumberFormatSize = getIntlNumberFormatCount(); + int intlNumberFormatSize = intlNumberFormatSize(); objectOutput.writeInt(intlNumberFormatSize); for (int i = 0; i < intlNumberFormatSize; i++) { intlNumberFormat_.get(i).writeExternal(objectOutput); @@ -654,6 +665,8 @@ public final class Phonemetadata { if (hasLeadingDigits) { objectOutput.writeUTF(leadingDigits_); } + + objectOutput.writeBoolean(leadingZeroPossible_); } public void readExternal(ObjectInput objectInput) throws IOException { @@ -775,6 +788,8 @@ public final class Phonemetadata { if (hasString) { setLeadingDigits(objectInput.readUTF()); } + + setLeadingZeroPossible(objectInput.readBoolean()); } } diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AC b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AC index 5bf428908..d0069f1a2 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AC and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AC differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AD b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AD index 62b3b29d8..2f5199be9 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AD and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AD differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AE b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AE index cce75403e..2f543e19b 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AE and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AE differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AF b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AF index 69223401e..0120a2380 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AF and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AF differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AG b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AG index f0b7c4fa7..8679e74bb 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AG and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AG differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AI b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AI index 403d69383..8a3623756 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AI and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AI differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AL b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AL index 560b6777b..15cbd779c 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AL and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AL differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AM b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AM index e1488b3cf..45ee014f4 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AM and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AM differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AN b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AN index 73a83e860..e2aa056d4 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AN and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AN differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AO b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AO index 304cb0a2c..13a528534 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AO and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AO differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AR b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AR index 44a3b68a0..5da4db1a7 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AR and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AR differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AS b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AS index 8728b2840..81d04c8b7 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AS and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AS differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AT b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AT index f2b645c83..720010c9a 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AT and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AT differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AU b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AU index 4c1cfb4bf..24ad5c8e9 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AU and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AU differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AW b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AW index 1c7842e7b..00b01734d 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AW and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AW differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AZ b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AZ index ca83c980b..4b3d33104 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AZ and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AZ differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BA b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BA index 3c9e26887..c5e36f658 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BA and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BA differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BB b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BB index 0b60e5724..74345e75a 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BB and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BB differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BD b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BD index 872fc63a9..f335c393a 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BD and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BD differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BE b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BE index b0074bfeb..fa90f75c2 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BE and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BE differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BF b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BF index cd1431f15..a450f514c 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BF and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BF differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BG b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BG index ed3913d0f..e1e34d9d9 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BG and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BG differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BH b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BH index a7b67c4b2..3589ec9fd 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BH and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BH differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BI b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BI index 40ecfcbb1..2b67b002e 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BI and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BI differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BJ b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BJ index 1fb831867..e5ef1ec5e 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BJ and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BJ differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BL b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BL index de4b8047c..b410d02e7 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BL and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BL differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BM b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BM index f51c6f7e9..9bb1b0a99 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BM and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BM differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BN b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BN index 0fe3d3804..46b0177a0 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BN and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BN differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BO b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BO index 0395299f0..8e8857c75 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BO and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BO differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BR b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BR index 67fe311df..9aa4d28e8 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BR and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BR differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BS b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BS index e72eaac50..4ba983cbe 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BS and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BS differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BT b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BT index c04cc474e..139f181f3 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BT and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BT differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BW b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BW index 752f8527d..acbe7e113 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BW and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BW differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BY b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BY index 91b82072b..969f182a9 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BY and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BY differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BZ b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BZ index ec98a819b..d1d270b4d 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BZ and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BZ differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CA b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CA index 08a19c188..d58714a64 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CA and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CA differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CD b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CD index 029f0e9fe..4456d294d 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CD and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CD differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CF b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CF index 440ee17f2..eeb5eeb15 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CF and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CF differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CG b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CG index dfc82a1db..6b809d41e 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CG and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CG differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CH b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CH index b9781b3c9..1b520c313 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CH and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CH differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CI b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CI index c647c3dfb..15a95d639 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CI and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CI differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CK b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CK index 2ce83c280..4f01ce284 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CK and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CK differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CL b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CL index 2e9c0d8d6..8fabf745f 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CL and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CL differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CM b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CM index 414c1ddc0..5fb3c1fe4 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CM and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CM differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CN b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CN index aeb822422..913120f0e 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CN and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CN differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CO b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CO index e89645ad2..f893bd7e0 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CO and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CO differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CR b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CR index 979fa17cd..942b64668 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CR and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CR differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CU b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CU index 58728b954..3d2e499b6 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CU and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CU differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CV b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CV index 40f68197a..947e6608e 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CV and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CV differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CY b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CY index 6e910fa53..03e18fb48 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CY and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CY differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CZ b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CZ index 8e4bc858f..0d263a1b2 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CZ and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CZ differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_DE b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_DE index 657ff376a..87844f3a2 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_DE and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_DE differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_DJ b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_DJ index 195b880b1..2978ffe48 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_DJ and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_DJ differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_DK b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_DK index 2b9a712c2..cbb0f4c56 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_DK and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_DK differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_DM b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_DM index 2f468341e..486ba1552 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_DM and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_DM differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_DO b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_DO index 0100b938c..5ee5e4d78 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_DO and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_DO differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_DZ b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_DZ index 9551e58d1..c3d52a0a5 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_DZ and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_DZ differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_EC b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_EC index 507802083..1b59c2321 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_EC and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_EC differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_EE b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_EE index 45242fefe..8387a3b15 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_EE and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_EE differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_EG b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_EG index 1b383cb18..e3a1c565d 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_EG and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_EG differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_ER b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_ER index 72073963e..5c256361f 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_ER and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_ER differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_ES b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_ES index 81c67e256..17bf18571 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_ES and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_ES differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_ET b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_ET index 6c1a58853..443dcb9cd 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_ET and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_ET differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_FI b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_FI index 925e74014..982c8dd4b 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_FI and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_FI differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_FJ b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_FJ index dfc643275..616f4c6d1 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_FJ and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_FJ differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_FK b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_FK index 9630d47db..9ef7a8cfa 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_FK and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_FK differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_FM b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_FM index f3f36997b..f58dc40d2 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_FM and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_FM differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_FO b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_FO index 2d2ff1824..f6641dd59 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_FO and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_FO differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_FR b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_FR index 2b16deaae..7a2adfd4f 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_FR and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_FR differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GA b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GA index f923cae53..800c4f2e8 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GA and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GA differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GB b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GB index 9f4e327b9..b1ffcc9d3 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GB and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GB differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GD b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GD index f2e6c56f6..b54ca6270 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GD and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GD differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GE b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GE index 22f3da287..f19410726 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GE and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GE differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GF b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GF index e82b26cf0..fd17d8d46 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GF and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GF differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GG b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GG index ae3cec7c8..7d2468644 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GG and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GG differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GH b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GH index 82ff8e468..3cf818d24 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GH and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GH differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GI b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GI index 63a685fa4..662533129 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GI and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GI differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GL b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GL index f8dc2b009..f50ade6ef 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GL and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GL differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GM b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GM index 27ce34fb1..abef42bd9 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GM and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GM differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GN b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GN index dde6c5365..c865a1774 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GN and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GN differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GP b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GP index f6108ee18..2c21e7428 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GP and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GP differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GQ b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GQ index c3bd13e57..a94a26e2a 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GQ and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GQ differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GR b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GR index ed28df8d6..2c4a82886 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GR and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GR differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GT b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GT index b91516c18..5d68cc688 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GT and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GT differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GU b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GU index 237d37afd..3a455def4 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GU and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GU differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GW b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GW index a755f3641..9ca229981 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GW and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GW differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GY b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GY index 10f48a72c..e6666f997 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GY and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GY differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_HK b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_HK index 01b773d70..260696ba9 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_HK and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_HK differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_HN b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_HN index 502c311e1..8aa38571b 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_HN and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_HN differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_HR b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_HR index 3089e8b99..9766d5624 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_HR and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_HR differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_HT b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_HT index 11abb56fb..6d4d7b71f 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_HT and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_HT differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_HU b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_HU index 90009c012..79efc3c79 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_HU and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_HU differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_ID b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_ID index 0c2803e31..c2d6738e8 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_ID and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_ID differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_IE b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_IE index 706aeddd5..bd1e9ed02 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_IE and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_IE differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_IL b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_IL index d39b391d8..f784b0f8b 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_IL and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_IL differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_IM b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_IM index 30bb20ef1..ab78e3a37 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_IM and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_IM differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_IN b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_IN index 60dd9da21..f8fafa942 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_IN and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_IN differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_IO b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_IO index f15346f96..3213c5ad6 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_IO and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_IO differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_IQ b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_IQ index ab713bbe8..475492fe1 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_IQ and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_IQ differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_IR b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_IR index 35827c066..a5b3394e9 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_IR and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_IR differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_IS b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_IS index 233e357f3..eb45cb464 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_IS and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_IS differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_IT b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_IT index 8c81e18d9..ae03581af 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_IT and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_IT differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_JE b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_JE index 2e3c4d5dd..37dc706f1 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_JE and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_JE differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_JM b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_JM index 77c4efc80..eef5197ee 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_JM and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_JM differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_JO b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_JO index 6c8e26589..cc0d0913c 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_JO and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_JO differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_JP b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_JP index 9650864bb..4773220d5 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_JP and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_JP differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_KE b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_KE index bfd69a4b5..72d80a655 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_KE and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_KE differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_KG b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_KG index 06d1f7d88..c4e37cffe 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_KG and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_KG differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_KH b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_KH index 0ddca187c..f34f0eb1e 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_KH and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_KH differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_KI b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_KI index 377f39bb9..2cf436562 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_KI and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_KI differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_KM b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_KM index a2d3de609..7c7614351 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_KM and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_KM differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_KN b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_KN index 863b3eb33..746a95aa0 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_KN and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_KN differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_KP b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_KP index eccdf9e39..dbc742e48 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_KP and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_KP differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_KR b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_KR index e66f15795..f74cb4dbf 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_KR and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_KR differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_KW b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_KW index 7ab6e3630..475d794f6 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_KW and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_KW differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_KY b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_KY index 754551b7c..2e285c1b7 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_KY and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_KY differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_KZ b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_KZ index b0b73df41..bf98d9581 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_KZ and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_KZ differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_LA b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_LA index 984aeba23..7f78cb8e1 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_LA and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_LA differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_LB b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_LB index ab97154f0..c6b6e14ba 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_LB and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_LB differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_LC b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_LC index 296fe4179..3b3ab6ba8 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_LC and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_LC differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_LI b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_LI index 37693c566..e7921499b 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_LI and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_LI differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_LK b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_LK index 4092102ba..2b06a386f 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_LK and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_LK differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_LR b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_LR index c5cfee68a..0b4373c5b 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_LR and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_LR differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_LS b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_LS index ca9890046..e65316eb2 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_LS and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_LS differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_LT b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_LT index 43b750c50..02ad948ce 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_LT and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_LT differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_LU b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_LU index 1b3137441..ef5e720af 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_LU and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_LU differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_LV b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_LV index 631d6f20c..80c3aa3da 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_LV and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_LV differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_LY b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_LY index 6fb9f25d6..0873564e7 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_LY and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_LY differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MA b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MA index bf6969880..dd0beb566 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MA and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MA differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MC b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MC index 61e560f22..1a80b905e 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MC and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MC differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MD b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MD index edc5d0f85..17917ffed 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MD and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MD differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_ME b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_ME index 056305b55..352802e92 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_ME and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_ME differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MF b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MF index 29c214b0b..2daec61e7 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MF and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MF differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MG b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MG index b0c8bf218..7eef113ed 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MG and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MG differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MH b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MH index 131f1980e..2df3a70c9 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MH and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MH differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MK b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MK index 9b94a61ce..040a7919a 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MK and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MK differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_ML b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_ML index d1efd0f24..c7d6d187d 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_ML and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_ML differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MM b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MM index 8c3505974..fbe65bcd2 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MM and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MM differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MN b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MN index 0d76175c1..ebbcc6cd5 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MN and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MN differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MO b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MO index a72a4bcc2..d0bb6aeb6 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MO and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MO differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MP b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MP index 312659b09..7b51d36ac 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MP and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MP differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MQ b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MQ index 6a495d763..0c29b3d81 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MQ and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MQ differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MR b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MR index fd21ea71e..dd9fa9e82 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MR and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MR differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MS b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MS index c1ad3b365..b31c305a5 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MS and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MS differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MT b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MT index 9dcbbbf65..e4ef74a9a 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MT and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MT differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MU b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MU index a65c8e327..cde515f34 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MU and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MU differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MV b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MV index 49e9b28b0..cef8e087f 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MV and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MV differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MW b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MW index 4529ee137..36fe6c981 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MW and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MW differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MX b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MX index c857d1de5..15746f777 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MX and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MX differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MY b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MY index 47e64ecc6..35b8414df 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MY and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MY differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MZ b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MZ index 6ae79b9f5..5128f4e7c 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MZ and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MZ differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_NA b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_NA index 046be1550..5c54aa0e8 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_NA and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_NA differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_NC b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_NC index a6ce4d01c..c8091d15f 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_NC and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_NC differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_NE b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_NE index 05e12c30e..62309e52c 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_NE and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_NE differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_NF b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_NF index e4ef5e8fe..ab7927480 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_NF and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_NF differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_NG b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_NG index 09939ff5d..4e12b3693 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_NG and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_NG differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_NI b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_NI index 5eb33fe7c..437f7d196 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_NI and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_NI differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_NL b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_NL index 79c874169..f0a7b3062 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_NL and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_NL differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_NO b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_NO index de77f88cd..b258badd9 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_NO and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_NO differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_NP b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_NP index 74caa0401..3811c4450 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_NP and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_NP differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_NR b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_NR index 72e46b38a..c09d24677 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_NR and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_NR differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_NU b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_NU index d33aa7a2f..ac5a701f4 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_NU and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_NU differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_NZ b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_NZ index 20dc762bb..199e3c210 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_NZ and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_NZ differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_OM b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_OM index aa0e794f3..a3ce6c108 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_OM and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_OM differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_PA b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_PA index c8c2c769d..ed8860819 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_PA and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_PA differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_PE b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_PE index 45de89dbf..6f97174c4 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_PE and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_PE differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_PF b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_PF index 30924a4ef..bbdd91bf8 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_PF and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_PF differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_PG b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_PG index 067b4997c..767f47cab 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_PG and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_PG differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_PH b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_PH index 5810c2979..8eb72c8f2 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_PH and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_PH differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_PK b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_PK index a7a82f770..1c37c1c41 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_PK and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_PK differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_PL b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_PL index 2d51c348d..012f5b7de 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_PL and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_PL differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_PM b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_PM index e645cd2b0..004141829 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_PM and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_PM differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_PR b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_PR index 335b318e8..7adcde065 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_PR and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_PR differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_PS b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_PS index 21b99860f..111465901 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_PS and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_PS differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_PT b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_PT index bb7270f9c..9c691cc92 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_PT and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_PT differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_PW b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_PW index d65d876a5..1b99676f0 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_PW and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_PW differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_PY b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_PY index 07354365f..ab59e4176 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_PY and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_PY differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_QA b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_QA index 4717ebd1f..da69ee291 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_QA and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_QA differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_RE b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_RE index fa0ccb45d..0a282a451 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_RE and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_RE differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_RO b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_RO index 595878ed5..d45708ae0 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_RO and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_RO differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_RS b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_RS index cc359b110..6f97714be 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_RS and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_RS differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_RU b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_RU index 9589b8474..189e57ffe 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_RU and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_RU differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_RW b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_RW index 63319ceb1..9b1ce039d 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_RW and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_RW differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SA b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SA index ec5abcc4f..a938bbf2d 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SA and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SA differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SB b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SB index 464b8ec69..a640f6882 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SB and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SB differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SC b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SC index 3d74da04d..64ab38bcc 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SC and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SC differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SD b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SD index 34968f0ad..37871a15b 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SD and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SD differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SE b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SE index fb42a83c2..2c438131b 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SE and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SE differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SG b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SG index 9071c3f4b..6020eb319 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SG and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SG differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SH b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SH index c52c527ea..e928407b4 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SH and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SH differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SI b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SI index 927774b1e..b9df92b78 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SI and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SI differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SK b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SK index b755b5caf..50b4e3a5c 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SK and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SK differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SL b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SL index c3fd293ff..5ab84328f 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SL and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SL differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SM b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SM index ea97ce14e..4892c602a 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SM and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SM differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SN b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SN index 535afa354..095a49402 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SN and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SN differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SO b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SO index 334be741e..2db94507c 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SO and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SO differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SR b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SR index b563d07d2..c1dc5a1e7 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SR and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SR differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_ST b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_ST index 29b7d3644..9a8a7ecb7 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_ST and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_ST differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SV b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SV index 0a299cfa5..0fc9f706a 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SV and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SV differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SY b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SY index 9c547de49..2863ef19e 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SY and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SY differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SZ b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SZ index 663f11ae8..bca54b0c3 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SZ and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SZ differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_TC b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_TC index 8034cbd92..056739d39 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_TC and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_TC differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_TD b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_TD index cfde8b739..dc573d14d 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_TD and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_TD differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_TF b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_TF index d18541def..8e7ef3055 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_TF and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_TF differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_TG b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_TG index d6b965453..523c84b3c 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_TG and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_TG differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_TH b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_TH index e7f2c336a..119af7dec 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_TH and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_TH differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_TJ b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_TJ index 5a3fd6f8a..079698424 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_TJ and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_TJ differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_TK b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_TK index 653d60651..87012f49c 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_TK and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_TK differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_TL b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_TL index 8b4378c53..3e96e1801 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_TL and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_TL differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_TM b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_TM index c3c8de1c7..b3b4ad8cf 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_TM and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_TM differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_TN b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_TN index b9ffbfd44..7a24c419a 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_TN and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_TN differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_TO b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_TO index 4497b3f42..10728f313 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_TO and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_TO differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_TR b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_TR index 0d20cbb59..32b88e1b3 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_TR and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_TR differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_TT b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_TT index bdbaf96cd..ddbdfc6af 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_TT and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_TT differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_TV b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_TV index 8cf631d51..792d2973f 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_TV and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_TV differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_TW b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_TW index 63963cf51..08b417295 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_TW and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_TW differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_TZ b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_TZ index 0f99acbf5..b5c29afdd 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_TZ and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_TZ differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_UA b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_UA index a5d280640..f74e132ae 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_UA and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_UA differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_UG b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_UG index 4eb5563f8..7ce2b578d 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_UG and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_UG differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_US b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_US index 25b36680c..03d97c8fc 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_US and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_US differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_UY b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_UY index 2a198e603..b717cb187 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_UY and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_UY differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_UZ b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_UZ index 2a307b35d..05c68545c 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_UZ and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_UZ differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_VA b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_VA index a0be427a7..0b7f9eed6 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_VA and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_VA differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_VC b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_VC index ab0438382..9d28676dc 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_VC and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_VC differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_VE b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_VE index 96b653fcb..1db719685 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_VE and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_VE differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_VG b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_VG index e7d7db703..6d1fbe29a 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_VG and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_VG differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_VI b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_VI index 88428e8ca..fd9447d90 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_VI and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_VI differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_VN b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_VN index a46320719..6f2b378b9 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_VN and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_VN differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_VU b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_VU index a79ddef17..2c79ade13 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_VU and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_VU differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_WF b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_WF index 423e86d3f..43f116261 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_WF and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_WF differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_WS b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_WS index 52fd0e7db..9022baaaa 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_WS and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_WS differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_YE b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_YE index e4e2e7874..b18ec98b4 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_YE and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_YE differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_YT b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_YT index 5d3b0f98a..ae7df495f 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_YT and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_YT differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_ZA b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_ZA index 19896c6c1..15930b356 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_ZA and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_ZA differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_ZM b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_ZM index 99c815290..2b341abb2 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_ZM and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_ZM differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_ZW b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_ZW index 13aa7286e..45b6bc1db 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_ZW and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_ZW differ diff --git a/java/test/com/google/i18n/phonenumbers/AsYouTypeFormatterTest.java b/java/test/com/google/i18n/phonenumbers/AsYouTypeFormatterTest.java index 4920676a7..6a48dcca7 100644 --- a/java/test/com/google/i18n/phonenumbers/AsYouTypeFormatterTest.java +++ b/java/test/com/google/i18n/phonenumbers/AsYouTypeFormatterTest.java @@ -391,10 +391,10 @@ public class AsYouTypeFormatterTest extends TestCase { assertEquals("0", formatter.inputDigit('0')); assertEquals("03", formatter.inputDigit('3')); assertEquals("030", formatter.inputDigit('0')); - assertEquals("030 1", formatter.inputDigit('1')); - assertEquals("030 12", formatter.inputDigit('2')); - assertEquals("030 123", formatter.inputDigit('3')); - assertEquals("030 1234", formatter.inputDigit('4')); + assertEquals("030/1", formatter.inputDigit('1')); + assertEquals("030/12", formatter.inputDigit('2')); + assertEquals("030/123", formatter.inputDigit('3')); + assertEquals("030/1234", formatter.inputDigit('4')); // 04134 1234 formatter.clear(); diff --git a/java/test/com/google/i18n/phonenumbers/ExampleNumbersTest.java b/java/test/com/google/i18n/phonenumbers/ExampleNumbersTest.java index 1d83fa79b..776bb22bd 100644 --- a/java/test/com/google/i18n/phonenumbers/ExampleNumbersTest.java +++ b/java/test/com/google/i18n/phonenumbers/ExampleNumbersTest.java @@ -65,7 +65,7 @@ public class ExampleNumbersTest extends TestCase { */ private void checkNumbersValidAndCorrectType(PhoneNumberType exampleNumberRequestedType, Set possibleExpectedTypes) { - for (String regionCode : phoneNumberUtil.getSupportedCountries()) { + for (String regionCode : phoneNumberUtil.getSupportedRegions()) { PhoneNumber exampleNumber = phoneNumberUtil.getExampleNumberForType(regionCode, exampleNumberRequestedType); if (exampleNumber != null) { @@ -149,7 +149,7 @@ public class ExampleNumbersTest extends TestCase { } public void testCanBeInternationallyDialled() throws Exception { - for (String regionCode : phoneNumberUtil.getSupportedCountries()) { + for (String regionCode : phoneNumberUtil.getSupportedRegions()) { PhoneNumber exampleNumber = null; PhoneNumberDesc desc = phoneNumberUtil.getMetadataForRegion(regionCode).getNoInternationalDialling(); diff --git a/java/test/com/google/i18n/phonenumbers/PhoneNumberUtilTest.java b/java/test/com/google/i18n/phonenumbers/PhoneNumberUtilTest.java index a9e51439a..432e6c819 100644 --- a/java/test/com/google/i18n/phonenumbers/PhoneNumberUtilTest.java +++ b/java/test/com/google/i18n/phonenumbers/PhoneNumberUtilTest.java @@ -55,7 +55,7 @@ public class PhoneNumberUtilTest extends TestCase { new PhoneNumber().setCountryCode(61).setNationalNumber(236618300L); private static final PhoneNumber BS_MOBILE = new PhoneNumber().setCountryCode(1).setNationalNumber(2423570000L); - private static final PhoneNumber BS_NUMBER = + private static final PhoneNumber BS_NUMBER = new PhoneNumber().setCountryCode(1).setNationalNumber(2423651234L); // Note that this is the same as the example number for DE in the metadata. private static final PhoneNumber DE_NUMBER = @@ -124,13 +124,17 @@ public class PhoneNumberUtilTest extends TestCase { CountryCodeToRegionCodeMapForTesting.getCountryCodeToRegionCodeMap()); } + public void testGetSupportedRegions() { + assertTrue(phoneUtil.getSupportedRegions().size() > 0); + } + public void testGetInstanceLoadUSMetadata() { PhoneMetadata metadata = phoneUtil.getMetadataForRegion(RegionCode.US); assertEquals("US", metadata.getId()); assertEquals(1, metadata.getCountryCode()); assertEquals("011", metadata.getInternationalPrefix()); assertTrue(metadata.hasNationalPrefix()); - assertEquals(2, metadata.getNumberFormatCount()); + assertEquals(2, metadata.numberFormatSize()); assertEquals("(\\d{3})(\\d{3})(\\d{4})", metadata.getNumberFormat(0).getPattern()); assertEquals("$1 $2 $3", metadata.getNumberFormat(0).getFormat()); @@ -151,8 +155,8 @@ public class PhoneNumberUtilTest extends TestCase { assertEquals(49, metadata.getCountryCode()); assertEquals("00", metadata.getInternationalPrefix()); assertEquals("0", metadata.getNationalPrefix()); - assertEquals(6, metadata.getNumberFormatCount()); - assertEquals(1, metadata.getNumberFormat(5).getLeadingDigitsPatternCount()); + assertEquals(6, metadata.numberFormatSize()); + assertEquals(1, metadata.getNumberFormat(5).leadingDigitsPatternSize()); assertEquals("900", metadata.getNumberFormat(5).getLeadingDigitsPattern(0)); assertEquals("(\\d{3})(\\d{3,4})(\\d{4})", metadata.getNumberFormat(5).getPattern()); @@ -181,6 +185,13 @@ public class PhoneNumberUtilTest extends TestCase { assertEquals("$1 $2 $3 $4", metadata.getIntlNumberFormat(3).getFormat()); } + public void testIsLeadingZeroPossible() { + assertTrue(phoneUtil.isLeadingZeroPossible(39)); // Italy + assertFalse(phoneUtil.isLeadingZeroPossible(1)); // USA + assertFalse(phoneUtil.isLeadingZeroPossible(800)); // Not in metadata file, just default to + // false. + } + public void testGetLengthOfGeographicalAreaCode() { // Google MTV, which has area code "650". assertEquals(3, phoneUtil.getLengthOfGeographicalAreaCode(US_NUMBER)); @@ -235,19 +246,19 @@ public class PhoneNumberUtilTest extends TestCase { // An invalid US number (1 digit shorter), which has no NDC. assertEquals(0, phoneUtil.getLengthOfNationalDestinationCode(US_SHORT_BY_ONE_NUMBER)); - // A number containing an invalid country code, which shouldn't have any NDC. + // A number containing an invalid country calling code, which shouldn't have any NDC. PhoneNumber number = new PhoneNumber().setCountryCode(123).setNationalNumber(6502530000L); assertEquals(0, phoneUtil.getLengthOfNationalDestinationCode(number)); } public void testGetNationalSignificantNumber() { - assertEquals("6502530000", PhoneNumberUtil.getNationalSignificantNumber(US_NUMBER)); + assertEquals("6502530000", phoneUtil.getNationalSignificantNumber(US_NUMBER)); // An Italian mobile number. - assertEquals("345678901", PhoneNumberUtil.getNationalSignificantNumber(IT_MOBILE)); + assertEquals("345678901", phoneUtil.getNationalSignificantNumber(IT_MOBILE)); // An Italian fixed line number. - assertEquals("0236618300", PhoneNumberUtil.getNationalSignificantNumber(IT_NUMBER)); + assertEquals("0236618300", phoneUtil.getNationalSignificantNumber(IT_NUMBER)); } public void testGetExampleNumber() { @@ -314,6 +325,7 @@ public class PhoneNumberUtilTest extends TestCase { assertEquals("900 253 0000", phoneUtil.format(US_PREMIUM, PhoneNumberFormat.NATIONAL)); assertEquals("+1 900 253 0000", phoneUtil.format(US_PREMIUM, PhoneNumberFormat.INTERNATIONAL)); + assertEquals("+1-900-253-0000", phoneUtil.format(US_PREMIUM, PhoneNumberFormat.RFC3966)); } public void testFormatBSNumber() { @@ -332,8 +344,9 @@ public class PhoneNumberUtilTest extends TestCase { public void testFormatDENumber() { PhoneNumber deNumber = new PhoneNumber(); deNumber.setCountryCode(49).setNationalNumber(301234L); - assertEquals("030 1234", phoneUtil.format(deNumber, PhoneNumberFormat.NATIONAL)); - assertEquals("+49 30 1234", phoneUtil.format(deNumber, PhoneNumberFormat.INTERNATIONAL)); + assertEquals("030/1234", phoneUtil.format(deNumber, PhoneNumberFormat.NATIONAL)); + assertEquals("+49 30/1234", phoneUtil.format(deNumber, PhoneNumberFormat.INTERNATIONAL)); + assertEquals("+49-30-1234", phoneUtil.format(deNumber, PhoneNumberFormat.RFC3966)); deNumber.clear(); deNumber.setCountryCode(49).setNationalNumber(291123L); @@ -444,6 +457,79 @@ public class PhoneNumberUtilTest extends TestCase { phoneUtil.formatOutOfCountryCallingNumber(IT_NUMBER, RegionCode.AU)); } + public void testFormatOutOfCountryKeepingAlphaChars() { + PhoneNumber alphaNumericNumber = new PhoneNumber(); + alphaNumericNumber.setCountryCode(1).setNationalNumber(8007493524L) + .setRawInput("1800 six-flag"); + assertEquals("0011 1 800 SIX-FLAG", + phoneUtil.formatOutOfCountryKeepingAlphaChars(alphaNumericNumber, RegionCode.AU)); + + alphaNumericNumber.setRawInput("1-800-SIX-flag"); + assertEquals("0011 1 800-SIX-FLAG", + phoneUtil.formatOutOfCountryKeepingAlphaChars(alphaNumericNumber, RegionCode.AU)); + + alphaNumericNumber.setRawInput("Call us from UK: 00 1 800 SIX-flag"); + assertEquals("0011 1 800 SIX-FLAG", + phoneUtil.formatOutOfCountryKeepingAlphaChars(alphaNumericNumber, RegionCode.AU)); + + alphaNumericNumber.setRawInput("800 SIX-flag"); + assertEquals("0011 1 800 SIX-FLAG", + phoneUtil.formatOutOfCountryKeepingAlphaChars(alphaNumericNumber, RegionCode.AU)); + + // Formatting from within the NANPA region. + assertEquals("1 800 SIX-FLAG", + phoneUtil.formatOutOfCountryKeepingAlphaChars(alphaNumericNumber, RegionCode.US)); + + assertEquals("1 800 SIX-FLAG", + phoneUtil.formatOutOfCountryKeepingAlphaChars(alphaNumericNumber, RegionCode.BS)); + + // Testing that if the raw input doesn't exist, it is formatted using + // formatOutOfCountryCallingNumber. + alphaNumericNumber.clearRawInput(); + assertEquals("00 1 800 749 3524", + phoneUtil.formatOutOfCountryKeepingAlphaChars(alphaNumericNumber, RegionCode.DE)); + + // Testing AU alpha number formatted from Australia. + alphaNumericNumber.setCountryCode(61).setNationalNumber(827493524L) + .setRawInput("+61 82749-FLAG"); + // This number should have the national prefix fixed. + assertEquals("082749-FLAG", + phoneUtil.formatOutOfCountryKeepingAlphaChars(alphaNumericNumber, RegionCode.AU)); + + alphaNumericNumber.setRawInput("082749-FLAG"); + assertEquals("082749-FLAG", + phoneUtil.formatOutOfCountryKeepingAlphaChars(alphaNumericNumber, RegionCode.AU)); + + alphaNumericNumber.setNationalNumber(18007493524L).setRawInput("1-800-SIX-flag"); + // This number should not have the national prefix prefixed, in accordance with the override for + // this specific formatting rule. + assertEquals("1-800-SIX-FLAG", + phoneUtil.formatOutOfCountryKeepingAlphaChars(alphaNumericNumber, RegionCode.AU)); + + // The metadata should not be permanently changed, since we copied it before modifying patterns. + // Here we check this. + alphaNumericNumber.setNationalNumber(1800749352L); + assertEquals("1800 749 352", + phoneUtil.formatOutOfCountryCallingNumber(alphaNumericNumber, RegionCode.AU)); + + // Testing a region with multiple international prefixes. + assertEquals("+61 1-800-SIX-FLAG", + phoneUtil.formatOutOfCountryKeepingAlphaChars(alphaNumericNumber, RegionCode.SG)); + + // Testing the case with an invalid country calling code. + alphaNumericNumber.setCountryCode(0).setNationalNumber(18007493524L) + .setRawInput("1-800-SIX-flag"); + // Uses the raw input only. + assertEquals("1-800-SIX-flag", + phoneUtil.formatOutOfCountryKeepingAlphaChars(alphaNumericNumber, RegionCode.DE)); + + // Testing the case of an invalid alpha number. + alphaNumericNumber.setCountryCode(1).setNationalNumber(80749L).setRawInput("180-SIX"); + // No country-code stripping can be done. + assertEquals("00 1 180-SIX", + phoneUtil.formatOutOfCountryKeepingAlphaChars(alphaNumericNumber, RegionCode.DE)); + } + public void testFormatWithCarrierCode() { // We only support this for AR in our test metadata, and only for mobile numbers starting with // certain values. @@ -487,7 +573,7 @@ public class PhoneNumberUtilTest extends TestCase { usNumber.setCountryCode(1).setNationalNumber(4241231234L).setPreferredDomesticCarrierCode("99"); assertEquals("424 123 1234", phoneUtil.format(usNumber, PhoneNumberFormat.NATIONAL)); assertEquals("424 123 1234", - phoneUtil.formatNationalNumberWithPreferredCarrierCode(usNumber, "15")); + phoneUtil.formatNationalNumberWithPreferredCarrierCode(usNumber, "15")); } public void testFormatByPattern() { @@ -557,6 +643,8 @@ public class PhoneNumberUtilTest extends TestCase { PhoneNumber nzNumber = new PhoneNumber().mergeFrom(NZ_NUMBER).setExtension("1234"); // Uses default extension prefix: assertEquals("03-331 6005 ext. 1234", phoneUtil.format(nzNumber, PhoneNumberFormat.NATIONAL)); + // Uses RFC 3966 syntax. + assertEquals("+64-3-331-6005;ext=1234", phoneUtil.format(nzNumber, PhoneNumberFormat.RFC3966)); // Extension prefix overridden in the territory information for the US: PhoneNumber usNumberWithExtension = new PhoneNumber().mergeFrom(US_NUMBER).setExtension("4567"); assertEquals("650 253 0000 extn. 4567", phoneUtil.format(usNumberWithExtension, @@ -805,7 +893,7 @@ public class PhoneNumberUtilTest extends TestCase { } public void testIsPossibleNumberWithReason() { - // FYI, national numbers for country code +1 that are within 7 to 10 digits are possible. + // National numbers for country calling code +1 that are within 7 to 10 digits are possible. assertEquals(PhoneNumberUtil.ValidationResult.IS_POSSIBLE, phoneUtil.isPossibleNumberWithReason(US_NUMBER)); @@ -1034,7 +1122,8 @@ public class PhoneNumberUtilTest extends TestCase { assertEquals("The number supplied was not stripped of the plus symbol.", strippedNumber.toString(), numberToStrip.toString()); - // If the number afterwards is a zero, we should not strip this - no country code begins with 0. + // If the number afterwards is a zero, we should not strip this - no country calling code begins + // with 0. numberToStrip = new StringBuffer("0090112-3123"); strippedNumber = new StringBuffer("00901123123"); assertEquals(CountryCodeSource.FROM_DEFAULT_COUNTRY, @@ -1056,16 +1145,16 @@ public class PhoneNumberUtilTest extends TestCase { try { String phoneNumber = "011112-3456789"; String strippedNumber = "123456789"; - int countryCode = 1; + int countryCallingCode = 1; StringBuffer numberToFill = new StringBuffer(); - assertEquals("Did not extract country code " + countryCode + " correctly.", - countryCode, + assertEquals("Did not extract country calling code " + countryCallingCode + " correctly.", + countryCallingCode, phoneUtil.maybeExtractCountryCode(phoneNumber, metadata, numberToFill, true, number)); assertEquals("Did not figure out CountryCodeSource correctly", CountryCodeSource.FROM_NUMBER_WITH_IDD, number.getCountryCodeSource()); // Should strip and normalize national significant number. - assertEquals("Did not strip off the country code correctly.", + assertEquals("Did not strip off the country calling code correctly.", strippedNumber, numberToFill.toString()); } catch (NumberParseException e) { @@ -1074,10 +1163,10 @@ public class PhoneNumberUtilTest extends TestCase { number.clear(); try { String phoneNumber = "+6423456789"; - int countryCode = 64; + int countryCallingCode = 64; StringBuffer numberToFill = new StringBuffer(); - assertEquals("Did not extract country code " + countryCode + " correctly.", - countryCode, + assertEquals("Did not extract country calling code " + countryCallingCode + " correctly.", + countryCallingCode, phoneUtil.maybeExtractCountryCode(phoneNumber, metadata, numberToFill, true, number)); assertEquals("Did not figure out CountryCodeSource correctly", @@ -1089,10 +1178,10 @@ public class PhoneNumberUtilTest extends TestCase { try { String phoneNumber = "2345-6789"; StringBuffer numberToFill = new StringBuffer(); - assertEquals("Should not have extracted a country code - no international prefix present.", - 0, - phoneUtil.maybeExtractCountryCode(phoneNumber, metadata, numberToFill, true, - number)); + assertEquals( + "Should not have extracted a country calling code - no international prefix present.", + 0, + phoneUtil.maybeExtractCountryCode(phoneNumber, metadata, numberToFill, true, number)); assertEquals("Did not figure out CountryCodeSource correctly", CountryCodeSource.FROM_DEFAULT_COUNTRY, number.getCountryCodeSource()); } catch (NumberParseException e) { @@ -1103,7 +1192,7 @@ public class PhoneNumberUtilTest extends TestCase { String phoneNumber = "0119991123456789"; StringBuffer numberToFill = new StringBuffer(); phoneUtil.maybeExtractCountryCode(phoneNumber, metadata, numberToFill, true, number); - fail("Should have thrown an exception, no valid country code present."); + fail("Should have thrown an exception, no valid country calling code present."); } catch (NumberParseException e) { // Expected. assertEquals("Wrong error type stored in exception.", @@ -1113,10 +1202,10 @@ public class PhoneNumberUtilTest extends TestCase { number.clear(); try { String phoneNumber = "(1 610) 619 4466"; - int countryCode = 1; + int countryCallingCode = 1; StringBuffer numberToFill = new StringBuffer(); - assertEquals("Should have extracted the country code of the region passed in", - countryCode, + assertEquals("Should have extracted the country calling code of the region passed in", + countryCallingCode, phoneUtil.maybeExtractCountryCode(phoneNumber, metadata, numberToFill, true, number)); assertEquals("Did not figure out CountryCodeSource correctly", @@ -1128,10 +1217,10 @@ public class PhoneNumberUtilTest extends TestCase { number.clear(); try { String phoneNumber = "(1 610) 619 4466"; - int countryCode = 1; + int countryCallingCode = 1; StringBuffer numberToFill = new StringBuffer(); - assertEquals("Should have extracted the country code of the region passed in", - countryCode, + assertEquals("Should have extracted the country calling code of the region passed in", + countryCallingCode, phoneUtil.maybeExtractCountryCode(phoneNumber, metadata, numberToFill, false, number)); assertFalse("Should not contain CountryCodeSource.", number.hasCountryCodeSource()); @@ -1142,8 +1231,8 @@ public class PhoneNumberUtilTest extends TestCase { try { String phoneNumber = "(1 610) 619 446"; StringBuffer numberToFill = new StringBuffer(); - assertEquals("Should not have extracted a country code - invalid number after extraction " + - "of uncertain country code.", + assertEquals("Should not have extracted a country calling code - invalid number after " + + "extraction of uncertain country calling code.", 0, phoneUtil.maybeExtractCountryCode(phoneNumber, metadata, numberToFill, false, number)); @@ -1155,8 +1244,8 @@ public class PhoneNumberUtilTest extends TestCase { try { String phoneNumber = "(1 610) 619 43"; StringBuffer numberToFill = new StringBuffer(); - assertEquals("Should not have extracted a country code - invalid number both before and " + - "after extraction of uncertain country code.", + assertEquals("Should not have extracted a country calling code - invalid number both " + + "before and after extraction of uncertain country calling code.", 0, phoneUtil.maybeExtractCountryCode(phoneNumber, metadata, numberToFill, true, number)); @@ -1177,10 +1266,10 @@ public class PhoneNumberUtilTest extends TestCase { assertEquals(NZ_NUMBER, phoneUtil.parse("03 331 6005", RegionCode.NZ)); // Testing international prefixes. - // Should strip country code. + // Should strip country calling code. assertEquals(NZ_NUMBER, phoneUtil.parse("0064 3 331 6005", RegionCode.NZ)); // Try again, but this time we have an international number with Region Code US. It should - // recognise the country code and parse accordingly. + // recognise the country calling code and parse accordingly. assertEquals(NZ_NUMBER, phoneUtil.parse("01164 3 331 6005", RegionCode.US)); assertEquals(NZ_NUMBER, phoneUtil.parse("+64 3 331 6005", RegionCode.US)); @@ -1191,8 +1280,8 @@ public class PhoneNumberUtilTest extends TestCase { assertEquals(DE_NUMBER, phoneUtil.parse("301/23456", RegionCode.DE)); PhoneNumber usNumber = new PhoneNumber(); - // Check it doesn't use the '1' as a country code when parsing if the phone number was already - // possible. + // Check it doesn't use the '1' as a country calling code when parsing if the phone number was + // already possible. usNumber.setCountryCode(1).setNationalNumber(1234567890L); assertEquals(usNumber, phoneUtil.parse("123-456-7890", RegionCode.US)); } @@ -1350,7 +1439,7 @@ public class PhoneNumberUtilTest extends TestCase { try { String invalidCountryCode = "+210 3456 56789"; phoneUtil.parse(invalidCountryCode, RegionCode.NZ); - fail("This is not a recognised country code: should fail: " + invalidCountryCode); + fail("This is not a recognised region code: should fail: " + invalidCountryCode); } catch (NumberParseException e) { // Expected this exception. assertEquals("Wrong error type stored in exception.", @@ -1359,8 +1448,8 @@ public class PhoneNumberUtilTest extends TestCase { } try { String someNumber = "123 456 7890"; - phoneUtil.parse(someNumber, "YY"); - fail("'Unknown' country code not allowed: should fail."); + phoneUtil.parse(someNumber, RegionCode.ZZ); + fail("'Unknown' region code not allowed: should fail."); } catch (NumberParseException e) { // Expected this exception. assertEquals("Wrong error type stored in exception.", @@ -1370,7 +1459,7 @@ public class PhoneNumberUtilTest extends TestCase { try { String someNumber = "123 456 7890"; phoneUtil.parse(someNumber, RegionCode.CS); - fail("Deprecated country code not allowed: should fail."); + fail("Deprecated region code not allowed: should fail."); } catch (NumberParseException e) { // Expected this exception. assertEquals("Wrong error type stored in exception.", @@ -1380,7 +1469,7 @@ public class PhoneNumberUtilTest extends TestCase { try { String someNumber = "123 456 7890"; phoneUtil.parse(someNumber, null); - fail("Null country code not allowed: should fail."); + fail("Null region code not allowed: should fail."); } catch (NumberParseException e) { // Expected this exception. assertEquals("Wrong error type stored in exception.", @@ -1390,7 +1479,7 @@ public class PhoneNumberUtilTest extends TestCase { try { String someNumber = "0044------"; phoneUtil.parse(someNumber, RegionCode.GB); - fail("No number provided, only country code: should fail"); + fail("No number provided, only region code: should fail"); } catch (NumberParseException e) { // Expected this exception. assertEquals("Wrong error type stored in exception.", @@ -1400,7 +1489,7 @@ public class PhoneNumberUtilTest extends TestCase { try { String someNumber = "0044"; phoneUtil.parse(someNumber, RegionCode.GB); - fail("No number provided, only country code: should fail"); + fail("No number provided, only region code: should fail"); } catch (NumberParseException e) { // Expected this exception. assertEquals("Wrong error type stored in exception.", @@ -1466,8 +1555,8 @@ public class PhoneNumberUtilTest extends TestCase { } public void testParseNumbersWithPlusWithNoRegion() throws Exception { - // "ZZ" is allowed only if the number starts with a '+' - then the country code can be - // calculated. + // RegionCode.ZZ is allowed only if the number starts with a '+' - then the country calling code + // can be calculated. assertEquals(NZ_NUMBER, phoneUtil.parse("+64 3 331 6005", RegionCode.ZZ)); // Test with full-width plus. assertEquals(NZ_NUMBER, phoneUtil.parse("\uFF0B64 3 331 6005", RegionCode.ZZ)); @@ -1514,6 +1603,7 @@ public class PhoneNumberUtilTest extends TestCase { assertEquals(ukNumber, phoneUtil.parse("+44 2034567890 X 456", RegionCode.GB)); assertEquals(ukNumber, phoneUtil.parse("+44 2034567890 x 456 ", RegionCode.GB)); assertEquals(ukNumber, phoneUtil.parse("+44 2034567890 X 456", RegionCode.GB)); + assertEquals(ukNumber, phoneUtil.parse("+44-2034567890;ext=456", RegionCode.GB)); PhoneNumber usWithExtension = new PhoneNumber(); usWithExtension.setCountryCode(1).setNationalNumber(8009013355L).setExtension("7246433"); @@ -1577,7 +1667,7 @@ public class PhoneNumberUtilTest extends TestCase { // Invalid region code supplied. try { phoneUtil.parseAndKeepRawInput("123 456 7890", RegionCode.CS); - fail("Deprecated country code not allowed: should fail."); + fail("Deprecated region code not allowed: should fail."); } catch (NumberParseException e) { // Expected this exception. assertEquals("Wrong error type stored in exception.", @@ -1614,8 +1704,8 @@ public class PhoneNumberUtilTest extends TestCase { } public void testIsNumberMatchMatches() throws Exception { - // Test simple matches where formatting is different, or leading zeroes, or country code has - // been specified. + // Test simple matches where formatting is different, or leading zeroes, or country calling code + // has been specified. assertEquals(PhoneNumberUtil.MatchType.EXACT_MATCH, phoneUtil.isNumberMatch("+64 3 331 6005", "+64 03 331 6005")); assertEquals(PhoneNumberUtil.MatchType.EXACT_MATCH, @@ -1665,10 +1755,10 @@ public class PhoneNumberUtilTest extends TestCase { // Non-matches. assertEquals(PhoneNumberUtil.MatchType.NO_MATCH, phoneUtil.isNumberMatch("03 331 6005", "03 331 6006")); - // Different country code, partial number match. + // Different country calling code, partial number match. assertEquals(PhoneNumberUtil.MatchType.NO_MATCH, phoneUtil.isNumberMatch("+64 3 331-6005", "+16433316005")); - // Different country code, same number. + // Different country calling code, same number. assertEquals(PhoneNumberUtil.MatchType.NO_MATCH, phoneUtil.isNumberMatch("+64 3 331-6005", "+6133316005")); // Extension different, all else the same. @@ -1697,8 +1787,8 @@ public class PhoneNumberUtilTest extends TestCase { phoneUtil.isNumberMatch("3 331-6005", "03 331 6005")); assertEquals(PhoneNumberUtil.MatchType.NSN_MATCH, phoneUtil.isNumberMatch(NZ_NUMBER, "03 331 6005")); - // Here the second number possibly starts with the country code for New Zealand, although we are - // unsure. + // Here the second number possibly starts with the country calling code for New Zealand, + // although we are unsure. PhoneNumber unchangedNzNumber = new PhoneNumber().mergeFrom(NZ_NUMBER); assertEquals(PhoneNumberUtil.MatchType.NSN_MATCH, phoneUtil.isNumberMatch(unchangedNzNumber, "(64-3) 331 6005")); @@ -1740,7 +1830,7 @@ public class PhoneNumberUtilTest extends TestCase { phoneUtil.isNumberMatch("1 234 345 6789", "345 6789")); assertEquals(PhoneNumberUtil.MatchType.SHORT_NSN_MATCH, phoneUtil.isNumberMatch("+1 (234) 345 6789", "345 6789")); - // NSN matches, country code omitted for one number, extension missing for one. + // NSN matches, country calling code omitted for one number, extension missing for one. assertEquals(PhoneNumberUtil.MatchType.SHORT_NSN_MATCH, phoneUtil.isNumberMatch("+64 3 331-6005", "3 331 6005#1234")); // One has Italian leading zero, one does not. @@ -1771,4 +1861,11 @@ public class PhoneNumberUtilTest extends TestCase { // We have no data for NZ - should return true. assertTrue(phoneUtil.canBeInternationallyDialled(NZ_NUMBER)); } + + public void testIsAlphaNumber() throws Exception { + assertTrue(phoneUtil.isAlphaNumber("1800 six-flags")); + assertTrue(phoneUtil.isAlphaNumber("1800 six-flags ext. 1234")); + assertFalse(phoneUtil.isAlphaNumber("1800 123-1234")); + assertFalse(phoneUtil.isAlphaNumber("1800 123-1234 extension: 1234")); + } } diff --git a/java/test/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_AD b/java/test/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_AD index f72b26475..0554c1f78 100644 Binary files a/java/test/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_AD and b/java/test/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_AD differ diff --git a/java/test/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_AO b/java/test/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_AO index 486d96d7c..8f829b8fb 100644 Binary files a/java/test/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_AO and b/java/test/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_AO differ diff --git a/java/test/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_AR b/java/test/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_AR index e2efc8f10..26edd0080 100644 Binary files a/java/test/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_AR and b/java/test/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_AR differ diff --git a/java/test/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_AU b/java/test/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_AU index 8c20ebf74..ecd675764 100644 Binary files a/java/test/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_AU and b/java/test/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_AU differ diff --git a/java/test/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_BS b/java/test/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_BS index d1a31b0a7..2c30b6123 100644 Binary files a/java/test/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_BS and b/java/test/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_BS differ diff --git a/java/test/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_DE b/java/test/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_DE index 82b22fb77..0c785345f 100644 Binary files a/java/test/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_DE and b/java/test/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_DE differ diff --git a/java/test/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_GB b/java/test/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_GB index 1d2b408b8..1cbd1f34c 100644 Binary files a/java/test/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_GB and b/java/test/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_GB differ diff --git a/java/test/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_IT b/java/test/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_IT index 3cc5f04c6..a75f0db2e 100644 Binary files a/java/test/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_IT and b/java/test/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_IT differ diff --git a/java/test/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_JP b/java/test/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_JP index 7887d3237..82581ad6d 100644 Binary files a/java/test/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_JP and b/java/test/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_JP differ diff --git a/java/test/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_KR b/java/test/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_KR index 7c2b9421e..7f29bcadd 100644 Binary files a/java/test/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_KR and b/java/test/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_KR differ diff --git a/java/test/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_MX b/java/test/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_MX index 5857b91f5..ee4a967a4 100644 Binary files a/java/test/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_MX and b/java/test/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_MX differ diff --git a/java/test/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_NZ b/java/test/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_NZ index e330135da..5a494e65a 100644 Binary files a/java/test/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_NZ and b/java/test/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_NZ differ diff --git a/java/test/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_PL b/java/test/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_PL index 0fd0d2775..424909c47 100644 Binary files a/java/test/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_PL and b/java/test/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_PL differ diff --git a/java/test/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_RE b/java/test/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_RE index 6ec64af80..77a8f8fe1 100644 Binary files a/java/test/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_RE and b/java/test/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_RE differ diff --git a/java/test/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_SG b/java/test/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_SG index 0836187d9..1dbb03bcd 100644 Binary files a/java/test/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_SG and b/java/test/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_SG differ diff --git a/java/test/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_US b/java/test/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_US index 3db0e266d..6aa74142d 100644 Binary files a/java/test/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_US and b/java/test/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_US differ diff --git a/java/test/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_YT b/java/test/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_YT index b9da1048c..50db378e9 100644 Binary files a/java/test/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_YT and b/java/test/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_YT differ