Vincent
Vincent

Reputation: 202

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

Upvotes: 0

Views: 1280

Answers (2)

felixmpa
felixmpa

Reputation: 2128

If you do it properly with the right tools, developing a translatable website won't take much longer with October's Plugin.

With translate plugin the languague can be especified as part of the URL and you will be able to use Twig filter with less effort.

Check this: http://octobercms.com/blog/post/building-responsive-multi-language-website-blog-and-static-pages

Upvotes: 0

Hardik Satasiya
Hardik Satasiya

Reputation: 9715

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.

Upvotes: 1

Related Questions