Problems, need help? Have a tip or advice? Post it here.
6 posts Page 1 of 1

I am trying to show a date in French format instead of English, but all I'm getting is English.

Here's my line of code :
Code: Select all
<cms:date dateFormat format='%d %B %Y' locale='fr_FR.UTF-8' />

I also tried:
Code: Select all
<cms:date dateFormat format='%d %B %Y' locale='fr_FR' />
<cms:date dateFormat format='%d %B %Y' locale='french' />

And nothing is working.
I've read stuff about a server-side localization or something like that. But the weird thing is that I have another website using couch on the same server, using the "<cms:date dateFormat format='%d %B %Y' locale='fr_FR.UTF-8' />" line and it's working fine.

So not sure what is going on here.
Is there a place in the config file where I need to add the language?


Greetings of the day!

The first thing that I find unusual is that, in your code:
Code: Select all
<cms:date dateFormat format='%d %B %Y' locale='fr_FR.UTF-8' />

You have an editable region dateFormat. I created the same at my end as:
Code: Select all
<cms:editable name="dateFormat" label="Format" type="datetime" />

and got an error (as expected).
ERROR: Tag "editable": 'name' attribute (dateFormat) contains invalid characters. (Only lowercase[a-z], numerals[0-9], hyphen and underscore permitted.)

I feel that the editable region should not work at all as per the value accepted by the name attribute for editable tag.

So I redefined the editable region as dateformat as:
Code: Select all
<cms:editable name="dateformat" label="Format" type="datetime" default_time='@current' />

and it works as expected.

Now going further I did the following tests:
Code: Select all
<cms:date dateformat />
<cms:date dateformat format='Y-m-d H:i' />
<cms:date dateformat format='%d %B %Y' />
<cms:date dateformat format='%d %B %Y' locale='french' /> <!-- locale aware -->
<cms:date dateformat format='%d %B %Y' locale='french' charset='ISO-8859-1' /> <!-- charset aware -->
<cms:date dateformat format='%d %B %Y' locale='fr_FR.UTF-8' /> <!-- Your Code -->

And got the results as:
September 23, 2022
2022-09-23 23:35
23 September 2022
23 septembre 2022 <!-- locale aware -->
23 septembre 2022 <!-- charset aware -->
23 septembre 2022 <!-- Your Code -->

And all output are working perfectly fine.

I will request you to once check your editable region name. Then check if the <cms:date> tag has the same editable name. If all is set correctly it should work.

In case the issue persists, it can be a caching issue. You could clear the cache and give it another try.

GXCPL (Priya)
where innovation meets technology
Thanks for taking the time to answer my question. I will test it out.

But what about if I want to use "k_page_date"?

When I do this:
Code: Select all
<cms:date k_page_date format='%e %B %Y' locale='fr_FR.UTF-8' />

It still doesn't work.

I'm pretty confident that this should work too.
I have another website where this exact line works.

That's why I'm confused.

Thanks again!
Any ideas? Thanks!
Thanks for taking the time to answer my question. I will test it out.

Please test it out, so that we can understand in the first place if the issue is sorted. If it does work, please try again with the page publishing date (k_page_date).

Post back with more details, so that the issue can be replicated and problem can be seen in new light.

where innovation meets technology

Primarily, as mentioned in the docs, this issue arises when the 'locale' in question is not available on the server.

However, you mentioned that you have another site on the same server and it does not display this problem.
To find out any differences between the two sites, could you please run "phpinfo();" on each and PM me the resulting outputs?

6 posts Page 1 of 1