Localisation
Introduction
Our implementation allows you to localise the title
, detail
and code
members in JSON:API error objects. This chapter provides details of how to localise the different errors that are generated by Laravel JSON:API.
We are also happy to receive pull requests to add default language files to our packages.
JSON:API Compliance Errors
All our specification compliance errors can be localised if desired. Simply publish the compliance translation files, using the following Artisan command:
php artisan vendor:publish --provider="LaravelJsonApi\Spec\ServiceProvider"
This will publish the translation files to /resources/lang/vendor/jsonapi-spec
.
TIP
Pull Requests to add default language files for specification compliance must be submitted to the laravel-json-api/spec
repository.
Validation Errors
All our validation errors for resource requests and query parameter validation can be localised if desired. This includes default messages for all the Laravel JSON:API rule objects.
Simply publish the validation translation files, using the following Artisan command:
php artisan vendor:publish --provider="LaravelJsonApi\Validation\ServiceProvider"
This will publish the translation files to /resources/lang/vendor/jsonapi-validation
.
TIP
Pull Requests to add default language files for specification compliance must be submitted to the laravel-json-api/validation
repository.