-
Notifications
You must be signed in to change notification settings - Fork 171
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
Laravel 8. Uncaught ReferenceError: Lang is not defined #155
Comments
with the command php:artisan lang:js , it generates a file called messages.js in your public folder (default setting). This file does not only contain your translations, but also lang.js itself. All you have to do is include this into your layout file like this: <script src="{{ asset('messages.js') }}"></script>and then use it somewhere in your code like this: Lang.get('whatever.some_key'); |
any REAL solutions?? |
I fixed this by changing file type to json, and then running In app.js you have to manually load Lang lib, and set localised json as massages:
This is probably not the best implementation or be perfect fit for you, but it's a start. I run around 20 different languages for my Vue frontend with this config. |
@Mult1Hunter How can I implement your solution with React ? |
I don't know where this error comes from and how to solve it.
I'have added Mariuzzo\LaravelJsLocalization\LaravelJsLocalizationServiceProvider::class in config/app.php and I am able to generate messages.js.
Please help! :)
The text was updated successfully, but these errors were encountered: