This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

gustavo.mixedmedia61486
gustavo.mixedmedia61486

Hi!

I'm using RainlabĀ“s Translate plugin but, as ir is indicated, variables should be written as:

{{ records.text1|_ }}
{{ city.country|_ }}
{{ name|_ }}

But no variable is shown in "Translate message" section. I also tried to include them in a YAML and, if actually they are now listed, the frontend does not reflect the translation, I'm I doing something wrong? I also tried changing PHP version, but still nothing.

Last updated

daftspunky
daftspunky

Since these language keys are dynamic. They will not appear until the page is rendered for the first time. If you view the page and try again, it should show up

gustavo.mixedmedia61486
gustavo.mixedmedia61486

Thanks for your response, I followed your directions but I get the exact same results, if I do this: {{ records.text1|_ }} it will return the rendered values (i.e. London, Belfast, Madrid), but it can not be replace for another variable -or record field in my case- (i.e. records.text1eng ); if I do this: {{ 'records.text1'|_ }} the variable wrapped in quotes becomes just static text.... Could you point me which other forum topics talk about it?

Regards.

Last updated

daftspunky
daftspunky

You may want to look at Model translation instead. Here is an example.

class Records extends Model
{
    public $implement = ['RainLab.Translate.Behaviors.TranslatableModel'];

    public $translatable = ['text1'];
}

This will make the text1 attribute translatable at the model level and you won't need to pass it through the |_ filter. Simply calling {{ records.text1 }} will be enough

I hope this helps!

1-4 of 4

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.