Refactor country-specific properties#1489
Merged
kingthorin merged 5 commits intomainfrom Jan 29, 2025
Merged
Conversation
Apparently, it was occasionally commented out in commit f073184
these are settings that depend on country, not language (e.g. postal code, building numbers, passport numbers, internet domains).
The primary test showing the difference is `AddressTest.usingOnlyCountryCodeWithoutLanguage()`. E.g. `new Faker(new Locale("et", "AL")).address().countryCode()` should return "AL" (Albania), not "EE" (Estonia).
There is no such a locale. The proper locale is "de_DE" ("de" means German language, and "DE" means country Germany).
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## main #1489 +/- ##
============================================
- Coverage 92.45% 92.44% -0.01%
- Complexity 3255 3271 +16
============================================
Files 324 325 +1
Lines 6387 6437 +50
Branches 623 625 +2
============================================
+ Hits 5905 5951 +46
+ Misses 336 335 -1
- Partials 146 151 +5 ☔ View full report in Codecov by Sentry. |
snuyanzin
reviewed
Jan 28, 2025
snuyanzin
reviewed
Jan 28, 2025
snuyanzin
approved these changes
Jan 29, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Move country-specific properties from
lang.ymlto_COUNTRY.ymlfiles.These are settings that depend on country, not language (e.g. postal code, building numbers, passport numbers, internet domains).
The primary test showing the difference is
AddressTest.usingOnlyCountryCodeWithoutLanguage().For example,
And:
In this PR, I had to introduce concept of "language's default country".
In the case when only the language is given, we need to detect the country:
The list of "language's default countries" is located in
FakerContext.LANGUAGE_DEFAULT_COUNTRY.