-
-
Notifications
You must be signed in to change notification settings - Fork 929
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
Remove locale switching support #1340
Comments
Why cant they be scoped to the module? |
They could be. If we drop support for replacing them. |
I'm somewhat interested to be champion of this, but have some other issues I already provide higher prio from my work-amount |
Just to clarify, if you're currently using a single locale like this: import { faker } from '@faker-js/faker';
// or with CJS,
// const {faker} = require("@faker-js/faker")
faker.locale = "de" //or setLocale
console.log(faker.word.noun()) //Glücksspiel The recommended migration will be to switch to import { faker } from '@faker-js/faker/locale/de';
// or with CJS,
// const {faker} = require("@faker-js/faker/locale/de")
console.log(faker.word.noun()) //Glücksspiel ? |
We are not sure yet if we still want to support Our actual plan is to encourage using one of these options (might be slightly different in real world after we done it): import { faker, fakerDE, localeDE, ... } from '@faker-js/faker'
fakerDE.word.noun()
const myFaker = new Faker({ locale: [localeDE, ...] })
myFaker.word.noun() |
Yes or import { fakerDE } from '@faker-js/faker'; If we use #1735. |
Looks like we exactly woke up the same time 🤣 |
Would it make sense to land this in v9, and in v8 switching locales to a non-en locale still works but add a smaller PR which shows a deprecation message encouraging you to switch to the locale-specific import syntax now? |
We currently didn't find a way how we could achieve that |
We could support this: faker.locale = localeDE; but not the currently supported: faker.locale = 'de'; |
Yes, but this wont help as it would be a total breaking change anyways and also does not lead into the direction we are aiming for anyways. |
rough idea something like #1812 |
One thing i don't really like about the
e.g. if i was previously using
and then i have lots of calls in my code like
and then i read the docs and realize i can get more realistic data for my use-case by using the en-GB locale, previously i had to add one line, but now I have to do
and then i have to change lots of other lines of code like
and anywhere where the docs refer to
? |
IMO yes, they should 👍 |
i think the main README and https://fakerjs.dev/guide/usage.html should probably show the most common use-cases for importing only ie
And then more unusual cases could be linked to
|
Done
Done, not sure if you had that in mind: |
Clear and concise description of the problem
The locale switching support adds a lot of overhead to the faker instance.
Especially the default instance is huge.
Suggested solution
new Faker([ en ])
en
fr_CH -> fr -> en
Alternative
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: