Skip to content

I need some advice on json files #23

Answered by andrey-helldar
Van4kk asked this question in Q&A
Discussion options

You must be logged in to vote

Hi!

For example, you need to add your key to the localization file, for example, de:

  • Laravel <= 8: resources/lang/de.json
  • Laravel 9+: lang/de.json
{
    "The :word is only part of the sentence.": "Das :word ist nur ein Teil des Satzes."
}

And in the application call by key:

__('The :word is only part of the sentence.', ['word' => 'foo'])
// returns "Das foo ist nur ein Teil des Satzes."

See https://laravel.com/docs/9.x/localization

Replies: 0 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@Van4kk
Comment options

Answer selected by Van4kk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants