multilanguage site and date notations

Permalink
I've tried several things i found on this forum to get my dates displayed in the right format for a multilingual site.

There are 3 languages, using the free internationalization addon. So a language is set on every page.

I have blogpages in 3 languages on which i have a datestamp and in the sidebar a date navigation.

My dashboard language is dutch, the 3 used page languages are dutch, english and german.

Now on every page my monthnames are displayed in dutch, but i want them displayed in german for the german section and in english for the english section.

Can someone please help me how to get this working, i'm getting very frustrated with this problem.

thanks!

buurvrouw
 
PatrickHeck replied on at Permalink Reply
PatrickHeck
Hi buurrouw,

can you post the code that you use to output the dates? Or is it a regular page-list block?

Best
Patrick
buurvrouw replied on at Permalink Reply
buurvrouw
Hi Patrick,

I'm using the blog_index_thumbnail.php for the pagelist template
I've added this:
$dh = Loader::helper('date'); // added for language support


And then changed this line:
$date = $cobj->getCollectionDatePublic('j-n-Y');


To this line:
$date = $dh->date(DATE_APP_GENERIC_MDY_FULL, strtotime($page->getCollectionDatePublic()));


But i keep getting the dutch date on german and english pages too. The same thing for the date_nav block.

I'm using the Internationalization add-on to have my language sections.
Am I missing something in my code or do i need additional files or something?

I appreciate your help getting this to work!
buurvrouw replied on at Permalink Reply
buurvrouw
Found it!

I've added this to my header-file:

<?php 
$lh = Loader::helper('section', 'multilingual'); //load the Language Helper
$lang = MultilingualSection::getCurrentSection()->getLanguage(); //get page language
//Check for Languages and set locale 
$loc = Localization::getInstance();
if($lh->getLanguage() == "de_DE")
   { $loc->setlocale ('de_DE'); }
else if($lh->getLanguage() == "en_GB")
   { $loc->setlocale ('en_US'); }
else if($lh->getLanguage() == "nl_NL")
   { $loc->setlocale ('nl_NL'); }
?>


All dates get translated now :-)
I guess the internationalization addon doesn't include the setlocale?