Frontend Localization documentation appears incorrect or incomplete #6003
-
I appreciate all the good work on Laravel Nova and I enjoy working with it. It helps us immensely at work. I am, however, running into a frustration. I am attempting to use multiple languages for an app and I am following the instructions located here: https://nova.laravel.com/docs/customization/localization.html#frontend. But I have a couple of issues:
I am attempting this in my normal app frontend, not in a nova tool or custom field, if that makes a difference. Ah! One more thing... The link found here is also broken/old: |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
All above code are only available on Nova requests and will be missing on your normal app frontend. |
Beta Was this translation helpful? Give feedback.
-
I have facing almost the same issue When I import this according to the documentation
I keep getting the below error. Any help
|
Beta Was this translation helpful? Give feedback.
-
For those who come across this discussion and want to use it in a nova-component tool, here's how to correctly use this functionality:
Now add a translation key and value into the en.json file.
Open up your
|
Beta Was this translation helpful? Give feedback.
For those who come across this discussion and want to use it in a nova-component tool, here's how to correctly use this functionality:
nova-components/<your-tool>/src/ToolServiceProvider.php
nova-components/<your-tool>/resources/lang
en.json
into the new directoryNova::translations(__DIR__.'/../resources/lang/en.json');
or when using multiple locales
Nova::translations(__DIR__.'/../resources/lang/' . app()->getLocale() . '.json');
Now add a translation key and value into the en.json file.
Open up your
Tool.vue
file in theresources/js/components
directory and use…