Page 1 of 1

Help with timestamp

Posted: Sat Aug 16, 2008 10:39 am
by Mangek
Hello everyone,

I'm pulling my hair over how to change the way the date is displayed before the title of the post. I'm using the Andreas08 theme and I dug my way into lang_eng.inc.php where I found this line:

Code: Select all

@define('DATE_FORMAT_ENTRY_ANDREAS', '%b %e:');
Looking at php.net I'm thinking it's not using standard php date(), because I can't for the life of me find b there (I'm guessing smarty has it's own dates defined with the %x, am i right? I tried changing %b to %a, %c etc and got various results).

I found that %m %e displays the day and month the way I want it, but I'd like it without the leading zeros. Is there a way for this?

And here comes the tricky part: I want to add japanese characters after the day and month (so to have it displayed as such: 08月 16日 (i hope the chars will show up).

Now, I tried adding it with notepad++, where the chars would display only as ? (guessing I have a setting wrong there). I instead tried with regular Notepad, and when I hit save, it prompted me to save as unicode (as I had the chars in there). Sure enough, I tried it, but when I uploaded the file and tested, instead of the date it spat out DATE_FORMAT_ENTRY_ANDREAS.

I'm stumped. :) Is it possible to do what I'm after? Any help is appreciated. :)

Edit: Again, I should really try all options before posting. I feel really stupid now.. *hides under carpet*

What I did was simply this: Notepadd++, in the meny format, select 'encode in UTF-8' and the chars would show. Saving and uploading, it displays how I want to.

Never mind me. :roll: :oops:

Posted: Thu Sep 04, 2008 10:26 am
by Rei
May i know when is the DATE_FORMAT_ENTRY in lang/serendipity_lang_xx.inc.php would be using?

I installed the multilingual plugin, and i would like the format for Chinese appear correctly as xxxxYearxxMonthxxDate (Dayxx). I changed the format in the lang/serendipity_lang_xx.inc.php but nothing happened.

I would like to change the format for English too so i edit the lang/serendipity_lang_en.inc.php also, but no effect.

I use "carl contest" template to check on the changes though.

I would not want to make the changes of the date format in the template because the date format for Chinese is quite different.

Posted: Thu Sep 04, 2008 11:38 am
by garvinhicking
Hi!

If you are using the UTF-8 charset, you need to change the language files in lang/UTF-8/serendipity_lang_XX.inc.php to make the effects show. Basically it should work then!

HTH,
Garvin

Posted: Fri Sep 05, 2008 3:55 am
by Rei
:oops: overlooks the UTF-8 folder.

Ok, i edited the correct files
a) lang/UTF-8/serendipity_lang_en.inc.php and
b) lang/UTF-8/serendipity_lang_tw.inc.php [this is the file for Traditional Chinese (UTF-8 )?]

English date format works ok, but Chinese doesn't work (i have to install the multilingual plugin to check since changing language at Personal Settings and General Settings doesn't work for me, refer this post).

The input date format for Chinese as %Y年%B%e日 (%A), but what i get is 週日, 八月 31. 2008 (basically the same as initial English date format, i.e. Sunday, August 31. 2008)

Posted: Fri Sep 05, 2008 10:49 am
by garvinhicking
Hi!

Did you change the constant for DATE_FORMAT_ENTRY now in all two lang_tw.inc.php files in your lang directory?

Did you try to change some other language constants just to see if this basically works? Maybe the lang_cn.inc.php file is used for you?

Regards,
Garvin

Posted: Sun Sep 07, 2008 6:38 am
by Rei
Hi Garvin,

The changes in lang/UTF-8/serendipity_lang_cn.inc.php give me the format i want.

I double checked the source of both pages when i used cn UTF-8 and tw UTF-8 and realised somethings....

The cn page source gives --> xml:lang="cn" lang="cn" ;
but the tw page source gives --> xml:lang="tn" lang="tn" .

I think it should be "tw" ? I haven't find out where to edit that piece of info though. However, i'm still not sure if that is where the problem lies with.

Edit to update:
Ok, the date format for entry has been settled.

Apparently there are 4 files for Chinese language, as follows:
- cn for Simplified Chinese
- zh for Simplified Chinese
- tn for Traditional Chinese
- tw for Traditional Chinese

I don't know why there are so many different format, since so far i only works with cn and tw, and sometimes zh too, but i don't know about "tn" at all.

Anyway, i need another help. Is there a way to change the date format for "Archives"?
Currently it shows in "September 2008" format, would i be possible to change it to show as "2008 September" ?

Posted: Mon Sep 08, 2008 10:56 am
by garvinhicking
Hi!
Currently it shows in "September 2008" format, would i be possible to change it to show as "2008 September" ?
For that I think you need to edit the entries_archives.tpl template file, where the dateformat is hardcoded (not using a constant). You can then shift those around.

Don't ask me about this tn/tw stuff, I sadly don't know chinese at all. It was contributed by the original translator, so I figured he knew what he was doing :)

HTH,
Garvin

[Solved]

Posted: Sat Sep 13, 2008 4:28 am
by Rei
Hi Garvin,

I actually talking about the "Archives" list showing at the sidebar.

Anyway, i figured out i could make the changes at ../include/plugin_internal.inc.php and so far i have no problem with it after making the changes.

Thank you for your help.