Skip to content

Commit

Permalink
Fix/remove country code from phone numbers (#2087)
Browse files Browse the repository at this point in the history
* remove country code from phone numbers

* add country code to some countries
  • Loading branch information
gabrielbaldao authored Jul 27, 2020
1 parent 8053bc3 commit 13fce80
Show file tree
Hide file tree
Showing 19 changed files with 56 additions and 28 deletions.
6 changes: 4 additions & 2 deletions lib/locales/de-AT.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,10 @@ de-AT:
- "#{first_name} #{last_name} #{last_name}"
- "#{first_name} #{last_name} #{last_name}"

country_code: ['43']

phone_number:
formats: ['01 #######', '01#######', '+43-1-#######', '+431#######', '0#### ####', '0#########', '+43-####-####', '+43 ########']
formats: ['01 #######', '01#######', '1-#######', '1#######', '0#### ####', '0#########', '####-####', '########']

cell_phone:
formats: ['+43-6##-#######', '06##-########', '+436#########', '06##########']
formats: ['6##-#######', '06##-########', '6#########', '06##########']
4 changes: 3 additions & 1 deletion lib/locales/de-CH.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1708,5 +1708,7 @@ de-CH:
internet:
domain_suffix: [com, net, biz, ch, de, li, at, ch, ch]

country_code: ['41']

phone_number:
formats: ['0800 ### ###', '0800 ## ## ##', '0## ### ## ##', '0## ### ## ##', '+41 ## ### ## ##', '0900 ### ###', '076 ### ## ##', '+4178 ### ## ##', '0041 79 ### ## ##']
formats: ['0800 ### ###', '0800 ## ## ##', '0## ### ## ##', '0## ### ## ##', '## ### ## ##', '0900 ### ###', '076 ### ## ##', '78 ### ## ##', '0041 79 ### ## ##']
6 changes: 4 additions & 2 deletions lib/locales/de.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,13 @@ de:
material: [Stahl, Holz, Beton, Plastik, Baumwoll, Granit, Gummi, Leder, Seiden, Wolle, Leinen, Marmor, Eisen, Bronze, Kupfer, Aluminium, Papier]
product: [Stuhl, Auto, Computer, Handschuh, Hose, Hemd, Tisch, Schuh, Hut, Teller, Messer, Flasche, Mantel, Lampe, Tastatur, Tasche, Bank, Uhr, Armbanduhr, Geldbörse]

country_code: ['49']

phone_number:
formats: ['(0###) #########', '(0####) #######', '+49-###-#######', '+49-####-########']
formats: ['(0###) #########', '(0####) #######', '###-#######', '####-########']

cell_phone:
formats: ['+49-15##-#######', '+49-16#-#######', '+49-17#-#######']
formats: ['15##-#######', '16#-#######', '17#-#######']

book:
title: ['Also sprach Zarathustra', 'Andorra', 'Ansichten Eines Clowns', 'Atemschaukel', 'Aus dem Leben eines Taugenichts', 'Bekenntnisse des Hochstaplers Felix Krull', 'Berlin Alexanderplatz', 'Biedermann und die Brandstifter', 'Billiard um halbzehn', 'Catharina von Georgien', 'Cleopatra', 'Damals war es Friedrich', 'Dantons Tod', 'Das Boot', 'Das Marmorbild', 'Das Parfum', 'Das Schiff Esperanza', 'Das Versprechen', 'Das kalte Herz', 'Das steinerne Herz', 'Der (kleine) Schatz im Kugelbauch', 'Der Augenblick der Liebe', 'Der Ausflug der toten Mädchen', 'Der Besuch der alten Dame', 'Der Brief des Lord Chandos', 'Der Goldene Topf', 'Der Hauptmann von Köpenick', 'Der Mann ohne Eigenschaften', 'Der Prozess', 'Der Richter und sein Henker', 'Der Sandmann', 'Der Schimmelreiter', 'Der Spaziergang', 'Der Stechlin', 'Der Stellvertreter', 'Der Steppenwolf', 'Der Tod in Venedig und andere Erzählungen', 'Der Tor und der Tod', 'Der Untertan', 'Der Verdacht', 'Der Vorleser', 'Der Vulkan', 'Der Zauberberg', 'Der abenteuerliche Simplicissimus', 'Der arme Spielmann', 'Der eiserne Gustav', 'Der geteilte Himmel', 'Der grüne Heinrich', 'Der gute Mensch von Sezuan', 'Der veruntreute Himmel', 'Der zerbrochene Krug', 'Des Teufels General', 'Deutschland. Ein Wintermärchen', 'Die Aufzeichnungen des Malte Laurids Brigge', 'Die Blechtrommel', 'Die Box', 'Die Buddenbrooks', 'Die Dreigroschenoper', 'Die Erschiessung des Landesverräters Ernst S.', 'Die Lehre der Sainte-Victoire', 'Die Leiden des jungen Werther', 'Die Leute von Seldwyla', 'Die Marquise von O...', 'Die Panne', 'Die Physiker', 'Die Rote', 'Die Räuber', 'Die Verwandlung/Erstes Leid', 'Die Waffen nieder!', 'Die Welt als Wille & Wahn', 'Die neuen Leiden des jungen Werthers', 'Die unendliche Geschichte', 'Die verlorene Ehre der Katharina Blum', 'Die zärtlichen Schwestern', 'Don Karlos', 'Effi Briest', 'Ehen in Philippsburg', 'Eiche und Angora', 'Ein fliehendes Pferd', 'Ende einer Dienstfahrt', 'Es geschah im Nachbarhaus', 'Fabian', 'Faserland', 'Faust, Part I', 'Franziska Linkerhand', 'Frühlings Erwachen', 'Ganz unten', 'Gehirne', 'Die Weber', 'Götz von Berlichingen', 'Haus ohne Hüter', 'Heidi', 'Heinrich von Ofterdingen', 'Helden wie wir', 'Homo faber', 'Hyperion oder der Eremit in Griechenland', 'Im Krebsgang', 'Im Westen nichts Neues', 'Iphigenie auf Tauris', 'Italienische Reise', 'Jahrestage', 'Jakob der Lügner', 'Jedermann', 'Kabale und Liebe', 'Katz und Maus', 'Leben des Galilei', 'Lenz', 'Lerne lachen ohne zu weinen', 'Emilia Galotti', 'Lieutenant Gustl', 'Maria Magdalene', 'Maria Stuart', 'Mario und der Zauberer', 'Mephisto', 'Minna von Barnhelm', 'Miss Sara Sampson', 'Mutter Courage und ihre Kinder', 'Narziss und Goldmund', 'Narziß und Goldmund', 'Nathan der Weise', 'Paare, Passanten', 'Panter, Tiger & Co.', 'Reigen', 'Romeo und Julia auf dem Dorfe', 'Romulus der Große', 'Sansibar oder der letzte Grund', 'Schachnovelle', 'Siddhartha', 'Sterbender Cato', 'Stolz und Vorurteil', 'Tauben im Gras', 'Till Eulenspiegel', 'Traumnovelle/Die Braut', 'Tödliche Versprechen/Das Imperium der Wölfe', 'Unterhaltungen deutscher Ausgewanderten', 'Unterm Rad', 'Vor Sonnenaufgang', 'Wer einmal aus dem Blechnapf frisst', 'Wilhelm Meisters Wanderjahre oder die Entsagenden', 'Wilhelm Tell', 'Winnetou', 'Winnetou II', 'Woyzeck', 'Über das Studium der griechischen Poesie']
Expand Down
3 changes: 2 additions & 1 deletion lib/locales/en-MS.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ en-MS:
street_address:
- "No. #{building_number}, #{street_name}"
default_country: [Malaysia]
country_code: ['603-56', '603-80']
phone_number:
formats: ['03#######', '+601########']
formats: ['03#######', '01########']
bank:
name: [Affin Bank Berhad, Agro Bank Berhad, Alliance Bank Malaysia Berhad, AmBank Berhad, Bank Islam Berhad, Bank Muamalat Berhad, Bank Rakyat Berhad, Bank Simpanan Nasional, CIMB Bank Berhad, Hong Leong Bank Berhad, Malayan Banking Berhad, Public Bank Berhad, RHB Bank Berhad, Tabung Haji]
5 changes: 4 additions & 1 deletion lib/locales/en-NEP.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,8 @@ en-NEP:
domain_suffix: ['np', 'com', 'info', 'net', 'org']
company:
suffix: ['Pvt Ltd', 'Group', 'Ltd', 'Limited']

country_code: ['977']

phone_number:
formats: ['##-#######', '+977-#-#######', '+977########']
formats: ['##-#######', '#-#######', '########']
4 changes: 3 additions & 1 deletion lib/locales/en-NZ.yml
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,10 @@ en-NZ:
- "#{street_address}, #{community}, #{city} #{postcode}"
- "#{mail_box} #{community} #{postcode}"
- "#{mail_box}, #{community}, #{city} #{postcode}"

country_code: ['64']
phone_number:
formats: ['0# ### ####', '+64 # ### ####']
formats: ['0# ### ####', '# ### ####']
cell_phone:
formats: ['02##-###-###', '02## ### ###', '02# ### ###', '02#-###-####']

Expand Down
3 changes: 2 additions & 1 deletion lib/locales/en-PAK.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ en-PAK:
domain_suffix: [pk, com, com.pk, name, net, org, html, edu]
company:
suffix: [Pvt Ltd, Limited, Ltd, and Sons, Corp, Group, Brothers, CO]
country_code: ['92']
phone_number:
formats: ['+92##########', '+92 ### #######', '03##-#######']
formats: ['##########', '### #######', '03##-#######']
3 changes: 2 additions & 1 deletion lib/locales/en-SG.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ en-SG:
street_address:
- "#{building_number} #{street_name}"
default_country: [Singapore]
country_code: ['65']
phone_number:
formats: ['+65 6### ####', '+65 9### ####', '+65 8### ####']
formats: ['6### ####', '9### ####', '8### ####']
vehicle:
license_plate: 'S??####'
3 changes: 2 additions & 1 deletion lib/locales/en-au-ocker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ en-au-ocker:
building_number: ['####', '###', '##']
street_suffix: [Avenue, Boulevard, Circle, Circuit, Court, Crescent, Crest, Drive, Estate Dr, Grove, Hill, Island, Junction, Knoll, Lane, Loop, Mall, Manor, Meadow, Mews, Parade, Parkway, Pass, Place, Plaza, Ridge, Road, Run, Square, Station St, Street, Summit, Terrace, Track, Trail, View Rd, Way]
default_country: [Australia]
country_code: ['61']
phone_number:
formats: ['0# #### ####', '+61 # #### ####', '+61 4## ### ###'] #iOS AUS phone formats
formats: ['0# #### ####', '# #### ####', '4## ### ###'] #iOS AUS phone formats
cell_phone:
formats: ['04##-###-###', '(0) 4##-###-###', '04## ### ###', '04########', '04## ## ## ##']
7 changes: 5 additions & 2 deletions lib/locales/fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,14 @@ fr:
- "#{first_name} #{last_name} #{last_name}"
- "#{first_name} #{last_name} #{last_name}"
- "#{first_name} #{last_name} #{last_name}"

country_code: ['33']

phone_number:
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 ## ## ## ##']
formats: ['01########', '02########', '03########', '04########', '05########', '09########', '1########', '2########', '3########', '4########', '5########', '9########', '01 ## ## ## ##', '02 ## ## ## ##', '03 ## ## ## ##', '04 ## ## ## ##', '05 ## ## ## ##', '09 ## ## ## ##', '1 ## ## ## ##', '2 ## ## ## ##', '3 ## ## ## ##', '4 ## ## ## ##', '5 ## ## ## ##', '9 ## ## ## ##']

cell_phone:
formats: ['06########', '07########', '+33 6########', '+33 7########', '06 ## ## ## ##', '07 ## ## ## ##', '+33 6 ## ## ## ##', '+33 7 ## ## ## ##']
formats: ['06########', '07########', '6########', '7########', '06 ## ## ## ##', '07 ## ## ## ##', '6 ## ## ## ##', '7 ## ## ## ##']

book:
title: ['La Discipline des orphelins', 'Le Couloir de tous les mépris', "L'Odeur du sanglier", 'La Promise du voyeur', "L'Odyssée invisible", 'La Soumission comme passion', 'Le Siècle de la rue voisine', 'Le Désir des femmes fortes', 'Pourquoi je mens ?', 'La Peau des savants', 'La progéniture du mal']
Expand Down
3 changes: 2 additions & 1 deletion lib/locales/id.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@ id:
- "#{street_prefix} #{street_title}"
street_address:
- "#{street_name} No. #{building_number}"
country_code: ['62']
phone_number:
formats: ['08##########', '08##-####-####', '+628#########']
formats: ['08##########', '08##-####-####', '8#########']
3 changes: 2 additions & 1 deletion lib/locales/it.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,9 @@ it:
- "#{first_name} #{last_name} #{last_name}"
- "#{first_name} #{last_name} #{last_name}"
- "#{first_name} #{last_name} #{last_name}"
country_code: ['39']
phone_number:
formats: ['+## ### ## ## ####', '+## ## #######', '+## ## ########', '+## ### #######', '+## ### ########', '+## #### #######', '+## #### ########', '0## ### ####', '+39 0## ### ###', '3## ### ###', '+39 3## ### ###']
formats: ['### ## ## ####', '## #######', '## ########', '### #######', '### ########', '#### #######', '#### ########', '0## ### ####', '0## ### ###', '3## ### ###', '3## ### ###']
subscription:
plans: ["Prova gratuita", "Basico", "Starter", "Essential", "Studente", Bronze", "Standard", "Silver", "Gold", "Platinum", "Profesional", "Business", "Diamond", "Premium"]
statuses: ["Attivo", "Inattivo", "Bloccato", "In sospeso"]
Expand Down
6 changes: 4 additions & 2 deletions lib/locales/nb-NO.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,10 @@ nb-NO:
- "#{first_name} #{last_name} #{last_name}"
- "#{first_name} #{last_name} #{last_name}"

country_code: ['47']

phone_number:
formats: ["########", "## ## ## ##", "### ## ###", "+47 ## ## ## ##"]
formats: ["########", "## ## ## ##", "### ## ###", "## ## ## ##"]

cell_phone:
formats: ["########", "## ## ## ##", "### ## ###", "+47 ## ## ## ##"]
formats: ["########", "## ## ## ##", "### ## ###", "## ## ## ##"]
4 changes: 3 additions & 1 deletion lib/locales/pt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,7 @@ pt:
- "#{first_name} #{last_name} #{last_name}"
- "#{first_name} #{last_name} #{last_name}"

country_code: ['351']

phone_number:
formats: ["(##) ###-####", "+351 (##) ###-####", "884 ###-###"]
formats: ["(##) ###-####", "(##) ###-####", "884 ###-###"]
4 changes: 3 additions & 1 deletion lib/locales/ru.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,10 @@ ru:
name_with_middle:
- "#{first_name} #{last_name} #{last_name}"

country_code: ['7']

phone_number:
formats: ['+7(9##)###-##-##']
formats: ['(9##)###-##-##']

commerce:
color: [красный, зеленый, синий, желтый, багровый, мятный, зеленовато-голубой, белый, черный, оранжевый, розовый, серый, красно-коричневый, фиолетовый, бирюзовый, желто-коричневый, небесно голубой, оранжево-розовый, темно-фиолетовый, орхидный, оливковый, пурпурный, лимонный, кремовый, сине-фиолетовый, золотой, красно-пурпурный, голубой, лазурный, лиловый, серебряный]
Expand Down
6 changes: 4 additions & 2 deletions lib/locales/sk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ sk:
first_name:
- "#{male_first_name}"
- "#{female_first_name}"


country_code: ['421']

phone_number:
formats: ['09## ### ###', '0## #### ####', '0# #### ####', '+421 ### ### ###']
formats: ['09## ### ###', '0## #### ####', '0# #### ####', '### ### ###']
2 changes: 1 addition & 1 deletion test/test_de_at_locale.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,6 @@ def test_de_at_name_methods
end

def test_de_at_phone_number_methods
assert_match(/(43)|(06)|(436)[\d\s]+$/, Faker::PhoneNumber.cell_phone)
assert_match(/(43)|(06)|(436)[\d\s]+$/, Faker::PhoneNumber.cell_phone_with_country_code)
end
end
6 changes: 3 additions & 3 deletions test/test_de_locale.rb
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ def test_de_space_methods
end

def test_de_cell_phone_countrycode
mobile = Faker::PhoneNumber.cell_phone.gsub(/\D/, '')
assert_equal '4', mobile[0]
assert_equal '9', mobile[1]
mobile = Faker::PhoneNumber.cell_phone_with_country_code.gsub(/\D/, '')

assert_match(/^(0|49)/, mobile)
end
end
6 changes: 3 additions & 3 deletions test/test_fr_locale.rb
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,13 @@ def test_fr_phone_number_methods
end

def test_fr_phone_format
phone = Faker::PhoneNumber.phone_number.gsub(/\D/, '')
assert_match(/^(0|33)([1-5]|[8-9])\d{8}$/, phone)
phone = Faker::PhoneNumber.phone_number_with_country_code.gsub(/\D/, '')
assert_match(/^(0|33)\d{8,10}$/, phone)
end

def test_fr_cell_phone_format
mobile = Faker::PhoneNumber.cell_phone.gsub(/\D/, '')
assert_match(/^(0|33)(6|7)\d{8}$/, mobile)
assert_match(/^0?(6|7)\d{8}$/, mobile)
end

def test_fr_pokemon_methods
Expand Down

0 comments on commit 13fce80

Please sign in to comment.