diff --git a/java/demo/src/main/java/com/google/phonenumbers/demo/render/ResultRenderer.java b/java/demo/src/main/java/com/google/phonenumbers/demo/render/ResultRenderer.java index 1d28cedf59..e491371a30 100644 --- a/java/demo/src/main/java/com/google/phonenumbers/demo/render/ResultRenderer.java +++ b/java/demo/src/main/java/com/google/phonenumbers/demo/render/ResultRenderer.java @@ -64,7 +64,9 @@ public String genHtml() { .setExtension(number.getExtension()) .setCountryCodeSource(number.getCountryCodeSource().toString()) .setItalianLeadingZero(number.isItalianLeadingZero()) - .setRawInput(number.getRawInput()); + .setNumberOfLeadingZeros(number.getNumberOfLeadingZeros()) + .setRawInput(number.getRawInput()) + .setPreferredDomesticCarrierCode(number.getPreferredDomesticCarrierCode()); boolean isNumberValid = phoneUtil.isValidNumber(number); boolean hasDefaultCountry = !defaultCountry.isEmpty() && !defaultCountry.equals("ZZ"); @@ -104,7 +106,11 @@ public String genHtml() { .setOutOfCountryFormatFromUs( isNumberValid ? phoneUtil.formatOutOfCountryCallingNumber(number, "US") : "invalid") .setOutOfCountryFormatFromCh( - isNumberValid ? phoneUtil.formatOutOfCountryCallingNumber(number, "CH") : "invalid"); + isNumberValid ? phoneUtil.formatOutOfCountryCallingNumber(number, "CH") : "invalid") + .setMobileDiallingFormatFromUs( + isNumberValid ? phoneUtil.formatNumberForMobileDialing(number, "US", true) : "invalid") + .setNationalDiallingFormatWithPreferredCarrierCode( + isNumberValid ? phoneUtil.formatNationalNumberWithCarrierCode(number, "") : "invalid"); // Get As You Type Formatter Table List> rows = new ArrayList<>(); diff --git a/java/demo/src/main/resources/com/google/phonenumbers/demo/result.soy b/java/demo/src/main/resources/com/google/phonenumbers/demo/result.soy index b448bf21c7..e3107109e8 100644 --- a/java/demo/src/main/resources/com/google/phonenumbers/demo/result.soy +++ b/java/demo/src/main/resources/com/google/phonenumbers/demo/result.soy @@ -9,7 +9,9 @@ {@param extension: string} {@param countryCodeSource: string} {@param italianLeadingZero: bool} +{@param numberOfLeadingZeros: int} {@param rawInput: string} +{@param preferredDomesticCarrierCode: string} {@param isPossibleNumber: bool} {@param isValidNumber: bool} @@ -29,6 +31,8 @@ {@param internationalFormat: string} {@param outOfCountryFormatFromUs: string} {@param outOfCountryFormatFromCh: string} +{@param mobileDiallingFormatFromUs: string} +{@param nationalDiallingFormatWithPreferredCarrierCode: string} {@param rows: list>} @@ -74,10 +78,18 @@ italian_leading_zero {$italianLeadingZero} + + number_of_leading_zeros + {$numberOfLeadingZeros} + raw_input {$rawInput} + + preferred_domestic_carrier_code + {$preferredDomesticCarrierCode} +
@@ -189,6 +201,14 @@ Out-of-country format from CH {$outOfCountryFormatFromCh} + + Format for mobile dialing (calling from US) + {$mobileDiallingFormatFromUs} + + + Format for national dialing with preferred carrier code and empty fallback carrier code + {$nationalDiallingFormatWithPreferredCarrierCode} +
diff --git a/javascript/i18n/phonenumbers/demo.js b/javascript/i18n/phonenumbers/demo.js index f8908b371a..e18d351ad1 100644 --- a/javascript/i18n/phonenumbers/demo.js +++ b/javascript/i18n/phonenumbers/demo.js @@ -148,6 +148,16 @@ function phoneNumberParser() { output.append( phoneUtil_.formatNationalNumberWithCarrierCode(number, carrierCode)); } + output.append('\nFormat for mobile dialing (calling from US): '); + output.append( + isNumberValid ? + phoneUtil_.formatNumberForMobileDialing(number, 'US', true) : + 'invalid'); + output.append('\nFormat for national dialing with preferred carrier code and empty fallback carrier code: '); + output.append( + isNumberValid ? + phoneUtil_.formatNationalNumberWithPreferredCarrierCode(number, '') : + 'invalid'); output.append('\n\n****AsYouTypeFormatter Results****'); var formatter = new i18n.phonenumbers.AsYouTypeFormatter(regionCode); var phoneNumberLength = phoneNumber.length;