Issue Type: New Feature Created: 2007-11-26T01:21:34.000+0000 Last Updated: 2012-11-20T20:52:47.000+0000 Status: Closed Fix version(s): Reporter: Dennis Becker (radhad) Assignee: None Tags: - Zend_Locale
Related issues: Attachments:
Zend_Phone is a new component which can handle E.164 calling numbers and display's them in a local format. Like the Zend_Date component, you can change the local format by using a different Zend_Locale. One example: you have an E.164 number like +49 211 123456789. with the locale 'de_DE' you would see this number as 0211 123456789, and someone with 'en_GB' would see it as 00 49 211 123456789.
As you can see, I have parted the phone number. This is important, because such a calling number has different parts. First of all, the '+' get's changed to the international prefix. In Germany it is '00', other countries have '0001' or something like that. The country calling number is everywhere the same. Next, we need to know, what the local prefix is. In Germany, it is the '0', like 0211 instead of 211. The Area code 211 is also important. Here it is possible to find out, if it is a mobile number or a fixed-line number. It is a lot easier to get the phone number type (mobile or fixed-line) within this component, because you have to split this number into parts or just leave an option where you can check the area code if it's a mobile or fixed-line number.
The formatting of telephone numbers, like the international prefix, the local prefix, spaces after two numbers etc. should be implemented into the Zend/Locale/Data XML files.
Besides the country calling numbers, Voice over IP providers often use the +0 calling number. Some telephone providers support those calling numbers, some don't, but to be compatible to nearly all kind of numbers, it should be added, too.
For those, who don't know the specifications of E.164 numbers I have added some links below. http://www.itu.int/publ/T-SP-E.164D-2006/en official paper which shows which country has which international number http://iso.org/iso/country_codes/… I checked the countries with this list http://en.wikipedia.org/wiki/… here you see all country calling codes http://en.wikipedia.org/wiki/E.164 E.164 specifications
Posted by Thomas Weidner (thomas) on 2007-11-26T02:04:07.000+0000
Some comments on this one:
Posted by Dennis Becker (radhad) on 2007-11-27T03:03:41.000+0000
We need to find out, which country uses which kind of format for telephone numbers. Also have to find out the following for each country: * international prefix * national prefix * area codes (about 5200 lines for Germany) * area codes for cell phones
Zend_Locale_Phone should have the following methods: * __construct(): OPTIONAL: telephone number - OPTIONAL: string|Zend_Locale * getAreaCode(): Returns the area code of a telephone number * getCountryCode(): Returns the country code of a telephone number * getPhoneNumber(): Returns the whole telephone number, either in national or international format (depends on the country code and Zend_Locale) - OPTIONAL: string|Zend_Locale $locale to change the output format * setLocale(): string|Zend_Locale $locale to change the output format * setPhoneNumber(): set a telephone number. This method must devide the telephone number in several parts and find out the country code, areacode etc. - also check if it is a cell phone network (they have also an area code) * isMobileNumber(): check if this number belongs to a network for cell phones. Returns true or false
Zend_Locale_Phone should accept the following telephone numbers and formats: * + 49 211 123456789 (E.164 format) * 0 211 123456789 - de_DE (localised national formats) * 00 49 123456789 - de_DE (localised international formats)
Maybe it allows some wrong numbers (you can easily find out the right parts of this number): * + 49 0 211 123456789 - the local national '0' is wrong, but we won't save it in the object, so we can ignore it * 00 49 2 211 123456789 - same as above, only different notation
Besides Zend_Locale_Phone a validator is needed for forms to check if it is a valid telephone number. The Zend_Validate_Phone have to check, if the number is valid in it's Zend_Locale-Format or international format. Also it should be possible to set a Zend_Locale as parameter at Zend_Validate_Phone and to match against this Locale.
Posted by Dennis Becker (radhad) on 2007-11-27T03:21:03.000+0000
I have out some more interesting websites which provide information about telephone number around the world, some I have mentioned above. * List of country calling codes http://en.wikipedia.org/wiki/… * List of international call prefixes http://en.wikipedia.org/wiki/… * List of international mobile phone codes http://en.wikipedia.org/wiki/…
The Last link has 2 different names for hwat I called national prefox and international prefix: * IDD Prefix (International Direct Dialing) * NDD Prefix (National Direct Dialing) I think we should use these names in future.
Posted by Dennis Becker (radhad) on 2007-11-30T03:50:57.000+0000
I forgot one method:
It must be possible to add a Zend_Cache_Core object for caching all the loaded data. I have set up a little page, which uses a lot Zend_Date, Zend_Currency etc. and caching with memcacheD makes the site about 20 times faster.
Zend_Locale_Phone::setCache() is a "must have"!
Posted by Thomas Weidner (thomas) on 2007-11-30T04:19:38.000+0000
All I18N classes make use of caching. This is no "must", it's automatically included. So no need of headache. :-)
Posted by Wil Sinclair (wil) on 2008-02-25T13:56:21.000+0000
Unsetting 'fix version priority' until the next major release is planned.
Posted by Rob Allen (rob) on 2012-11-20T20:52:47.000+0000
Bulk change of all issues last updated before 1st January 2010 as "Won't Fix".
Feel free to re-open and provide a patch if you want to fix this issue.
Have you found an issue?
See the Overview section for more details.