diff --git a/cpp/src/phonenumbers/geocoding/mapping_file_provider.h b/cpp/src/phonenumbers/geocoding/mapping_file_provider.h index 88f282ac7..2c2ce3e7f 100644 --- a/cpp/src/phonenumbers/geocoding/mapping_file_provider.h +++ b/cpp/src/phonenumbers/geocoding/mapping_file_provider.h @@ -46,11 +46,11 @@ class MappingFileProvider { // Returns the name of the file that contains the mapping data for the // country_calling_code in the language specified, or an empty string if no - // such file can be found. language is a two-letter lowercase ISO language - // codes as defined by ISO 639-1. script is a four-letter titlecase (the first - // letter is uppercase and the rest of the letters are lowercase) ISO script - // codes as defined in ISO 15924. region is a two-letter uppercase ISO country - // codes as defined by ISO 3166-1. + // such file can be found. language is a two or three-letter lowercase + // language code as defined by ISO 639. script is a four-letter titlecase (the + // first letter is uppercase and the rest of the letters are lowercase) ISO + // script code as defined in ISO 15924. region is a two-letter uppercase ISO + // country code as defined by ISO 3166-1. const string& GetFileName(int country_calling_code, const string& language, const string& script, const string& region, string* filename) const; diff --git a/cpp/src/phonenumbers/geocoding/phonenumber_offline_geocoder.h b/cpp/src/phonenumbers/geocoding/phonenumber_offline_geocoder.h index c31b03b15..b760ea169 100644 --- a/cpp/src/phonenumbers/geocoding/phonenumber_offline_geocoder.h +++ b/cpp/src/phonenumbers/geocoding/phonenumber_offline_geocoder.h @@ -93,7 +93,7 @@ class PhoneNumberOfflineGeocoder { // // user_region is the region code for a given user. This region will be // omitted from the description if the phone number comes from this region. It - // should be a two-letter uppercase ISO country code as defined by ISO 3166-1. + // should be a two-letter uppercase CLDR region code. string GetDescriptionForValidNumber(const PhoneNumber& number, const Locale& language, const string& user_region) const; @@ -133,11 +133,11 @@ class PhoneNumberOfflineGeocoder { // Returns an area-level text description in the given language for the given // phone number, or an empty string. - // lang is a two-letter lowercase ISO language codes as defined by ISO 639-1. + // lang is a two or three-letter lowercase ISO language code as defined by ISO + // 639. // script is a four-letter titlecase (the first letter is uppercase and the - // rest of the letters are lowercase) ISO script codes as defined in ISO - // 15924. - // region should be a two-letter uppercase ISO country codes as defined by ISO + // rest of the letters are lowercase) ISO script code as defined in ISO 15924. + // region should be a two-letter uppercase ISO country code as defined by ISO // 3166-1. const char* GetAreaDescription(const PhoneNumber& number, const string& lang, const string& script, diff --git a/cpp/src/phonenumbers/phonenumberutil.h b/cpp/src/phonenumbers/phonenumberutil.h index 0b44fe682..d42f13921 100644 --- a/cpp/src/phonenumbers/phonenumberutil.h +++ b/cpp/src/phonenumbers/phonenumberutil.h @@ -56,9 +56,9 @@ class PhoneNumberRegExpsAndMappings; class RegExp; // NOTE: A lot of methods in this class require Region Code strings. These must -// be provided using ISO 3166-1 two-letter country-code format. The list of the -// codes can be found here: -// http://www.iso.org/iso/english_country_names_and_code_elements +// be provided using CLDR two-letter region-code format. These should be in +// upper-case. The list of the codes can be found here: +// http://www.unicode.org/cldr/charts/30/supplemental/territory_information.html class PhoneNumberUtil : public Singleton { private: diff --git a/java/demo/war/phonenumberparser.jsp b/java/demo/war/phonenumberparser.jsp index 63de010f5..8c9cc2018 100644 --- a/java/demo/war/phonenumberparser.jsp +++ b/java/demo/war/phonenumberparser.jsp @@ -20,7 +20,7 @@ Specify a Default Country: ( - ISO 3166-1 two-letter country code) + CLDR two-letter region code)

Step 3

Specify a locale for phone number geocoding (Optional, defaults to en): diff --git a/java/geocoder/src/com/google/i18n/phonenumbers/geocoding/PhoneNumberOfflineGeocoder.java b/java/geocoder/src/com/google/i18n/phonenumbers/geocoding/PhoneNumberOfflineGeocoder.java index 1cfcac383..e1b3bbdf9 100644 --- a/java/geocoder/src/com/google/i18n/phonenumbers/geocoding/PhoneNumberOfflineGeocoder.java +++ b/java/geocoder/src/com/google/i18n/phonenumbers/geocoding/PhoneNumberOfflineGeocoder.java @@ -156,7 +156,7 @@ public class PhoneNumberOfflineGeocoder { * @param languageCode the language code for which the description should be written * @param userRegion the region code for a given user. This region will be omitted from the * description if the phone number comes from this region. It should be a two-letter - * uppercase ISO country code as defined by ISO 3166-1. + * upper-case CLDR region code. * @return a text description for the given language code for the given phone number, or an * empty string if the number could come from multiple countries, or the country code is * in fact invalid @@ -203,7 +203,7 @@ public class PhoneNumberOfflineGeocoder { * @param languageCode the language code for which the description should be written * @param userRegion the region code for a given user. This region will be omitted from the * description if the phone number comes from this region. It should be a two-letter - * uppercase ISO country code as defined by ISO 3166-1. + * uppercase CLDR region code. * @return a text description for the given language code for the given phone number, or empty * string if the number passed in is invalid or could belong to multiple countries */ diff --git a/java/internal/prefixmapper/src/com/google/i18n/phonenumbers/prefixmapper/PrefixFileReader.java b/java/internal/prefixmapper/src/com/google/i18n/phonenumbers/prefixmapper/PrefixFileReader.java index c390b8e2b..f8d81660b 100644 --- a/java/internal/prefixmapper/src/com/google/i18n/phonenumbers/prefixmapper/PrefixFileReader.java +++ b/java/internal/prefixmapper/src/com/google/i18n/phonenumbers/prefixmapper/PrefixFileReader.java @@ -104,10 +104,10 @@ public class PrefixFileReader { * Returns a text description in the given language for the given phone number. * * @param number the phone number for which we want to get a text description - * @param lang two-letter lowercase ISO language codes as defined by ISO 639-1 + * @param lang two or three-letter lowercase ISO language code as defined by ISO 639 * @param script four-letter titlecase (the first letter is uppercase and the rest of the letters - * are lowercase) ISO script codes as defined in ISO 15924 - * @param region two-letter uppercase ISO country codes as defined by ISO 3166-1 + * are lowercase) ISO script code as defined in ISO 15924 + * @param region two-letter uppercase ISO country code as defined by ISO 3166-1 * @return a text description in the given language for the given phone number, or an empty * string if a description is not available */ diff --git a/java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java b/java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java index 4ce278100..c67405290 100644 --- a/java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java +++ b/java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java @@ -44,9 +44,9 @@ import java.util.regex.Pattern; * our mailing list. * * NOTE: A lot of methods in this class require Region Code strings. These must be provided using - * ISO 3166-1 two-letter country-code format. These should be in upper-case. The list of the codes + * CLDR two-letter region-code format. These should be in upper-case. The list of the codes * can be found here: - * http://www.iso.org/iso/country_codes/iso_3166_code_lists/country_names_and_code_elements.htm + * http://www.unicode.org/cldr/charts/30/supplemental/territory_information.html * * @author Shaopeng Jia */ diff --git a/javascript/i18n/phonenumbers/asyoutypeformatter.js b/javascript/i18n/phonenumbers/asyoutypeformatter.js index 53ee5a311..8b8f10d1f 100644 --- a/javascript/i18n/phonenumbers/asyoutypeformatter.js +++ b/javascript/i18n/phonenumbers/asyoutypeformatter.js @@ -47,8 +47,8 @@ goog.require('i18n.phonenumbers.metadata'); /** * Constructs an AsYouTypeFormatter for the specific region. * - * @param {string} regionCode the ISO 3166-1 two-letter region code that denotes - * the region where the phone number is being entered. + * @param {string} regionCode the CLDR two-letter region code that denotes the + * region where the phone number is being entered. * @constructor */ i18n.phonenumbers.AsYouTypeFormatter = function(regionCode) { diff --git a/javascript/i18n/phonenumbers/demo-compiled.html b/javascript/i18n/phonenumbers/demo-compiled.html index 0e19b935c..74b45306d 100644 --- a/javascript/i18n/phonenumbers/demo-compiled.html +++ b/javascript/i18n/phonenumbers/demo-compiled.html @@ -35,7 +35,7 @@ limitations under the License.

Specify a Default Country: - (ISO 3166-1 two-letter country code) + (CLDR two-letter region code)

Specify a Carrier Code: diff --git a/javascript/i18n/phonenumbers/demo.html b/javascript/i18n/phonenumbers/demo.html index cab962c95..cd13d5703 100644 --- a/javascript/i18n/phonenumbers/demo.html +++ b/javascript/i18n/phonenumbers/demo.html @@ -44,7 +44,7 @@ limitations under the License.

Specify a Default Country: - (ISO 3166-1 two-letter country code) + (CLDR two-letter region code)

Specify a Carrier Code: diff --git a/javascript/i18n/phonenumbers/phonenumberutil.js b/javascript/i18n/phonenumbers/phonenumberutil.js index f1681ad41..f4c67b402 100644 --- a/javascript/i18n/phonenumbers/phonenumberutil.js +++ b/javascript/i18n/phonenumbers/phonenumberutil.js @@ -20,11 +20,10 @@ * Functionality includes formatting, parsing and validation. * (based on the java implementation). * - * NOTE: A lot of methods in this class require Region Code strings. These must - * be provided using ISO 3166-1 two-letter country-code format. These should be - * in upper-case (but for compatibility lower-case is also allowed). The list of - * the codes can be found here: - * http://www.iso.org/iso/english_country_names_and_code_elements + * NOTE: A lot of methods in this class require Region Code strings. These must be provided using + * CLDR two-letter region-code format. These should be in upper-case. The list of the codes + * can be found here: + * http://www.unicode.org/cldr/charts/30/supplemental/territory_information.html * * Credits to Nikolaos Trogkanis for original implementation. */ @@ -1434,7 +1433,7 @@ i18n.phonenumbers.PhoneNumberUtil.prototype.isNumberGeographical = /** * Helper function to check region code is not unknown or null. * - * @param {?string} regionCode the ISO 3166-1 two-letter region code. + * @param {?string} regionCode the CLDR two-letter region code. * @return {boolean} true if region code is valid. * @private */ @@ -3094,7 +3093,7 @@ i18n.phonenumbers.PhoneNumberUtil.prototype.getNddPrefixForRegion = function( * Checks if this is a region under the North American Numbering Plan * Administration (NANPA). * - * @param {?string} regionCode the ISO 3166-1 two-letter region code. + * @param {?string} regionCode the CLDR two-letter region code. * @return {boolean} true if regionCode is one of the regions under NANPA. */ i18n.phonenumbers.PhoneNumberUtil.prototype.isNANPACountry = diff --git a/pending_code_changes.txt b/pending_code_changes.txt index 8b1378917..79f643fb8 100644 --- a/pending_code_changes.txt +++ b/pending_code_changes.txt @@ -1 +1,8 @@ - +Code changes: + - Doc changes to update references to ISO country codes to CLDR region codes, + which are what we actually use. Notice in some of the mapper files the + country code is still the ISO one, because it's used as part of a description + of a language only (e.g. zh-TW vs zh-CN). Edited the language comments there + since they can be two *or* three letters (c.f. fil for filipino). Also edited + the comment for leadingDigits at the territory level in the + phonemetadata.proto file. diff --git a/resources/PhoneNumberAlternateFormats.xml b/resources/PhoneNumberAlternateFormats.xml index dfa8ddaff..3d0eedb15 100644 --- a/resources/PhoneNumberAlternateFormats.xml +++ b/resources/PhoneNumberAlternateFormats.xml @@ -30,12 +30,12 @@ mainCountryForCode set to true in PhoneNumberMetadata.xml should be present here. - Note: Territories are in alphabetical order by their IDs, which are based on ISO 3166-1 - two-letter country codes. The country names in the comments are the official short names - in English according to ISO 3166-1. + Note: Territories are in alphabetical order by their IDs, which are based on CLDR + two-letter region codes (or are set to "001" for non-geographical entities, which + represents "World" in the UN M.49 standard). The country names in the comments are the + official short names in English according to CLDR. - For more information on what each element represents, see - resources/phonemetadata.proto + For more information on what each element represents, see resources/phonemetadata.proto -->