My Drupal 7 site is in English and Japanese, I've got translations working perfectly except for one thing. The custom date formats I've tried aren't translating properly.
A Japanese date is written 30日4月2011年 with characters for 'day', 'month' and 'year'. But if I try to add these characters manually to a custom date format (using php date string "d日 j月 Y年") the characters repeat like this: "30日4月2011年 日月年" which makes it unusable.
I've found that if I write the date "30 April 2011" (d F Y) it will show up as "30 4月 2011" because drupals translation automatically translates any long month name to the correct japanese format. I've tried making sense of "Translate interface" (admin/config/regional/translate/translate) searching for "!datetime" such as suggested here: http://drupal.org/node/708650 but it's only made me more confused.
Please, if you know, how do I properly display the japanese character for 'day' and 'year'?
Thanks.
Comments
Japanese date
I'm posting a comment as I, too, would like to see an answer.
Incidentally, where have you ever seen a date in Japanese format given as "30日4月2011年" ? Dates in Japanese (and, I'm pretty sure, Chinese and Korean) are almost universally written as 2011年4月30日, the reverse of your order. (Of course, your site can write dates however you like, but I found that curious.)
Oops, that's true Drupalace,
Oops, that's true Drupalace, you're right. I of course got the order wrong, I meant 2011年4月30日. In any way, I'm glad to not be the only one with this question, it's driving me nuts.
Hello Guys, Im located in
Hello Guys, Im located in Tokyo and I have had the same problem forever. We should be able to use the custom date format, but like Jens has stated It comes out with the extra characters "日月年" appended. Fromt my loooooong research on this I have come to think that this is because of the $time format thats normally printed after date, Im nt sure if its a bug or what. I have seen others take extreme measures by using a template override to drop the time output and that has worked for them,but I dont want to remove time for "all" of my dates so not sure if its a good fix. Not even sure if e could just drop it in the template override and then use the custom format whenever we would need the time as well. just passing on the info I have gathered on this and hoping someone posts a fix or workaround.
Hi cocoshogo, thank you for
Hi cocoshogo, thank you for the info.
I'm actually considering to take extreme measures at this point, and I don't mind to remove time for all dates. Have you used this solution yourself? Could you possibly post more details on how to drop the $time with a template override? I wish there was a simpler way though.
Thanks, Jens
Temporary Solution
I spent quite a bit of time poking around for a solution as well, only to find others with the same problem (http://drupal.org/node/1317018). While not ideal, I've implemented the following temporary solution to strip out unwanted characters:
substr_replace($fields['field_post_date']->content, "", strrpos($fields['field_post_date']->content, " 日月年"), strlen(" 日月年"))Another Temporary Solution
I also ran into this problem. After digging into the code, for some reason, those 3 extra characters are being passed to the theme function as the timezone. I don't know if its a bug or what so I just had to override theme_date_display_single(). If you don't need to display the timezone, then you should be fine by just taking timezone out.
You can find this in date/date/date.theme
I was pointed to this thread
I was pointed to this thread from...
cckのdateフィールドで入力した日付データをviewsで出力した際のフォーマットについて。
http://groups.drupal.org/node/234948
...where I posted my low-tech solution to this problem, which you can see here:
http://groups.drupal.org/node/234948#comment-796323
The above works for me, but I would like to try to the (temporary) solution that you posted. However, it is not clear to me where this php code should be added to. Can you be more specific?
Thank you!
Use '\' in your format. Worked for me
I was having a similar problem and changed my format from Y年n月j日to Y\年n\月j\日
The result changed from 2012年5月10日 年月日 to 2012年5月10日
I tried this because I stumbled on:
#1360672: Formatted "timezone" has wrong value when using Korean characters
Thank you. Adding the '\' and
Thank you. Adding the '\' and then resetting the selected date format solved the problem for me.
Thanks a lot
I was madly searching it and finally found this solution.
どうもありがとうございました!!!