floere/phony — Issue #31: Argentina phone number formatting is quite broken
Author: vilcsak
Created: 2011-10-25 23:42:31+00:00
State: open

I'd implement this fix myself, but don't truly understand enough about how the gem works to make the changes.

Right now, we format *all* Argentina numbers as +54 xx xxx xxx. They should be formatted as:

A) Local numbers. Many area codes, 2-4 digits. Different area codes result in the remainder of the number being formatted differently.

+54 11 1234 5678
+54 291 123 4567
+54 2965 12 3456

B) Mobile numbers. Follows above convention, but "9" is prepended to all numbers.

+54 9 11 1234 5678
+54 9 220 123 3457
+54 9 2221 12 3455

Full of list of area codes, as scraped from http://www.cnc.gov.ar/infotecnica/numeracion/indicativosinter.asp?offset=0 (using http://sak.to/0612291C3x1U1S0B1g0G):

11, 220, 2202, 221, 2221, 2223, 2224, 2225, 2226, 2227, 2229, 223, 2241, 2242, 2243, 2244, 2245, 2246, 2252, 2254, 2255, 2257, 2261, 2262, 2264, 2265, 2266, 2271, 2272, 2273, 2274, 2281, 2283, 2284, 2285, 2286, 2291, 2292, 2293, 2314, 2316, 2317, 2320, 2322, 2323, 2324, 2325, 2326, 2337, 2342, 2343, 2344, 2345, 2346, 2352, 2353, 2354, 2355, 2356, 2357, 2358, 2268, 2296, 2297, 2362, 2267, 237, 2392, 2393, 2394, 2395, 2396, 2473, 2474, 2475, 2477, 2478, 291, 2921, 2922, 2923, 2924, 2925, 2926, 2927, 2928, 2929, 2932, 2933, 2935, 2936, 2982, 2983, 3327, 3329, 3382, 3388, 3407, 3461, 3487, 3488, 3489, 3832, 3833, 3835, 3837, 3838, 3711, 3715, 3721, 3722, 3725, 3731, 3732, 3734, 3735, 3877, 297, 2965, 2945, 2903, 3385, 3387, 2336, 3472, 3463, 3467, 3468, 351, 3521, 3522, 3524, 3525, 353, 3532, 3533, 3534, 3541, 3542, 3543, 3544, 3546, 3547, 3548, 3549, 3562, 3563, 3564, 3571, 3572, 3573, 3574, 3575, 3576, 358, 3582, 3583, 3585, 3584, 3756, 3772, 3773, 3774, 3775, 3777, 3781, 3782, 3783, 3786, 345, 3454, 3455, 3456, 3458, 343, 3435, 3436, 3437, 3438, 3442, 3444, 3445, 3446, 3447, 3716, 3718, 3717, 388, 3884, 3885, 3886, 3887, 2941, 2338, 2333, 2334, 2335, 2331, 2302, 2952, 2953, 2954, 3821, 3822, 3825, 3826, 3827, 261, 2622, 2623, 2624, 2625, 2626, 2627, 3741, 3743, 3758, 3757, 3755, 3754, 3751, 3752, 2942, 2948, 299, 2972, 2944, 2946, 2940, 2934, 2931, 2920, 3878, 3876, 3868, 387, 3875, 264, 2646, 2647, 2648, 2651, 2652, 2658, 2655, 2656, 2657, 2902, 2962, 2963, 2966, 342, 3408, 3406, 3409, 341, 3400, 3401, 3402, 3404, 3405, 3462, 3460, 3469, 3471, 3464, 3465, 3466, 3476, 3482, 3483, 3491, 3492, 3493, 3498, 3496, 3497, 3857, 3858, 3861, 3844, 3845, 3846, 385, 3854, 3855, 3856, 3841, 3843, 2964, 2901, 381, 3862, 3863, 3865, 3867, 3869, 3894, 3891, 3892