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

Fix country code length for non EN locale #2669

Merged
merged 1 commit into from
Dec 23, 2022

Conversation

vbrazo
Copy link
Member

@vbrazo vbrazo commented Dec 23, 2022

Why

Faker::Address.country_code follows the ISO country code country codes.

All locale files should use the en/address.yml for country_code to get the country code, regardless of what Faker::Config.locale is set.

How

Remove the country_code key from the non-EN locale files. Now, all locales will default the country_code to the en.address.yml, which follows the ISO 3166 standard.

Closes #2646.

Copy link
Contributor

@stefannibrasil stefannibrasil left a comment

Choose a reason for hiding this comment

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

Thank you!

@stefannibrasil stefannibrasil merged commit 92d3dfb into main Dec 23, 2022
@stefannibrasil stefannibrasil deleted the fix-3-letter-code-issue-in-locales branch December 23, 2022 19:12
@ghost
Copy link

ghost commented Jan 1, 2023

Hi,
does it make sense, not to use the Faker::Config.locale, I18n respectively for the country code?
If Faker::Address.xyz is called, the street_name/city/... responded is based on the I18n but the country code is selected randomly?
e.g.

irb(main):006:0> I18n.locale = 'da-DK'
=> "da-DK"
irb(main):009:0> Faker::Address.country_code
=> "CR"
irb(main):010:0> Faker::Address.city
=> "Jydelund"

Thank you for your feedback & happy new year
Philipp

@stefannibrasil
Copy link
Contributor

Hi, @PhiliGor It looks like these keys did not take into consideration the locales. Thanks! Could you open an issue to initiate a discussion? We have some templates. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3-letter country codes instead of 2-letter country codes in the es-MX locale
2 participants