faker-ruby / faker

A library for generating fake data such as names, addresses, and phone numbers.
MIT License
11.28k stars 3.18k forks source link

Add Kenya to supported countries #2871

Closed AndrewNduati closed 10 months ago

AndrewNduati commented 11 months ago

Motivation / Background

This Pull Request has been created because the country Kenya is missing from the list of countries in Faker.

Additional information

I mainly used information from Wikipedia about Kenya and a list of publicly traded companies from the Nairobi Securities Exchange as of November 2023.

Checklist

Before submitting the PR make sure the following are checked:

AndrewNduati commented 11 months ago

Updated my branch with changes from main.

AndrewNduati commented 10 months ago

Hey @stefannibrasil ,

I've made the recommended updates. Please let me know whether they're in line with the comments you made above. :)

stefannibrasil commented 10 months ago

@AndrewNduati thank you for your patience! Left one comment about the phone numbers.

Also, when I try to use this generator in the console (rake console), I get this error:

Faker::Config.locale = 'en-KE'
=> "en-KE"
irb(main):002> Faker::Address.country
/Users/stefannibrasil/.asdf/installs/ruby/3.0.6/lib/ruby/gems/3.0.0/gems/i18n-1.14.1/lib/i18n.rb:351:in `enforce_available_locales!': "en-KE" is not a valid locale (I18n::InvalidLocale)

Is the generator working for you?

AndrewNduati commented 10 months ago

Thanks @stefannibrasil for reviewing this.

I suspect the reason you're running into that error is because en-KE isn't in the gem yet. I replicated this by using the current version of the gem and run into the same error.

To get the current en-KE to work, I launched the console using irb -Ilib command in my current working directory of the gem. So far it looks like it's working, but I've also seen a couple of odd bugs that'll try and fix with the next commit.

irb(main):001> require 'faker'
=> true
 irb(main):003> Faker::Config.locale = 'en-KE'
=> "en-KE"
irb(main):004> Faker::Address.default_country_code
=> "KE"