Skip to content
Advertisement

TCGVoyager doesn’t get translation on relationship

I use Voyager admin interface (v.1.4) for Laravel (v8.0). Voyager supports multiple languages (official documentation: https://voyager-docs.devdojo.com/v/1.4-1/core-concepts/multilanguage).

I have this relationship:

  • Process belongsToMany WorkMachine
  • Process hasMany Product

Process model:

JavaScript

WorkMachine model:

JavaScript

Product model:

JavaScript

In my controller:

JavaScript

The problem is: the Process translatable text works, the output language depends from app()->getLocale(). But the workmachine texts and products texts aren’t translated.

I try also to use:

JavaScript

But it isn’t translated.

Any solutions to translate the relationship?

Advertisement

Answer

I have found a possible solution! In my .blade file, instead of:

JavaScript

I added ->translate(app()->getLocale()):

JavaScript

This works!

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement