diff options
author | dbeaumont@google.com <dbeaumont@google.com@ee073f10-1060-11df-b6a4-87a95322a99c> | 2013-05-08 15:14:06 +0000 |
---|---|---|
committer | dbeaumont@google.com <dbeaumont@google.com@ee073f10-1060-11df-b6a4-87a95322a99c> | 2013-05-08 15:14:06 +0000 |
commit | d29fa27e6cb65c28ae7a6cf430a446f1d465a6f6 (patch) | |
tree | adbf7f5fbf7c9a5f080c4921e4e5b97ce203827e /phonenumberutil.cc | |
parent | 854813f7162b7cb7259aff54b0f2535c817f06f4 (diff) | |
download | phonenumbers-d29fa27e6cb65c28ae7a6cf430a446f1d465a6f6.tar.gz |
JAVA/C++/JS: libphonenumber v5.5
git-svn-id: http://libphonenumber.googlecode.com/svn/trunk/cpp/src/phonenumbers@574 ee073f10-1060-11df-b6a4-87a95322a99c
Diffstat (limited to 'phonenumberutil.cc')
-rw-r--r-- | phonenumberutil.cc | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/phonenumberutil.cc b/phonenumberutil.cc index 317e14a..50d8176 100644 --- a/phonenumberutil.cc +++ b/phonenumberutil.cc @@ -1057,10 +1057,21 @@ void PhoneNumberUtil::FormatNumberForMobileDialing( // string here. formatted_number->assign(""); } + } else if (region_code == "HU") { + // The national format for HU numbers doesn't contain the national prefix, + // because that is how numbers are normally written down. However, the + // national prefix is obligatory when dialing from a mobile phone. As a + // result, we add it back here. + Format(number_no_extension, NATIONAL, formatted_number); + string hu_national_prefix; + GetNddPrefixForRegion(region_code, true /* strip non-digits */, + &hu_national_prefix); + formatted_number->assign( + StrCat(hu_national_prefix, " ", *formatted_number)); } else { - // For NANPA countries, non-geographical countries, and Mexican fixed line - // and mobile numbers, we output international format for numbers that can - // be dialed internationally as that always works. + // For NANPA countries, non-geographical countries, Mexican and Chilean + // fixed line and mobile numbers, we output international format for + // numbers that can be dialed internationally as that always works. if ((country_calling_code == kNanpaCountryCode || region_code == kRegionCodeForNonGeoEntity || // MX fixed line and mobile numbers should always be formatted in @@ -1070,7 +1081,12 @@ void PhoneNumberUtil::FormatNumberForMobileDialing( // local area. It is trickier to get that to work correctly than // using international format, which is tested to work fine on all // carriers. - (region_code == "MX" && is_fixed_line_or_mobile)) && + // CL fixed line numbers need the national prefix when dialing in the + // national format, but don't have it when used for display. The + // reverse is true for mobile numbers. As a result, we output them in + // the international format to make it work. + ((region_code == "MX" || region_code == "CL") && + is_fixed_line_or_mobile)) && CanBeInternationallyDialled(number_no_extension)) { Format(number_no_extension, INTERNATIONAL, formatted_number); } else { |