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?
4 Answers
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.
-
1Agreed. The other answers aren't necessarily wrong, but this puts it best. Commented Jul 3, 2012 at 18:48
-
This is right, but incredibly difficult. The UK's numbers are all eleven digits long, but some are split xxx-xxxx-xxxx, some xxxx-xxx-xxxx, and most xxxxx-xxxxxx. And if you include +44 as the UK country code, you omit the initial zero from the in-country code (which will confuse UK users). Commented Jul 4, 2012 at 12:02
-
@AndrewLeach: We had discussions here about UK numbers. It's such a nightmare. Advanced UX for a contact page would be a button to convert numbers between local & int'l conventions.– dnbrvCommented Jul 4, 2012 at 12:52
-
However Libphonenumber as in @JPReardon's answer does appear to work with UK numbers. +1 for that too. Commented Jul 4, 2012 at 12:56
-
@AndrewLeach: Just tested it with Belarusian numbers. The international format is right but the local one is wrong.– dnbrvCommented Jul 4, 2012 at 13:19
Short Answer:
- 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):
+CountryAreaNumber
+Country-AreaNumber
+Country-Area-Number
+Country-Area-Number-Number
+Country-Area-Number-Number-Number
Where as if the number contains spaces, it can be misread as separate phone numbers and ()s are not always recognized.
-
Mobile devices (and phone-calling software) recognize nearly any string of numbers as a phone number.– dnbrvCommented Jul 3, 2012 at 18:08
-
I often click on non-phone-numbers and my device thinks they are numbers, however, my device always has problems with parenthesis '(' and ')'. Commented Jul 3, 2012 at 18:17
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.
-
2Perfect illustration of the problem. The '1' would not be recognized as a country code where I live. We have normal phone numbers starting with 1. Here, country codes are preceded by a + or 00. The + significies the international access code in general, the 00 is the international access code here. Both are recognized broadly, thought the + less so than the 00 unfortunately.– AndréCommented Jul 4, 2012 at 10:18