fix wrong auto-detection of country by language#1791
Conversation
PR Summary
|
af4eca4 to
3726d4b
Compare
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1791 +/- ##
============================================
- Coverage 92.34% 92.17% -0.17%
- Complexity 3447 3456 +9
============================================
Files 339 339
Lines 6794 6813 +19
Branches 670 670
============================================
+ Hits 6274 6280 +6
- Misses 354 364 +10
- Partials 166 169 +3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
When locale contains only language, but not country, the phone generator tries to guess the country.
For few specific languages, the guess was wrong. It happened for languages which code occasionally matches some other country's code.
```
new Faker(new Language("am").phoneNumber(); // generated Armenian phone instead of Ethiopian
new Faker(new Language("ar").phoneNumber(); // generated Argentina phone instead of Saudi Arabia
```
etc.
Inspired by #1788
3726d4b to
8b576e6
Compare
When give
Localecontains only language, but not country, the phone generator tries to guess the country.For few specific languages, the guess was wrong. It happened for languages which code occasionally matches some other country's code.
etc.
Ideally, users should always provide locale with country:
But at least we don't predict the wrong country anymore.
Inspired by #1788