Voyager: There is no option in setting (fields) to change language!

Created on 15 Sep 2020  路  12Comments  路  Source: the-control-group/voyager

Version information

  • Laravel: v6.2
  • Voyager: v1.3
  • PHP: 7.3.5
  • Database: MySQL 5.7.26

Description:

My voyager admin panel is working in multiple languages. The issue I am facing in Setting Fields, adding new fields but unable to figure how to change the language like bread CRUD does. Please help, if it is possible bug or I'm doing something wrong?

Additional context

These are fields, need in different languages as well.

image

feature

All 12 comments

If I'm not mistaken at the moment settings fields is not translatable.

If I'm not mistaken at the moment settings fields is not translatable.

I think so, is there any other option to achieve this thing?

@fletch3555 please assist on this possible feature?

@emptynick

I think so, is there any other option to achieve this thing?

I've been searching for option too, but didn't find anything. By the way, there's same issue closed #2545

Please don't randomly tag people.
Also, as you already found out, this is currently not possible.

Settings is currently not translatable, PR are welcome.
If you want to find and discuss other way to do it you can join Voyager Slack group.

Settings is currently not translatable, PR are welcome.
If you want to find and discuss other way to do it you can join Voyager Slack group.

Thanks @MrCrayon for confirmation.

Hello, I'm pretty new on Laravel, but I'm falling in love with Voyager.
Why not create something similar to this library?
https://github.com/joedixon/laravel-translation

Voyager work well with translation of models, but it will be beautiful if we can edit translation files from backend, or import that files in database and use an Helper class to get it (like the __ or @lang).

Maybe you can fit your needs at the moment by

<button>{{__(setting('banner-1.button_text'))}}</button>

and translate your words in resources/Lang/your-language.json

@ousid thanks for your input! (thoughtful)
But, I'm little confused over it, if we do as you suggested then in back-end settings we have to save {lang-key} and store its value as hard code in lang file which is not I'm looking for. I wanted it dynamic.
I have resolved this issue by creating new bread for Banners (achieved my goal).

Hi,

Translation should cover this part because it makes the all feature useless if you can not present the option of a dropdown or a checkbox translated.

In the case of the checkbox, the solutions looks easy to implement
In the checkbox.blade.php file, if we had
@if(isset($options->on) && isset($options->off)) <input type="checkbox" name="{{ $row->field }}" class="{{ $class }}" data-on="{{ __('voyager::formFieldsOptions.' . $options->on) }}" {!! $checked ? 'checked="checked"' : '' !!} data-off="{{ __('voyager::formFieldsOptions.' . $options->off) }}">

Adding a formFieldsOptions.php file in the translations directories with
<?php return [ 'yes' => 'Oui', 'no' => 'Non', ];
you can now set the option with
{ "on": "yes", "off": "no", "checked": true }

This is what i will do but it means override the checkbox.blade.php .
Translation is so important in some projects, i hope Voyager Team will consider it for next release

Was this page helpful?
0 / 5 - 0 ratings