-
-
Notifications
You must be signed in to change notification settings - Fork 944
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
QUESTION : cascading locality fallbacks #265
Comments
TL;DR 😅 We should just implement a simple Line 199 in c1f2b09
And then just use it in order the values are provided in a cascade |
Hello @Moosh-be. We like your proposal/feedback and would appreciate a contribution via a Pull Request by you or another community member. We thank you in advance for your contribution and are looking forward to reviewing it! |
I'm not sure whether we should keep the notion of The central change will be here: https://github.com/faker-js/faker/blob/main/src/index.ts#L408-L420 I have a POC here: Note, that this requires some changes to the logic how certain fields are checked. @Moosh-be Do you want to take over/start your own implementation? |
QUESTION : cascading locality fallbacks
Was # 977 in marak repo.
Moosh-be opened this issue on 25 Aug
In most of case the "sub locales" are not fully different of basic locale.
Most of content of fr is valid for fr_BE
How to double /cascade the fallback ?
fr_BE --> fr --> en
Marak commented on 25 Aug
Seems like we will want to add this.
I've made note and will attempt to include this functionality in the next major release version.
Moosh-be commented on 25 Aug
If it's not done I want share an idea.
as the lib is builded, perhaps it's better for performance to generate a merged big file including the "heritage"
(but perhaps it's a bad idea ;-)
I see also some confusion between language and country.
Marak commented on 25 Aug
When I look at shape of https://github.com/ladjs/i18n-locales data, it seems like hierarchy of locality is simple meta-programming problem, so it should be easy to implement better fallback features assuming modularity abstraction pattern of faker.js is already solved at higher level ( I am doing now ).
Same answer when build-time. Actual problem here is complex dependency graph issue, but since i18n list is finite size set we will cheat and make it simple solution.
FYI, this cascade fallback is very smart idea @Moosh-be. I am glad you make this report.
Marak commented on 26 Aug
I was just thinking that we can probably implement a quick version of this with the current version and structure of faker.js. Incremental locale builds are currently manual only so we could just ignore the build aspect of this for now.
It would just be a matter of starting at the base locality and attempting to traverse up the locality name as string using metaprogramming technique and checking for existence of key in faker definitions.
I don't have any plans to implement this right now but I'd imagine it could be done with a small PR.
Moosh-be commented on 26 Aug
FYI : Personally, I am an old school developer (js in 1998 :-) when jquery arrived I had already quit. I will not dare to embark on such a development. I contribute because faker.js is integrated with POSTMAN and because I want my fellow developers to use it
I'have the good level to test, to translate, to document but not to help on the core
The text was updated successfully, but these errors were encountered: