Page MenuHomePhabricator

Have CURRENTMONTH render without the leading digit
Closed, ResolvedPublic

Description

Currently, the CURRENTMONTH magic word outputs the current month in two digits,
however, some languages are mostly uses the single digit for the first nine
months, the proposed changes will add the ability to render the current month
number in single digit for the first nine months, this magic word is useful
especially for the East Asian languages. Although there's a magic word
CURRENTDAY and CURRENTDAY2 already, changes are provided in below for consistency:

  • the existing CURRENTMONTH will be changed into CURRENTMONTH2 (same functionary);
  • the new CURRENTMONTH magic word is used to render the currentmonth in single

digit for first nine months.

For example:
The current month is April,
the output of the {{CURRENTMONTH}} is 4, and using {{CURRENTMONTH2}} is 04.
And if the current month is May,
the output of the {{CURRENTMONTH}} is 5, and using {{CURRENTMONTH2}} is 05.

For applying the proposed changes, those files are need to be changed:

  • includes/MagicWord.php
  • includes/Parser.php
  • languages/Language.php

hope my patch works. :)
Man


Version: unspecified
Severity: enhancement

Details

Reference
bz5755

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 9:12 PM
bzimport added a project: MediaWiki-Parser.
bzimport set Reference to bz5755.
bzimport added a subscriber: Unknown Object (MLST).

the patch for the Language.php including the new CURRENTMONTH magic word

Attached:

the patch for the MagicWord.php including the new CURRENTMONTH magic word

Attached:

the patch for the Parser.php including the new CURRENTMONTH magic word

Attached:

The discussions regarding dor this bug is at wikitech-l: Getting the current
month number without leading zero
http://mail.wikipedia.org/pipermail/wikitech-l/2006-April/034833.html

Man

The recent discussions in Chinese wiki is at:
http://zh.wikipedia.org/wiki/Talk:%E9%A6%96%E9%A1%B5/%E6%A1%A3%E6%A1%882#.E6.95.B0.E5.AD.97.E9.A1.AF.E7.A4.BA

This discussion is in Chinese language which the discussion is logged at June 2003.

robchur wrote:

What about the other wikis, using the old format for their own purposes? This
will break quite a bit of existing data.

This is the similar case as the CURRENTDAY and CURRENTDAY2 magic word.

I've considered to use the CURRENTMONTH1 magic word (more atomic). But however,
make a new magic word CURRENTMONTH2 is more consistent then the CURRENTMONTH1
magic word.

it's like: (first resolution, more consistent)

Month/Day in one digit Month/Day in two digit

CURRENTMONTH CURRENTMONTH2
CURRENTDAY CURRENTDAY2

or like: (second resolution, more atomic)

Month/Day in one digit Month/Day in two digit

CURRENTMONTH1 CURRENTMONTH
CURRENTDAY CURRENTDAY2

I think if the first solution is taken, it need to notify other local wikis to
announce the change of the magic word, this announcement can be done on
Announcements part on meta. If the second resolution is taken, it's make the
variable name of MediaWiki software not consistent. (see the above discussion on
wikitech-l as I've posted on the comment #4 before)

in addition, I think there's an idea how to apply the new CURRENTMONTH magic word,
which can be divided into two phases:

First phase (CURRENTMONTH2 rollout):
Make a magic word CURRENTMONTH2 which do the same functionality as the
CURRENTMONTH magic world. During this stage, it's need to notify other wikis to
going have the changes on the magic word, this stage maybe last for one to one and
half month, this buffer time can be called as migration period.

Second phase (CURRENTMONTH rollout):
After the migration period endes, apply the changes for CURRENTMONTH magic word
from two digits to one digit.

one to one and half month?! That's hell long. A python bot or a php script could
do it in a day or so.

(In reply to comment #9)

one to one and half month?! That's hell long. A python bot or a php script

coulddo it in a day or so.

Haven't you considered in other wikis that do not have a bot, or they did nont
know the changes prior of implementation of this set of code? I think that the
migration period is necessary. but hopefully this one can be fully implemented in
version 1.7 (seems currently cannot choose v1.7 in target milestone in BugZilla :D)

ayg wrote:

*** This bug has been marked as a duplicate of 7116 ***

This request was intended to be done on the core, neither on its extensions, REOPENING.

Applied on r50811.

While the {{CURRENTMONTH}} keyword is still works in the same manner for transparency,
thus a new magic word {{CURRENTMONTH1}} can be used instead.

Also {{CURRENTMONTH2}} has been added for consistency with other magic words. :)