1770 Posts in 495 Topics by 531 members
Blog Module
SilverStripe Forums » Blog Module » [SOLVED] Multilanguage blog
Discuss the Blog Module.
Moderators: martimiz, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w
|
Page:
1
|
Go to End | |
| Author | Topic: | 252 Views |
-
[SOLVED] Multilanguage blog

20 March 2013 at 11:35pm Last edited: 5 April 2013 9:03pm
Hi all! Hope someone can help me.
I've installed a SS 3.0.5, the translatable module, the blog module and follow this post http://www.ssbits.com/tutorials/2011/using-translatable-to-create-a-simple-multilingual-site/#PageComment_2460. Everything seems to work fine but the template blog that doesn't change the language ("posted by...", "Read the full post", the date format, etc).I read a lot of posts but I am too dummy to solve the problem.
Can someone help me?In my my site/_config.php I've set:
i18n::set_locale('de_DE');
Translatable::set_default_locale('de_DE');
Translatable::set_allowed_locales(array('de_DE', 'it_IT', 'en_US'));
// Important: Call add_extension() after setting the default locale
Object::add_extension('SiteTree', 'Translatable');
Object::add_extension('SiteConfig', 'Translatable');But still the template doesn't change when I switch to another language.
Any idea?
Thanks in advance.
Pier -
Re: [SOLVED] Multilanguage blog

24 March 2013 at 1:49am Last edited: 24 March 2013 1:50am
Make "lang" folder under mysite
and make the locale file like de_DE.php in it
and add to that files lines like so:
<?php
global $lang;
$lang['de_DE']['BlogTree.ss']['VIEWINGPOSTEDIN'] = 'the translation for: Viewing entries posted in';
$lang['de_DE']['otherblogtemplate.ss']['SOMEODTHERTRANSLATEBLELINE'] = 'Some other translation for the line';?>
Also add this lines to your mysite/code/Page.php
if($this->dataRecord->hasExtension('Translatable')) {
i18n::set_locale($this->dataRecord->Locale);
}
}-----------------------------------------------------------------------------------------------------------------------
Arvixe Web Hosting / SilverStripe Community Liaison | Looking for quality SilverStripe Web Hosting? Look no further than Arvixe Web Hosting! -
Re: [SOLVED] Multilanguage blog

5 April 2013 at 6:31am Last edited: 5 April 2013 9:03pm
Hi Webdoc,
many thanks for your reply.I tryed to copy the lang folder of the blog module (where inside there is also a de_DE.php file) in mysite folder.
But when I've added the code you told me to the Page.php file, a blank page is shown.
-
Re: [SOLVED] Multilanguage blog

5 April 2013 at 8:58pm Last edited: 5 April 2013 9:02pm
I solved the problem of the blog translation.
In the lang folder it was missing the YAML file I fond at https://github.com/silverstripe/silverstripe-blog.
In fact, "by default, SilverStripe 3.x uses a YAML format" (http://doc.silverstripe.org/framework/en/topics/i18n).So:
1.
In my my site/_config.php I've set:i18n::set_locale('de_DE');
Translatable::set_default_locale('de_DE');
Translatable::set_allowed_locales(array('de_DE', 'it_IT', 'en_US'));
// Important: Call add_extension() after setting the default locale
Object::add_extension('SiteTree', 'Translatable');
Object::add_extension('SiteConfig', 'Translatable');2.
I added the following to my Page_Controller's init() function:if($this->dataRecord->hasExtension('Translatable')) {
i18n::set_locale($this->dataRecord->Locale);
}3.
I copied the de.yml file to the lang folder of the blog module.
| 252 Views | ||
|
Page:
1
|
Go to Top |


