Problems, need help? Have a tip or advice? Post it here.
4 posts Page 1 of 1
Hello Couchies!

I just discovered, that I have a problem with the page I made earlier - with the output of editable region "datetime"

I have bilingual website, and two clonable templates….
en/calender.php and de/calender.php

At first, both had editable regions with identical names but moths were in german and english.
Code: Select all
<cms:editable 
            name='event_date'
            label='Date'
            desc='Enter date of the course.'
                  months='januar, februar, märz, april, mai, juni, juli, august, september, oktober, november, dezember'
            type='datetime'
                format='dmy'
                order= '2' />   


and english

Code: Select all
<cms:editable 
            name='event_date'
            label='Date'
            desc='Enter date of the course, workshop, concert, lecture etc.'
                  months='january, february, march, april, may, june, july, august, september, october, november, december'
            type='datetime' /> 


So I thought that is the reason, why I have all the time english months in the output

Code: Select all
<cms:date event_date format='d F Y' />


Then I changed name parameter for german template, adding _de…
so I have now

Code: Select all
name='event_date_de' 


and output

Code: Select all
<cms:date event_date_De format='d F Y' />


but I still have all the time only months in english in the german page-view, folder-vew etc…

Any idea what the problem is?

Thanks a lot in advance!

tanja
Hi Tanja :)

I suppose the two datetime regions *are* showing the months in their respective languages in the admin-panel, right? That is the actual purpose of the 'months' parameter - set how the months are displayed in the backend (and not the front-end).

Internally all dates in Couch are stored in yyyy-mm-dd h:m:s format. So if if you do
Code: Select all
<cms:show event_date />
<cms:show event_date_de />
both will return something like
Code: Select all
2014-11-18 00:00:00

Point is, it does not matter what language you use to define the months, internally all dates are stored in the same format.

The corollary to that is now on the front-end we can display *all* dates in whatever language is desired (German and English in your case).

That part is handled by the cms:date tag we use to format the dates.
Please see http://www.couchcms.com/docs/tags-reference/date.html
Scroll down a little till you reach Locale-aware format characters
Specifically see the format, locale and charset parameters.

Please let me know if you require any assistance.

Thanks.
hello Kamran!

Thank you for the explanation. I thought all the time that the parameter "month" will determine the display in the front end, so I was trying with conditions etc etc, but not looking further into cms:date ....

It works perfectly in the front end with the parameters you mentioned - locale, charset and format...

Thanks a lot!!!!!

best regards

Tanja
You are always welcome, Tanja :)
4 posts Page 1 of 1
cron