Page 1 of 1
Calendar problems: template - language
Posted: Mon Apr 21, 2008 7:11 pm
by tannos
Hi,
I had installed the calendar module and tried to include it in my site: no problem
I use this code:
Code: Select all
{cms_module module='Calendar' table_id='big' lang="fr_FR" detailpage='event-detail' inline='0'}
In the settings tab, I set language option on fr_FR (for french)
In my page, dates are in french (abbreviated weekday name ) that is what I want.
In an other page, for viewing the details of my news I met some problems:
1) When I use "%A" in my event template the weekday are in english: I got Monday instead of Lundi. If I try %a for short name, it's the same thing.
How can I fix it?
2)I want to display the category of my news but I don't find the variable name to use.
I tried something like $category; $categories but none of them doesn't match
In an other page for the upcoming events I met similar problems:
3a)Impossible to obtain the french weekday names
3b)Furthemore, when I tried "%b" for abbreviated month name, each news are displaying with 'APR' for april (even though I had new in may, june..)
Somebody can help me, please?
Thank
ps: excuse my english
Re: Calendar problems: template - language
Posted: Tue Apr 22, 2008 9:47 pm
by bbiederm
I have the same problem as in 1)
any help

Re: Calendar problems: template - language
Posted: Tue Apr 29, 2008 9:12 pm
by tannos
Up.
Somebody can help?
Please
Re: Calendar problems: template - language
Posted: Fri May 29, 2009 7:38 am
by Guigui
You can try this format date :
%d %m %Y (exp: 29 05 2009)
Or chose "Blog Post detail template" in "Event Template", this is working for me language is french...
Re: Calendar problems: template - language
Posted: Fri May 29, 2009 7:47 am
by Jeff
if you want help you need to post more information. For example the OP post the module call that he used that was working but none of the ones that didn't, so how do we know what he was doing wrong.
Re: Calendar problems: template - language
Posted: Fri May 29, 2009 1:08 pm
by bbiederm
OK here is my code, I still have the problem, that the weekdays are in english and not in German. Module language is set to german, months are outputed in german, too.
Code: Select all
<div class="calendar-date-from3"><span class="calendar-date-title">{$lang.date}: </span>{$event.event_date_start|date_format:"%A"}, {$event.event_date_start|date_format:"%e"}. {$month_names[$month_number]} {$event.event_date_start|date_format:"%Y"} {$lang.to} {$event.event_date_end|date_format:"%A"}, {$event.event_date_end|date_format:"%d"}. {$month_names[$end_month_number]} {$event.event_date_end|date_format:"%Y"}</div>
It would be great to get an answer
Thanks bbiederm
Re: Calendar problems: template - language
Posted: Fri May 29, 2009 5:22 pm
by Jeff
Need more information!!!!
posting the ENTIRE template not just one line and the output (not just one line) would help.
Also post the results to {get_template_vars}
Re: Calendar problems: template - language
Posted: Fri May 29, 2009 6:54 pm
by bbiederm
OK,
this is {get_template_vars}
Code: Select all
SCRIPT_NAME = /index.php
app_name = CMS
sitename = Elsa-Brändström-Realschule
lang = Array
encoding = UTF-8
gCms = Object
content_id = 70
page = termine-2
page_id = termine-2
page_name = termine-2
page_alias = termine-2
position = 00004
friendly_position = 4
count = 31
nodelist = Array
node = Object
month_names = Array
day_names = Array
day_short_names = Array
table_id = termine
events = Array
day = -1
month = 5
year = 2009
summaries = 1
detail = 0
return_url =
compact_view = 0
moretext = mehr >>
pastitems = 0
event = Array
key = 0
here is the template
Code: Select all
<div class="calendar-upcominglist" id="{$table_id}">
{foreach from=$events key=key item=event}
<div class="calendar-event">
{assign var=month_number value=$event.event_date_start|date_format:"%m"}
{assign var=end_month_number value=$event.event_date_end|date_format:"%m"}
{if $event.event_date_end == "" and $event.event_date_start|date_format:"%H:%M" == "00:00"}
<div class="calendar-date-from"><span class="calendar-date-title">{$lang.date}: </span>{$event.event_date_start|date_format:"%A"}, {$event.event_date_start|date_format:"%e"}. {$month_names[$month_number]} {$event.event_date_start|date_format:"%Y"}</div>
{else}
{if $event.event_date_start == $event.event_date_end || $event.event_date_end == ""}
<div class="calendar-date-from1"><span class="calendar-date-title">{$lang.date}: </span>{$event.event_date_start|date_format:"%A"}, {$event.event_date_start|date_format:"%e"}. {$month_names[$month_number]} {$event.event_date_start|date_format:"%Y %H:%M"}</div>
{else}
{if $event.event_date_start|date_format:"%d%m%Y" == $event.event_date_end|date_format:"%d%m%Y"}
<div class="calendar-date-from2"><span class="calendar-date-title">{$lang.date}: </span>{$event.event_date_start|date_format:"%A"}, {$event.event_date_start|date_format:"%e"}. {$month_names[$month_number]} {$event.event_date_start|date_format:"%Y %H:%M"} {$lang.to} {$event.event_date_end|date_format:"%H:%M"}</div>
{else}
<div class="calendar-date-from3"><span class="calendar-date-title">{$lang.date}: </span>{$event.event_date_start|date_format:"%A"}, {$event.event_date_start|date_format:"%e"}. {$month_names[$month_number]} {$event.event_date_start|date_format:"%Y"} {$lang.to} {$event.event_date_end|date_format:"%A"}, {$event.event_date_end|date_format:"%d"}. {$month_names[$end_month_number]} {$event.event_date_end|date_format:"%Y"}</div>
{/if}
{/if}
{/if}
{if $event.event_summary !="" && ($detail != 1 || ($event.event_details =="" || $event.event_details == "<br />"))}
<div class="calendar-summary"><span class="calendar-summary-title">{$lang.summary}: </span>{$event.event_summary}</div>
{/if}
<div class="calendar-event-details">{$event.event_title}<br />
{if $detail == 1}
{if $event.event_details !="" && $event.event_details != "<br />"}
<div class="calendar-details"><span class="calendar-details-title">{$lang.details}: </span>{$event.event_details}</div>
{/if}
{else}
<!-- <a href="{$event.url}">{$moretext}</a>-->
{/if}
<br />
</div>
</div>
{/foreach}
{if $return_url != ""}
<div class="calendar-returnlink">{$return_url}</div>
{/if}
</div>
and here the html-output form the template
Code: Select all
<div id="content">
<p><div class="calendar-upcominglist" id="termine">
<div class="calendar-event">
<div class="calendar-date-from3"><span class="calendar-date-title">Datum: </span>Saturday, 30. Mai 2009 bis Tuesday, 02. Juni 2009</div>
<div class="calendar-event-details">Pfingstferien<br />
<!-- <a href="http://www.ebs-realschule.de/admin/index.php?mact=Calendar,cntnt01,default,0&cntnt01event_id=66&cntnt01display=event&cntnt01lang=de_DE&cntnt01detailpage=&cntnt01return_id=70&cntnt01returnid=-1">mehr >></a>-->
<br />
</div>
</div>
<div class="calendar-event">
<div class="calendar-date-from"><span class="calendar-date-title">Datum: </span>Wednesday, 10. Juni 2009</div>
<div class="calendar-event-details">Ausflug der Schulgemeinschaft mit dem Schiff<br />
<!-- <a href="http://www.ebs-realschule.de/admin/index.php?mact=Calendar,cntnt01,default,0&cntnt01event_id=67&cntnt01display=event&cntnt01lang=de_DE&cntnt01detailpage=&cntnt01return_id=70&cntnt01returnid=-1">mehr >></a>-->
<br />
</div>
</div>
<div class="calendar-event">
<div class="calendar-date-from"><span class="calendar-date-title">Datum: </span>Thursday, 11. Juni 2009</div>
<div class="calendar-event-details">Fronleichnam<br />
<!-- <a href="http://www.ebs-realschule.de/admin/index.php?mact=Calendar,cntnt01,default,0&cntnt01event_id=68&cntnt01display=event&cntnt01lang=de_DE&cntnt01detailpage=&cntnt01return_id=70&cntnt01returnid=-1">mehr >></a>-->
<br />
</div>
</div>
<div class="calendar-event">
<div class="calendar-date-from"><span class="calendar-date-title">Datum: </span>Friday, 12. Juni 2009</div>
<div class="calendar-event-details">Unterricht<br />
<!-- <a href="http://www.ebs-realschule.de/admin/index.php?mact=Calendar,cntnt01,default,0&cntnt01event_id=69&cntnt01display=event&cntnt01lang=de_DE&cntnt01detailpage=&cntnt01return_id=70&cntnt01returnid=-1">mehr >></a>-->
<br />
</div>
</div>
<div class="calendar-event">
<div class="calendar-date-from1"><span class="calendar-date-title">Datum: </span>Friday, 19. Juni 2009 17:00</div>
<div class="calendar-event-details">Abschlussfeier Klassen 10<br />
<!-- <a href="http://www.ebs-realschule.de/admin/index.php?mact=Calendar,cntnt01,default,0&cntnt01event_id=70&cntnt01display=event&cntnt01lang=de_DE&cntnt01detailpage=&cntnt01return_id=70&cntnt01returnid=-1">mehr >></a>-->
<br />
</div>
</div>
<div class="calendar-event">
<div class="calendar-date-from1"><span class="calendar-date-title">Datum: </span>Friday, 26. Juni 2009 15:00</div>
<div class="calendar-event-details">Begrüßungsnachmittag neue Klassen 5<br />
<!-- <a href="http://www.ebs-realschule.de/admin/index.php?mact=Calendar,cntnt01,default,0&cntnt01event_id=71&cntnt01display=event&cntnt01lang=de_DE&cntnt01detailpage=&cntnt01return_id=70&cntnt01returnid=-1">mehr >></a>-->
<br />
</div>
</div>
<div class="calendar-event">
<div class="calendar-date-from"><span class="calendar-date-title">Datum: </span>Monday, 29. Juni 2009</div>
<div class="calendar-event-details">EBS-Cup Fußballturnier Klassen 5-8<br />
<!-- <a href="http://www.ebs-realschule.de/admin/index.php?mact=Calendar,cntnt01,default,0&cntnt01event_id=72&cntnt01display=event&cntnt01lang=de_DE&cntnt01detailpage=&cntnt01return_id=70&cntnt01returnid=-1">mehr >></a>-->
<br />
</div>
</div>
<div class="calendar-event">
<div class="calendar-date-from"><span class="calendar-date-title">Datum: </span>Tuesday, 30. Juni 2009</div>
<div class="calendar-event-details">Französisch-Rallye<br />
<!-- <a href="http://www.ebs-realschule.de/admin/index.php?mact=Calendar,cntnt01,default,0&cntnt01event_id=73&cntnt01display=event&cntnt01lang=de_DE&cntnt01detailpage=&cntnt01return_id=70&cntnt01returnid=-1">mehr >></a>-->
<br />
</div>
</div>
<div class="calendar-event">
<div class="calendar-date-from"><span class="calendar-date-title">Datum: </span>Wednesday, 1. Juli 2009</div>
<div class="calendar-event-details">1. Std. Unterricht nach Plan, 2. Std. Aula-Programm, 3. Std. Zeugnisausgabe<br />
<!-- <a href="http://www.ebs-realschule.de/admin/index.php?mact=Calendar,cntnt01,default,0&cntnt01event_id=74&cntnt01display=event&cntnt01lang=de_DE&cntnt01detailpage=&cntnt01return_id=70&cntnt01returnid=-1">mehr >></a>-->
<br />
</div>
</div>
</div></p>
</div>
and again Thanks!!
Re: Calendar problems: template - language
Posted: Sat May 30, 2009 11:47 pm
by Jeff
The problem is that date_format use the system lang settings and and not the parameter "lang". So it can't be used for anything that returns words like %A or %a.
Solution:
Add these lines at line 6:
Code: Select all
{assign var=day_number value=$event.event_date_start|date_format:"%w"}
{assign var=end_day_number value=$event.event_date_end|date_format:"%w"}
Then replace {$event.event_date_start|date_format:"%A"} with {$day_names[$day_number]}
and {$event.event_date_end|date_format:"%A"} with {$day_names[$end_day_number]}
Re: Calendar problems: template - language
Posted: Sun May 31, 2009 11:10 am
by bbiederm
Thanks alot, it is working !!!
Re: Calendar problems: template - language
Posted: Thu Jun 04, 2009 11:03 am
by bbiederm
Unfortunatly it is not working!
The daynames are wrong. Instead of showing wednesday it is showing thursday (in my native language of course)
to me, that means the day_number var is to high. What can I do?
Thanks again
Re: Calendar problems: template - language
Posted: Thu Jun 04, 2009 10:03 pm
by Jeff
That is because of the "first_day_of_week" setting in the calendar.
add the param first_day_of_week=0 to the call
Re: Calendar problems: template - language
Posted: Thu Jun 04, 2009 10:17 pm
by bbiederm
And where do i do that?
Sorry, but i can't find it!
Re: Calendar problems: template - language
Posted: Thu Jun 04, 2009 11:31 pm
by Jeff
something like
{cms_module module='CGCalendar' lang="fr_FR" display=upcominglist first_day_of_week=0}
Re: Calendar problems: template - language
Posted: Fri Jun 05, 2009 7:25 pm
by bbiederm
Again, thanks alot.
It had to be
Code: Select all
{cms_module module="Calendar" table_id="termine" lang="de_DE" display="upcominglist" first_day_of_week=-1}