Stichoza/google-translate-php

How can I use it in Blade

Closed this issue · 4 comments

Please tell me how to use this in blade views?

This is not a Laravel package, it's framework agnostic.

But you can create your own facades or Blade directives if you want, something like @translate() and it could use the methods of this package.

So, this won't work?

{{ GoogleTranslate::trans('{{ $items->name }}', app()->getLocale()) }}

@iamB0rgy You shouldn't pass parameter in blade curly braces, do this instead:

{{ GoogleTranslate::trans($items->name, app()->getLocale()) }}

Thank you. It worked!