Page MenuHomePhabricator

Document the content of a parameter fed by getHumanTimestamp()
Closed, ResolvedPublic


From : as per , translators need to know the grammatical nature of a message a parameter. Saying things like

$1 - date and timestamp, formatted as most are in Flow. That is, a human-readable timestamp is shown.

is completely useless.

We need a template like which will list all the cases and embed all the involved messages via {{msg-mw}}. As far as I know the messages are:

"just-now": "just now",
"hours-ago": "$1 {{PLURAL:$1|hour|hours}} ago",
"minutes-ago": "$1 {{PLURAL:$1|minute|minutes}} ago",
"seconds-ago": "$1 {{PLURAL:$1|second|seconds}} ago",
"monday-at": "Monday at $1",
"tuesday-at": "Tuesday at $1",
"wednesday-at": "Wednesday at $1",
"thursday-at": "Thursday at $1",
"friday-at": "Friday at $1",
"saturday-at": "Saturday at $1",
"sunday-at": "Sunday at $1",
"today-at": "$1",
"yesterday-at": "Yesterday at $1",

Apparently, getHumanTimestamp() assumes that all of these can be translated with an adverbial syntagma in any language.

The followup task will be to add this template to the qqq of all messages using a getHumanTimestamp() parameter, by editing the corresponding /qqq pages on

Event Timeline

Nemo_bis raised the priority of this task from to High.
Nemo_bis updated the task description. (Show Details)
Nemo_bis added subscribers: Nemo_bis, Mhutti1, Purodha.
Nemo_bis renamed this task from Document content of a parameter fed by getHumanTimestamp() to Document the content of a parameter fed by getHumanTimestamp().Jan 13 2016, 8:12 PM
Nemo_bis updated the task description. (Show Details)
Nemo_bis set Security to None.

@Mhutti1, please read the description for the actual names of the messages involved. contains wrong message names. is now usable but should explain what those items are. It would also be better to link those messages, so that the translators can reach them and translate them.

Now better:

We still need to add the template to all involved messages in all extensions.

How do you suggest linking the messages? I assume you mean like how msg-mw does it but with some workaround for int. And is there an easy way to search for occurrences in other extensions?

Yes, we could just add msg-mw in parenthesis next to each example if no other idea comes up.

Then an easy start is to grep the extensions' code:

nemobis@tools-bastion-01:~$ ack-grep --php getHumanTimestamp /shared/mediawiki/extensions/
91:                                     Html::element( 'td', array( 'class' => 'mw-input' ), $timestamp->getHumanTimestamp() )

202:                                            $ts->getHumanTimestamp()

512:            $updatedAt = $violation->getUpdatedAt()->getHumanTimestamp();

263:                                    MWTimestamp::getInstance( $draft->getSaveTime() )->getHumanTimestamp()

310:    public function getHumanTimestamp( $relativeTo = null, User $user = null, Language $lang = null ) {
319:            return $ts ? $ts->getHumanTimestamp( $rel, $user, $lang ) : false;

45:             $res['human_timestamp'] = $this->getHumanTimestamp( $res['timestamp'] );
142:    public function getHumanTimestamp( $timestamp ) {
144:            return $ts->getHumanTimestamp();

252:                            'time_ago' => $ts->getHumanTimestamp(),

124:            $ts = $timestamp->getHumanTimestamp();

35:             $ts = $this->language->getHumanTimestamp(

31:             $ts = $this->language->getHumanTimestamp(

227:                                    $lastReminderTimestamp->getHumanTimestamp()
280:            $agoEnc = htmlspecialchars( $timestamp->getHumanTimestamp() );

315:                    ->params( static::formatId( $feedbackId ), $username, $timestamp->getHumanTimestamp() )

489:                                    $timestamp->getHumanTimestamp()
1252:                                                   ->params( $timestamp->getHumanTimestamp() )

438:            return $timestamp->getHumanTimestamp();

22:                     $tsTime->getHumanTimestamp( $currentTime, null, Language::factory( $language ) ),

Looks good! Thanks mhutti1.