-
-
Notifications
You must be signed in to change notification settings - Fork 931
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
faker.location.state() not working for sk #3052
Comments
Related to #2078 I think you need to contribute values for https://github.com/faker-js/faker/blob/next/src/locales/sk/location/state.ts |
Yeah of course, I can contribute to that but I need to understand well the behavior. On Documentation, it says I think I'm missing something, if you could point that out please ? |
Sure, just read the comment above that linked to the other PR. We introduced a specific |
The https://en.wikipedia.org/wiki/Slovakia#Administrative_divisions Currently, en_US is missing the state definitions as well, en_US uses the fallback to en to provide these data which happen to be en_US, but en really should be either absent or cover more locales. So your fallback doesn't help in this case. Since explicit "non-applicable" wins over any later fallbacks you have to adjust the order accordingly. import { sk, Faker, en } from '@faker-js/faker';
const faker = new Faker({
locale: [{ location: { state: en.location.state } }, sk],
});
console.log(faker.location.state());
It looks like we have to clarify this some more. I think we additionally have to add a sections that explicitly explains what to do when you get the missing or non applicable data errors. |
This comment was marked as duplicate.
This comment was marked as duplicate.
I created #3053 to enhance the documentation. This issue can focus on aligning the locale data for |
Thank you all for your explanations. |
Note you probably want to just use fakerSK rather than using the constructor. That automatically will use sk, en-us and en in order. |
actually that won't work since the SK states are null, rather than omitted. i think Faker is incorrect about that - null should only be used where we know that data is not applicable - e.g. https://github.com/faker-js/faker/blob/next/src/locales/en_HK/location/postcode.ts is null because Hong Kong doesn't have postcodes. Slovakia does have first-level administrative regions, it's just they havent been filled in yet. |
@boubkerbribri I tried adding some documentation for these errors: Does that help you? Is it easy to understand? Is something missing? |
Yes, I think it's clear and understandable, it's what you said on the comment with more examples. |
Part of #1977 |
Pre-Checks
Describe the bug
I'm trying to get
faker.local.state()
for local sk with a local fallback en_US, but I keep getting this error[Error]: The locale data for 'location.state' aren't applicable to this locale.
Minimal reproduction code
Additional Context
Environment Info
Which module system do you use?
Used Package Manager
npm
The text was updated successfully, but these errors were encountered: