1

I'm using Laravel localization. - https://laravel.com/docs/5.6/localization I also use react component in the blade view. Now i wish to use localization in my react component like this

return(
    <button className="btn">
      {{ __('messages.welcome') }}
    </button>
)

enter image description here

How can I make the react component call the translation?

2 Answers 2

1

you can use normal js package for that like this package laravel-js-localization

Sign up to request clarification or add additional context in comments.

Comments

0

This sign {{ ]} is just for PHP. "means echo", you can not do that. You'd better use Vue.js to do it. There's two way to use translation: first: put all translation in div attributes second: use JSON API Regards

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.