Date Helper and Japanese date format

Permalink
Hi

as per the docs athttp://documentation.concrete5.org/developers/concepts/localization...

I'm using a date helper

$dateHelper = \Core::make('helper/date');

to localize the I want to display to the user's settings (or the default web site language/locale, which is Japanese in this case):

$datePublic = $dateHelper->formatDate($page->getCollectionDatePublic(), true);

I was expecting it to display the date as per

https://en.wikipedia.org/wiki/Date_and_time_notation_in_Japan...

and

https://en.wikipedia.org/wiki/Date_format_by_country...

e.g. 2008年12月31日

but I'm getting

2008/12/31

Has anyone else seen this? I'm guessing this is in the zendframework\zend-i18n code...

Any help or comments gratefully received.

b3rimbau
View Replies:
katz515 replied on at Permalink Reply
katz515
What version are you using?
b3rimbau replied on at Permalink Reply
b3rimbau
sorry: 5.7.5.7
katz515 replied on at Permalink Reply
katz515
First of all, are you talking about Japanese Imperial calendar?
If so, we don't have that support for Japanese Imperial calendar.
Simply because It's a lot of work and we need help to implement it.
(If you could give us a hand to contribute, we're welcome)


Second, if you are only talking about converting from

Wednesday, July 20th, 2016
to
2016年7月20日 (水)

Also, as I was doing the translation for Japanese.

We may not properly set they way that it would display multilingual way for any locale in concrete5 at the moment.

You may have to manually set by yourself.
But it would be very easy once you implemented onto your theme, override blocks or custom templates in application folder.

Then add the translation string as date.
Then you can translate for each locale from concrete5 dashboard.

But anyway...
I will check in with other translation team.

Thanks
b3rimbau replied on at Permalink Reply
b3rimbau
Hi katz515

I don't mean the Japanese Imperial calendar (I've just learnt something new!
https://en.wikipedia.org/wiki/Japanese_imperial_year)....

Your second example is right:

Wednesday, July 20th, 2016
to
2016年7月20日 (水)

I really need to do it using the Date Helper otherwise my blocks and templates won't work on a multilingual site; I'd have Japanese dates showing on, say, EN_GB pages. This is what I had previously done before reading the C5 documentation:

$datePublic = $c->getCollectionDatePublicObject()->format('Y年m月d日');

Thanks for replying to my question. I am interested in the thoughts of your translation team. I'm wondering whether the 'fault' lies with Zend.
katz515 replied on at Permalink Reply
katz515
I understand.

This is quick and dirty fix

I assume all of your code is under /application/blocks/ and /application/themes/

When you do

$datePublic = $c->getCollectionDatePublicObject()->format('Y年m月d日');


Try:

$datePublic = $c->getCollectionDatePublicObject()->format(t('F j, Y'));


Then set up your concrete5 language interface, when you edit Japanese, you could enter the Japanese translation to be

'Y年m月d日'

Do the same for the rest of the language.

Thanks.