Ad

Is There A Way To Translate The Title In The Configuration Section Of An Octobercms Page

I installed rainlab translation plugin and it's working well for the twigg translation with

{{ "text to translate"|_ }}

Also, I know we can easily create lang folder in plugins and us it this way:

'name' => 'Traductions', 

I also translated my url this way in my page configuration:

[viewBag]
localeUrl[en] = "/clinics/slug"

But is it possible to do something similar for titles? I need to translate the page title in the php / configuration section of the page.

Thank you

Ad

Answer

I guess you can utilize code section

and put this code

url = "/blog"
layout = "default"
==
<?
function onEnd() {
    $this->page->title = <<Your Translated Title>>;
} 
?>
==
<h3>Html Here</h3>

(assuming you are using rainlab translate plugin)To translate messages you can use

use RainLab\Translate\Models\Message;

then

$this->page->title = Message::trans($string, $params);

I hope this will help you.

Ad
source: stackoverflow.com
Ad