Forums

Months and days in german language

typomaniac 06 Sep, 2022
Hi all,
fetching the UNIX date and showing it as readable date works so far. But: how do I display the months/days names in german? I couldn't find any hint in the variables shortcode reference.
Seems like I'm not the first to ask this. But ... so far, I couldn't find any answer in the forum.

Martin
Colnem 06 Sep, 2022
Hi

In calendar Element, you can use Advanced settings/Translation/German.
In other case, use a PHP Element to translate.
typomaniac 06 Sep, 2022
Hi Colnem,

thanks so far. But ... I don't really know what you mean. Sorry.
It's not about a calendar, but a call of DB entries of JEvents.
What PHP element?

Martin
Colnem 06 Sep, 2022
This is Chronoforms 7 forum, not JEvents Forum!
typomaniac 06 Sep, 2022
Sure this is for Chronforms 🙂

This is not a JEvents related issue. If you look here, you see how flawlessly one can use DB entries for (e.g.) JEvents in Chronoforms:
https://pdh.ch/index.php/de/agenda

And here, a slightly modified version in development also works fine:
https://dev3.marscom.ch/index.php/uebungen/abmeldungen

My only question is: how do I change the months and day names from english into german? The dates are - with CF {var: ...} converted from an UNIX timestamp. But I can't find out where and how to translate them.

Martin
Colnem 07 Sep, 2022
OK

In your case, you have to use PHP Element (in Action) or HTML Element using PHP (in Views) to translate months.

May be, using PHP function set_locale(). But I didn't try. Consult PHP Manual.
typomaniac 07 Sep, 2022
Answer
Thanks,
but unfortunately, this has no effect (tried both options).
Colnem 07 Sep, 2022
What is you PHP code?
typomaniac 07 Sep, 2022
Currently, this:
$current_day = JFactory::getDate('+0 seconds');
$current_day = $current_day->toUnix();
$options = array();
$db =& JFactory::getDBO();
$query = "
SELECT
#__jevents_vevdetail.dtstart,
#__jevents_vevdetail.summary,
#__jevents_vevdetail.extra_info
FROM #__jevents_vevdetail
INNER JOIN #__jevents_vevent ON #__jevents_vevdetail.evdet_id = #__jevents_vevent.detail_id
WHERE
#__jevents_vevdetail.dtstart > " . $current_day ." AND
#__jevents_vevent.access = 1 AND
#__jevents_vevent.state >= 1
order by #__jevents_vevdetail.dtstart;
";
$db->setQuery($query);
return $db->loadAssocList();
foreach ( $data as $d )
{
$options[] = "<option value='{$d->summary}'>{$d->summary}</option>";
}
Now I tried and tried with setlocale in different ways and as separate PHP before and after this action, as PHP in the pages view, but no change. The language won't change. I used "de-DE", "de_DE", "German_Standard" ... and so on.
Colnem 08 Sep, 2022
Sorry, but I can't help you. Is too hard for me.
You need to login to be able to post a reply.