Notice: A non well formed numeric value encountered in /var/www/clients/client3/web4/web/wp-content/plugins/crayon-syntax-highlighter/crayon_formatter.class.php on line 118

Notice: A non well formed numeric value encountered in /var/www/clients/client3/web4/web/wp-content/plugins/crayon-syntax-highlighter/crayon_formatter.class.php on line 119

Notice: A non well formed numeric value encountered in /var/www/clients/client3/web4/web/wp-content/plugins/crayon-syntax-highlighter/crayon_formatter.class.php on line 118

Notice: A non well formed numeric value encountered in /var/www/clients/client3/web4/web/wp-content/plugins/crayon-syntax-highlighter/crayon_formatter.class.php on line 119

Notice: A non well formed numeric value encountered in /var/www/clients/client3/web4/web/wp-content/plugins/crayon-syntax-highlighter/crayon_formatter.class.php on line 118

Notice: A non well formed numeric value encountered in /var/www/clients/client3/web4/web/wp-content/plugins/crayon-syntax-highlighter/crayon_formatter.class.php on line 119

Using Laravel localization with JavaScript and VueJS

Using Laravel localization with JavaScript and VueJS

We do know that Laravel has a wonderful localization support out of box which by default is located in resources/lang folder. We can use it in PHP calling helper function like  (or you can use also __ in newer versions). Laravel’s Blade template engine also has support of this helper:

or (newer versions)

So the code above would be rendered as:

Passing Laravel language strings to JavaScript

But what about JS? It has neither trans() nor __() functions by default (at least up to version 5.4). And it doesn’t even know anything about localization strings, which by the way could be organized as JSON objects in PHP (since L5.4).

more at: https://medium.com/@serhii.matrunchyk/using-laravel-localization-with-javascript-and-vuejs-23064d0c210e

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *