Few locales are saving the phone number formats with country code, e.g. fr-CH. When we call method phone_number_with_country_code sometimes it returns multiple country codes.
$ Faker::Config.locale = 'fr-CH'
=> "fr-CH"
$ Faker::PhoneNumber.phone_number_with_country_code
=> "+238 +41 460036680"
$ Faker::PhoneNumber.cell_phone_with_country_code
=> "+54 +41.9700.122663"
There should be single country code
These formats should work with and without country codes, meaning for some countries if country code is not present then 0 gets added to format. e.g. for fr-CH locale
Calling from nation 02######## => Faker::PhoneNumber.phone_number
Calling from outside nation +41 2######## => Faker::PhoneNumber.phone_number_with_country_code
Sounds good to me. PR's welcome.
Can I try fix that?
@gabrielbaldao Sure, go ahead.
This has been fixed for fr-CH locale (Thanks to the PR from @gabrielbaldao ). But there are various other locales that needs to be fixed:
~/g/f/l/locales (master) $ rg formats *yml | grep +
de-AT.yml: formats: ['01 #######', '01#######', '+43-1-#######', '+431#######', '0#### ####', '0#########', '+43-####-####', '+43 ########']
de-AT.yml: formats: ['+43-6##-#######', '06##-########', '+436#########', '06##########']
de-CH.yml: formats: ['0800 ### ###', '0800 ## ## ##', '0## ### ## ##', '0## ### ## ##', '+41 ## ### ## ##', '0900 ### ###', '076 ### ## ##', '+4178 ### ## ##', '0041 79 ### ## ##']
de.yml: formats: ['(0###) #########', '(0####) #######', '+49-###-#######', '+49-####-########']
de.yml: formats: ['+49-15##-#######', '+49-16#-#######', '+49-17#-#######']
en-au-ocker.yml: formats: ['0# #### ####', '+61 # #### ####', '+61 4## ### ###'] #iOS AUS phone formats
en-MS.yml: formats: ['03#######', '+601########']
en-NEP.yml: formats: ['##-#######', '+977-#-#######', '+977########']
en-PAK.yml: formats: ['+92##########', '+92 ### #######', '03##-#######']
en-SG.yml: formats: ['+65 6### ####', '+65 9### ####', '+65 8### ####']
en-NZ.yml: formats: ['0# ### ####', '+64 # ### ####']
fr.yml: formats: ['01########', '02########', '03########', '04########', '05########', '09########', '+33 1########', '+33 2########', '+33 3########', '+33 4########', '+33 5########', '+33 9########', '01 ## ## ## ##', '02 ## ## ## ##', '03 ## ## ## ##', '04 ## ## ## ##', '05 ## ## ## ##', '09 ## ## ## ##', '+33 1 ## ## ## ##', '+33 2 ## ## ## ##', '+33 3 ## ## ## ##', '+33 4 ## ## ## ##', '+33 5 ## ## ## ##', '+33 9 ## ## ## ##']
fr.yml: formats: ['06########', '07########', '+33 6########', '+33 7########', '06 ## ## ## ##', '07 ## ## ## ##', '+33 6 ## ## ## ##', '+33 7 ## ## ## ##']
it.yml: formats: ['+## ### ## ## ####', '+## ## #######', '+## ## ########', '+## ### #######', '+## ### ########', '+## #### #######', '+## #### ########', '0## ### ####', '+39 0## ### ###', '3## ### ###', '+39 3## ### ###']
id.yml: formats: ['08##########', '08##-####-####', '+628#########']
nb-NO.yml: formats: ["########", "## ## ## ##", "### ## ###", "+47 ## ## ## ##"]
nb-NO.yml: formats: ["########", "## ## ## ##", "### ## ###", "+47 ## ## ## ##"]
pt.yml: formats: ["(##) ###-####", "+351 (##) ###-####", "884 ###-###"]
ru.yml: formats: ['+7(9##)###-##-##']
sk.yml: formats: ['09## ### ###', '0## #### ####', '0# #### ####', '+421 ### ### ###']
Can I fix the another locales in the same PR?
[Edit]
I just realize already was merged, can i fix the another locales em one PR?
@gabrielbaldao I'm fine either-wise. :-)
Most helpful comment
This has been fixed for
fr-CHlocale (Thanks to the PR from @gabrielbaldao ). But there are various other locales that needs to be fixed: