Page MenuHomePhabricator

Adding two new time variables for templates, useful for Main_Page sections automation
Closed, ResolvedPublic

Description

As I already used {{CURRENTDAY}} {{CURRENTMONTHNAME}}
in http://it.wikipedia.org/wiki/Template:PaginaPrincipale/Attualita
I propose to change three files in order to add two more time variables to
mediawiki environment.

See proposed changes:

mario@castrum /usr/local/mediawiki/includes$ diff MagicWord.php MagicWord.orig
51,52d50
< define("MAG_CURRENTWEEK", 35);
< define("MAG_CURRENTDOW", 36);
61,62d58
< MAG_CURRENTWEEK,
< MAG_CURRENTDOW,

mario@castrum /usr/local/mediawiki/includes$ diff Parser.php Parser.orig
1540,1541d1539
< case MAG_CURRENTDOW:
< return $wgLang->formatNum( date( 'w' ) );
1544,1545d1541
< case MAG_CURRENTWEEK:
< return $wgLang->formatNum( date( 'W' ) );

mario@castrum /usr/local/mediawiki/languages$ diff Language.php Language.orig
176,177d175
< MAG_CURRENTWEEK => array( 1, 'CURRENTWEEK' ),
< MAG_CURRENTDOW => array( 1, 'CURRENTDOW' ),

You can see a working test page at
http://wiki.usenet.eu.org/Test

TY


Version: 1.3.x
Severity: enhancement

Details

Reference
bz1206
TitleReferenceAuthorSource BranchDest Branch
Add notebook to repair search indicesrepos/structured-data/image-suggestions!3cparleT320656main
Customize query in GitLab

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 8:01 PM
bzimport set Reference to bz1206.

avarab wrote:

One thing that would have to be changeable and translatable is when the week
starts, according to ISO 8601 the week begins on monday (day 1) and ends on
sunday (day 7) while according to most others the week stats on sunday
(difference between the buisness week and the gregorian week perhaps)

Furthermore to increase complexity some count from 0 with monday (or sunday)
being the first day and sunday (or monday) being the sixth day.

See: http://en.wikipedia.org/wiki/Days_of_the_week#Modern_ordering and GNU date(1)

zigger wrote:

*** Bug 1215 has been marked as a duplicate of this bug. ***

Will have a look at it in the next days probably.

mediazilla wrote:

I increased the priority of this bug to Normal, unless there are objections. We
at Wikinews would really like this implemented. I suggest keeping the
implementation as ISO 8601 (which is what the date() function will do) and not
transforming the count per-culture.

Commited in 1_4 and HEAD.
Will be part of beta5, probably going to be put on live
wikimedia sites soon.