/**
* Returns a text description for the given phone number, in the language provided. The
* description might consist of the name of the country where the phone number is from, or the
* name of the geographical area the phone number is from if more detailed information is
* available.
*
* <p>This method assumes the validity of the number passed in has already been checked, and that
* the number is suitable for geocoding. We consider fixed-line and mobile numbers possible
* candidates for geocoding.
*
* @param number a valid phone number for which we want to get a text description
* @param languageCode the language code for which the description should be written
* @return a text description for the given language code for the given phone number
*/
public String getDescriptionForValidNumber(PhoneNumber number, Locale languageCode)
{
String langStr = languageCode.getLanguage();
String scriptStr = ""; // No script is specified
String regionStr = languageCode.getCountry();
String areaDescription =
getAreaDescriptionForNumber(number, langStr, scriptStr, regionStr);
return (areaDescription.length() > 0)
? areaDescription : getCountryNameForNumber(number, languageCode);
}