I built a "month bar" for WordpRess tribe-events plugin. The bar shows the names of the next 12 months with links to the archive pages. I had some problems with month having less than 31/31 dayse but I could fix this with some help from the community here. My problem: the months I get back are in Englsich and I cant find a way to translate those month-names to German
I tried:
setlocale(LC_TIME, 'german', 'deu_deu', 'deu', 'de_DE', 'de');
And the whole thing:
setlocale(LC_TIME, 'german', 'deu_deu', 'deu', 'de_DE', 'de');
$currentmonth = date_i18n('M'); //localization
date_i18n $todaysmonth = date_i18n('n', strtotime('now')); $todaysMonth = date_i18n('M', strtotime('now'));
echo "<ul id='my-month-bar'>";
for($i = $todaysmonth; $i <= $todaysmonth+11; $i++)
{
$dateObj = DateTime::createFromFormat( 'm', $i );
$monthName = $dateObj->format('M'); //Ausgabe der Monate in Listew
$my_date = $dateObj->format('Y-m-01'); //Datum fuer URL
$current_ym = date_i18n('Y-m',strtotime("+$i months"));
$m = date_i18n('M',strtotime("+$i months")); //localization date_i18n
//$title = date_i18n('Y-m' . "-01",strtotime("+$i months"));
$title = $my_date;
$y = date_i18n('Y',strtotime("+$i months"));
//echo "<a href='$url&tribe_bar_date=$title'>$m</a>";
$query = $url;
$bar_date = get_query_var('tribe-bar-date');
$new_query = add_query_arg( array(
'tribe-bar-date' => $title,
), $query );
if ( $bar_date == $my_date ){
echo "<li><a title='Veranstaltungen im $monthName' rel='nofollow' id='my-monthbar-act' href='$new_query'> $monthName </a></li>"; //if is current month
}else{
echo "<li><a title='Veranstaltungen im $monthName' rel='nofollow' id='my-monthbar' href='$new_query'> $monthName </a></li>";
}}
echo "</ul>";
?></div>
What I get: SEP OCT NOV DEC JAN FEB MAR APR MAY JUN JUL AUG
What I want: SEP OKT NOV DEZ...