The site I'm working on will list contact data for dealers from around the globe. I'm uncertain what the best way to display non-US phone numbers is. Reading Local conventions for writing telephone numbers on Wikipedia isn't as fruitful as I had hoped. So my main question is, what would be a good format to follow for phone numbers?
My answer is the one you probably don't want to hear but it's the one & only way if you want good UX:
Phone numbers must be displayed in a format that is familiar to the average person in that locality regardless of who's looking at the website because every country has different numbering plans & traditions.
For example, if an American is using a computer with US English locale in Germany to look up the number for an office of a Russian company in France on the English version of the site, the format must follow French convention.
The easiest way to accomplish this is to search for existing scripts that format phone numbers based on the country code. The hard way is to analyze numbering plans of all the countries, for which you need to display the numbers, and create your own script that would take a string of numbers and format it properly.
- ITU-T E.123 (PDF) will give you an idea of how to format international numbers
- Libphonenumber from Google will actually do the formatting for you (demo here)
Slightly longer answer:
Ideally, phone numbers should be displayed in a format easily readable by humans and recognizable as a phone number by devices. Further, the number should really be in the format the person would need to dial from their location. For example, if the user is in the US and the number is in Brazil, the county code for Brazil should be shown. If the user and the number are in the same country, the country code doesn't need to be shown. This can be a pretty tall order given all of the countries out there, most of which have there own, unique way of presenting area/city codes and local numbers.
The International Telecommunication Union has published their formatting recomendations in E.123 (PDF). In order to use these, you'll need to know which parts of the numbers are the country code, area code etc. Depending on your data, you may or may not know which parts of the number are which. Even if you do, the development and testing of such a solution may be non-trival.
Check out Libphonenumber from Google. It formats phone numbers for every part of the world. It also includes functions for displaying in localized formats as well as validation. If you can use this in your project, it will save you a lot of effort. Take a look at the libphonenumber demo to see it in action.
I am not sure how standard these formats are, but I think these international number formats are recognized by all mobile devices as phone numbers (I think this is an important consideration):
Where as if the number contains spaces, it can be misread as separate phone numbers and ()s are not always recognized.
I would suggest separating the numbers by country headings using the country code, then list the numbers in whatever format is common for that country.
People will, most likely, search for the locality they wish to call then dial in that format. If you need to reformat some of the numbers to mat the local format you might need some sort of hash of formatting styles. For example if country code is 1 then the format should be "1-###-###-####" or something like that.