Faker set locale #3447
Faker set locale
#3447
-
Hi, how to setLocale to faker on factories Adonis 5 ?
|
Beta Was this translation helpful? Give feedback.
Answered by
Julien-R44
Dec 28, 2021
Replies: 2 comments 2 replies
-
Do not use a external package for this, you can use Adonis factories |
Beta Was this translation helpful? Give feedback.
1 reply
-
You can do it like this : export const AccountFactory = Factory.define(Account, ({ faker }) => {
faker.setLocale('it')
...
return {}
}) Looking at the lucid source code, there doesn't seem to be a way to globally define faker localization at the moment. That said, the feature could be added quite easily, if you have the time to do a PR ! |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
clabnet
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can do it like this :
Looking at the lucid source code, there doesn't seem to be a way to globally define faker localization at the moment. That said, the feature could be added quite easily, if you have the time to do a PR !