On Fri, Nov 29, 2013 at 11:30 PM, Brian Wolff <bawo...@gmail.com> wrote:

> On 11/29/13, Sen <kik...@gmail.com> wrote:
> > i know it's depend the mediawiki language,but can i change it by my own?i
> > use chinese mediawiki,but i wana the mediawiki signature time format use
> > english.
> >
> > sorry again,if this question should not ask in this maillist,plz let me
> > know i should send which maillist...i very know to the maillist,and my
> > english is pretty bad too.
> > _______________________________________________
> > Wikitech-l mailing list
> > Wikitech-l@lists.wikimedia.org
> > https://lists.wikimedia.org/mailman/listinfo/wikitech-l
>
> Hi.
>
> This question is probably better suited to the mediawiki-l mailing
> list then this one, but in any case here is the answer:
>
>
> There's two internationalization changes in play here. First of all,
> month names get translated. This is something that you cannot change
> without modifying core (as far as I know).
>
> Second the date format changes (for example, where in the date the
> year is put). This one you can control. Just add to the bottom of
> LocalSettings.php:
>
> $wgDefaultUserOptions['date'] = 'mdy';
>
> and you will get something like "01:22, 11月 30, 2013 (UTC)" instead of
> "2013年11月30日 (六) 01:26 (UTC) ". As noted the month names are still
> shown in Chinese.
>
> If you do something like:
>
> $wgDefaultUserOptions['date'] = 'ISO 8601';
>
> You will get dates that are all numeric like 2013-11-30T01:28:42
> (UTC). Other options for the date format preference include dmy, ymd.
> By default it has the value "default" which is equivalent to the value
> "zh" in the chinese internationalization.
>
> --Bawolff
>
> _______________________________________________
> Wikitech-l mailing list
> Wikitech-l@lists.wikimedia.org
> https://lists.wikimedia.org/mailman/listinfo/wikitech-l
>

To implement what he is asking for, I hacked Parser::pstPass2() in
includes/parser/Parser.php as follows:

Change:
     $key = 'timezone-' . strtolower( trim( $tzMsg ) );
to:
     $key = 'signature-timezone-' . strtolower( trim( $tzMsg ) );

Change:
     $d = $wgContLang->timeanddate( $ts, false, false ) . " ($tzMsg)";
to:
     $en = Language::factory ( 'en' );
     $d = $en->timeanddate( $ts, false, false ) . " ($tzMsg)";

Next, write the following PHP script and run it:

<?php
$abbreviations = array_keys ( DateTimeZone::listAbbreviations() );
foreach ( $abbreviations as $abbreviation ) {
        echo "MediaWiki:Signature-timezone-$abbreviation\n";
}

This will give you the list of MediaWiki: namespace pages you need to
create, e.g. MediaWiki:Signature-timezone-utc,
MediaWiki:Signature-timezone-est, etc. There's probably an easier way,
though.
_______________________________________________
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Reply via email to