Skip to content
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 locale configuration does not work. #30345

Closed
CristianH033 opened this issue Oct 19, 2019 · 7 comments
Closed

Faker locale configuration does not work. #30345

CristianH033 opened this issue Oct 19, 2019 · 7 comments

Comments

@CristianH033
Copy link

  • Laravel Version: 5.8.35
  • PHP Version: 7.2.19
  • Database Driver & Version: psql (PostgreSQL) 11.5

The locale configuration for faker in config > app.php does not work.

Steps To Reproduce:

  • Set the locale to config > app.php
    image

  • Create a model factory (country)
    image

  • Running the seed
    image

The results are in English:
image

But if I modify the model factory this way:
image

The results are displayed in the desired language
image

@netpok
Copy link
Contributor

netpok commented Oct 19, 2019

Laravel 5.8 is not supported anymore and it works under Laravel 6. You can run config('app.faker_locale') to verify your setting got recognized but you should update.

Also personally I think all code and database identifier should be in English.

@andershagbard
Copy link
Contributor

It's not available in 5.8. It got reverted. #29250

@netpok
Copy link
Contributor

netpok commented Oct 21, 2019

But that's for the tests, the seeders should get the faker instance from here.

@driesvints
Copy link
Member

Hey there,

Unfortunately we don't support this version anymore. Please check out our support policy on which versions we are currently supporting. Can you please try to upgrade to the latest version and see if your problem persists? We'll help you out and re-open this issue if so.

Thanks!

@Vercoutere
Copy link

I'm experiencing the same issue on the latest release (6.15.0).
The faker locale doesn't seem to be applied anywhere, no matter what I try.
I tried using my factory on an endpoint, in a test, and in a seeder. The resulting data is always from the en_US provider. Dumping my faker_locale in my factory class confirms it's not a caching issue and the faker_locale is in fact set to something else (nl_BE in my case).

@jamesfairhurst
Copy link
Contributor

@Vercoutere this is happening due to the change in #30992 - I can no longer get locale fake data either using the WithFaker trait.

@sidben
Copy link

sidben commented Aug 13, 2020

I was having trouble with faker not respecting the locale value of app.php, turns out there was some stuff cached with the old value.

I ran php artisan config:cache and it solved the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants