Learn how to localize your Nova application.
nova:install
command during installation. Your application will contain a lang/vendor/nova
translation directory.
Within this directory, you may customize the en.json
file or create a new JSON translation file for your language. In addition, the en
directory contains a few additional validation translation lines that are utilized by Nova.
nova:translate
Artisan command. This command will simply copy the default en.json
translation file, allowing you to begin translating the strings into your own language:
app()->getLocale()
by default. However, if your application is only using ISO 639-1 language codes (en
), you may wish to consider migrating your languages to IETF language tags (en-US
, en-GB
) for wider support across the various frontend libraries used by Nova.
To map your existing locales to IETF language tags, you may use the Nova::userLocale
method. Typically, you should invoke this method in the boot
method of your application’s NovaServiceProvider
:
label
and singularLabel
methods on the resource class:
createButtonLabel
and updateButtonLabel
methods on the resource:
label
and singularLabel
methods on the related resource:
name
method on the filter class:
name
method on the lens class:
name
method on the action class:
name
method on the metric class:
Nova::translations
method within your NovaServiceProvider
:
__
helper within your custom Vue components to access these translations. To accomplish this, add the following mixins to your Inertia page component or Vue component: