Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Kenya to supported countries #2871

Merged
merged 8 commits into from
Feb 5, 2024
212 changes: 212 additions & 0 deletions lib/locales/en-KE.yml
Original file line number Diff line number Diff line change
@@ -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:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, we might want to break it down by country_code, area code, etc. Here's an example: https://github.com/faker-ruby/faker/blob/main/lib/locales/en/phone_number.yml

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stefannibrasil Made the changes and updated the tests too. Please let me know if there's anything else needed from me :)

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 ######"
42 changes: 42 additions & 0 deletions test/test_en_ke_locale.rb
Original file line number Diff line number Diff line change
@@ -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