-
Notifications
You must be signed in to change notification settings - Fork 151
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
Defining a locale using expressions? #882
Comments
depending on your customer you might be interested in datafaker-gen(datafaker based configurable generator ) https://github.com/datafaker-net/datafaker-gen where it's possible to specify locale |
no, you can do it like that Faker faker = new Faker();
faker.doWith(() -> faker.expression("#{Name.firstName}"), Locale.GERMAN); |
Amazing work with this library! Thank you for the |
@snuyanzin the only thing I noticed is that this operation is not thread-safe. Is there a multi-threaded environment alternative? |
Please be more specific. |
no, it's not thread safe so it's possible to create a faker per thread or even per task and it will be cheap (based on same measurements) performance of creation a new instance of faker is comparable with performance of simple expression evaluation. In case of complex expression initialization will be faster |
Each
There are many entries for Japanese locale containing english names and vice-versa.
Will each Faker lookup using the resolver load the values from files into memory? In other words, should I be worried about memory consumption with instancing a new Faker per call? |
only if you request it. |
Awesome, thanks for all the help! |
I would like to evaluate an expression using a dynamically specified locale. A user needs to be able to specify both the expression and locale.
Is it possible to pass a specific locale to
Faker.expression
? Currently, if the user specifies expression such as#{Name.firstName}
, they cannot specify the locale for which the name should be generated.Do I need to construct a new Faker instance per call with the defined locale?
The text was updated successfully, but these errors were encountered: