I need some advice on json files #23
-
Yo !I'm using Laravel Lang json files an I need an advice or explication how to use ":variable". I know that I can make a sentence universal by changing a ":word", but where do I write that ":word", how do I use it? Thank you ! |
Beta Was this translation helpful? Give feedback.
Answered by
andrey-helldar
May 24, 2022
Replies: 0 comments 2 replies
-
Hi! For example, you need to add your key to the localization file, for example,
{
"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." |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
Van4kk
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi!
For example, you need to add your key to the localization file, for example,
de
:resources/lang/de.json
lang/de.json
And in the application call by key:
See https://laravel.com/docs/9.x/localization