From b0ab11d93dd09c513a1009a28325ff6efdddf9a2 Mon Sep 17 00:00:00 2001 From: Andrew Nduati Date: Mon, 5 Feb 2024 21:22:29 +0300 Subject: [PATCH] Add Kenya to supported countries (#2871) * Add Kenya to supported countries * Add tests for locale * clan up pull request * Add landline telephone numbers and cell phone formats --- lib/locales/en-KE.yml | 212 ++++++++++++++++++++++++++++++++++++++ test/test_en_ke_locale.rb | 42 ++++++++ 2 files changed, 254 insertions(+) create mode 100644 lib/locales/en-KE.yml create mode 100644 test/test_en_ke_locale.rb diff --git a/lib/locales/en-KE.yml b/lib/locales/en-KE.yml new file mode 100644 index 0000000000..d7e3e572d0 --- /dev/null +++ b/lib/locales/en-KE.yml @@ -0,0 +1,212 @@ +en-KE: + faker: + internet: + domain_suffix: + - ke + - co.ke + - org.ke + - or.ke + - go.ke + - ac.ke + - info.ke + address: + default_country: + - Republic of Kenya + default_country_code: + - KE + counties: + - Kiambu + - Siaya + - Bungoma + - Kericho + - Kilifi + - Kisumu + - Machakos + - Nakuru + - Kisii + - Busia + - Homa Bay + - Kajiado + - Kakamega + - Laikipia + - Migori + - Taita-Taveta + - Embu + - Kitui + - Meru + - Murang'a + - Nyamira + - Turkana + - Trans-Nzoia + - Uasin Gishu + - Vihiga + - Baringo + - Bomet + - Elgeyo-Marakwet + - Garissa + - Isiolo + - Kirinyaga + - Kwale + - Mandera + - Marsabit + - Mombasa + - Nairobi + - Nandi + - Narok + - Nyandarua + - Nyeri + - Samburu + - Tharaka-Nithi + - Wajir + - West Pokot + county: + - "#{counties}" + cities: + - Bungoma + - Busia + - El Wak + - Eldoret + - Emali + - Embu + - Gilgil + - Homa Bay + - Isiolo + - Juja + - Kakamega + - Karuri + - Kenol + - Kericho + - Kiambu + - Kikuyu + - Kilifi + - Kimilili + - Kiserian + - Kisii + - Kisumu + - Kitengela + - Limuru + - Lodwar + - Machakos + - Malindi + - Mandera + - Mavoko + - Meru + - Migori + - Mombasa + - Moyale + - Mtwapa + - Muranga + - Nairobi + - Naivasha + - Nakuru + - Nanyuki + - Narok + - Ngong + - Nyeri + - Ruiru + - Thika + - Ukunda + - Voi + - Wajir + - Wanguru + - Webuye + city: + - "#{cities}" + company: + company_names: + - ABSA Kenya + - ARM Cement + - Africa Development Bank (AfDB) + - B.O.C Kenya + - Bamburi Cement + - Britam Holdings + - British American Tobacco Kenya + - CIC Insurance Group + - Car & General (K) + - Carbacid Investments + - Centum Investment + - Crown Paints Kenya + - Deacons (East Africa) + - Diamond Trust Bank Kenya + - E.A Cables + - E.A Portland Cement + - Eaagads + - East African Breweries + - Equity Group Holdings + - Eveready East Africa + - Express Kenya + - Flame Tree Group Holdings + - HF Group + - Home Afrika + - Homeboyz Entertainment + - I & M Holdings + - ILAM Fahari I-REIT + - Jubilee Holdings + - KCB Group + - Kakuzi + - Kapchorua Tea Kenya + - KenGen + - Kenya Airways + - Kenya Orchards + - Kenya Power & Lighting + - Kenya Re-Insurance Corporation + - Kurwitu Ventures + - Liberty Kenya Holdings + - Limuru Tea + - Longhorn Publishers + - Mumias Sugar + - NCBA Group + - Nairobi Business Ventures + - Nairobi Securities Exchange + - Nation Media Group + - Olympia Capital Holdings + - Safaricom + - Sameer Africa + - Sanlam Kenya + - Sasini + - Stanbic Holdings + - Standard Chartered Bank Kenya + - Standard Group + - TPS Eastern Africa (Serena) + - The Co-operative Bank of Kenya + - Total Kenya + - Trans-Century + - Uchumi Supermarket + - Umeme + - Unga Group + - WPP Scangroup + - Williamson Tea Kenya + suffix: + - Co. + - Ltd + - Plc + - Trust + name: + - "#{company_names}" + phone_number: + country_code: + - "254" + area_code: + # area codes for Nairobi, Mombasa, Eldoret & Kisumu cities + - "20" + - "41" + - "51" + - "57" + formats: + - "### #######" + - "##########" + - "###-#######" + cell_phone: + formats: + # safaricom + - "0711 ######" + - "0722 ######" + # Airtel + - "010# ######" + - "0730 ######" + # Telkom + - "0770 ######" + - "0771 ######" + # Equitel + - "0763 ######" + - "0764 ######" \ No newline at end of file diff --git a/test/test_en_ke_locale.rb b/test/test_en_ke_locale.rb new file mode 100644 index 0000000000..ce088e8d0a --- /dev/null +++ b/test/test_en_ke_locale.rb @@ -0,0 +1,42 @@ +# frozen_string_literal: true + +require_relative 'test_helper' + +class TestEnKeLocale < Test::Unit::TestCase + def setup + Faker::Config.locale = 'en-KE' + end + + def teardown + Faker::Config.locale = nil + end + + def test_en_ke_address_methods + assert Faker::Address.city.is_a? String + assert Faker::Address.county.is_a? String + assert Faker::Address.default_country.is_a? String + assert Faker::Address.default_country_code.is_a? String + end + + def test_en_ke_company_methods + assert Faker::Company.name.is_a? String + assert Faker::Company.suffix.is_a? String + assert Faker::Company.company_names.is_a? String + end + + def test_en_ke_internet_methods + assert Faker::Internet.domain_suffix.is_a? String + end + + def test_en_ke_country_code_starts_with_254 + phone_number = Faker::PhoneNumber.country_code + + assert_equal '+254', phone_number[0..3] + end + + def test_en_ke_cell_phone_starts_with_0 + cell_number = Faker::PhoneNumber.cell_phone + + assert_equal '0', cell_number[0] + end +end