3

I would have a question if I wanted to override the translations is there a place to put the base file? because if I put the new strings here when I update I delete everything ex:

{ trans('backpack::base.already_have_an_account') }}

should i put it in resource lang?

  • Thanks for asking about this @zigozago - indeed this wasn't documented, so I've answered you below. I've also added it to the docs, here - https://backpackforlaravel.com/docs/4.1/base-how-to#customize-the-translated-strings-aka-overwrite-the-language-file – tabacitu May 26 '20 at 13:03

1 Answers1

5

You can create a new file in your resources/lang/vendor/backpack/en/base.php. Any language strings that are there will be preferred, over the ones in the package.

Alternatively, you can use

php artisan vendor:publish --provider="Backpack\CRUD\BackpackServiceProvider" --tag="lang"

which will publish ALL lang files, for ALL languages, inside resources/lang/vendor/backpack. But it's highly unlikely you need to modify all of them. In case you do publish all languages, just delete the ones you didn't overwrite. That way you only keep what's custom in your custom files, and it'll be easier to upgrade those files in the future.

tabacitu
  • 6,047
  • 1
  • 23
  • 37