fix: likely typo in phone locale fallback: map Persian (fa) to IR instead of FR.#1788
Conversation
PR Summary
|
asolntsev
left a comment
There was a problem hiding this comment.
Good point, "fa" stands for Persian language (Farsi) primarily used in Iran.
Thank you for the contribution.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1788 +/- ##
============================================
+ Coverage 92.31% 92.39% +0.07%
- Complexity 3446 3449 +3
============================================
Files 339 339
Lines 6794 6794
Branches 670 670
============================================
+ Hits 6272 6277 +5
+ Misses 355 353 -2
+ Partials 167 164 -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 where which 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.
```
case "fa" -> "FR"; // France
Inspired by #1788
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
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
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
Fix a likely typo in the language-only phone locale fallback by mapping Persian (fa) to IR instead of FR. This prevents new Locale("fa") from generating French phone numbers, and adds a regression test to lock in the correct behavior.