Translate checkboxes, select, … for end-users

Hi guys,

Right after my first issue posted on this forum, here is my first question : Is it possible to translate the values of my select fields into different languages to be displayed on my website ?

If i’m correct, the following code only translates the PANEL options :

label: check
type: checkboxes
    en: this is an option
    fr: voici une option
    en: another one
    fr: une autre

What I want is to translate for the end user so when he sets the website in /en/ he reads “this is an option” and when he switches in /fr/ he sees “voici une option”

It’s been a while now that I’ve been looking for answers. The closest I got is this sentence from @texnixe :

Note that this will not add a translation to the file, you can, however, translate the options in your language files.

I bet there is a simple solution… I apologies If I missed something obvious.

Thanks in advance for your help guys !

You mean when outputting the options in the frontend? Your best bet is a sort of category map as described here.

If I understand you correctly, what you want to look into is language variables.

It basically allows you to use variables in your template file that will change the content based on the selected language.

So in /site/languages/en.php you can do something like this:

l::set('submit', 'Submit');
l::set('cancel', 'Cancel');

and then in your template file you use it like this:

<button><?= l::get('submit') ?></button>

From what I saw Texnixe, your answer is the solution.

I was pretty sure it was something like that. I’ll try this ASAP
Thanks Targoran for your answer too :wink:

Cheers guys

@Targoran is right, you can use language variables for that, it comes to the same.

There’s also the awesome Architect plugin by @AugustMiller which let you access blueprint data. You may want to have a look at the field options section on Github.

1 Like