Page MenuHomePhabricator

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

Description

From https://translatewiki.net/wiki/Thread:Support/About_MediaWiki:Flow-compare-revisions-revision-header/en : as per https://www.mediawiki.org/wiki/Localisation#Separate_times_from_dates_in_sentences , 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 https://translatewiki.net/wiki/Template:Doc-months 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 translatewiki.net.

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. https://translatewiki.net/wiki/Template:Doc-human-timestamp contains wrong message names.

https://translatewiki.net/wiki/Template:Doc-human-timestamp is now usable but should explain what those items are. https://translatewiki.net/w/i.php?title=Template%3ADoc-human-timestamp&type=revision&diff=6629165&oldid=6626973 It would also be better to link those messages, so that the translators can reach them and translate them.

Now better: https://translatewiki.net/wiki/MediaWiki:Flow-compare-revisions-revision-header/qqq

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/
/shared/mediawiki/extensions/SecureSessions/SpecialSessions.php
91:                                     Html::element( 'td', array( 'class' => 'mw-input' ), $timestamp->getHumanTimestamp() )

/shared/mediawiki/extensions/MobileFrontend/includes/specials/SpecialMobileDiff.php
202:                                            $ts->getHumanTimestamp()

/shared/mediawiki/extensions/WikidataQuality/specials/SpecialViolationsPage.php
512:            $updatedAt = $violation->getUpdatedAt()->getHumanTimestamp();

/shared/mediawiki/extensions/Drafts/Drafts.classes.php
263:                                    MWTimestamp::getInstance( $draft->getSaveTime() )->getHumanTimestamp()

/shared/mediawiki/extensions/Flow/includes/Model/UUID.php
310:    public function getHumanTimestamp( $relativeTo = null, User $user = null, Language $lang = null ) {
319:            return $ts ? $ts->getHumanTimestamp( $rel, $user, $lang ) : false;

/shared/mediawiki/extensions/Flow/includes/Formatter/RevisionViewFormatter.php
45:             $res['human_timestamp'] = $this->getHumanTimestamp( $res['timestamp'] );
142:    public function getHumanTimestamp( $timestamp ) {
144:            return $ts->getHumanTimestamp();

/shared/mediawiki/extensions/Flow/includes/TemplateHelper.php
252:                            'time_ago' => $ts->getHumanTimestamp(),

/shared/mediawiki/extensions/Echo/includes/formatters/NotificationFormatter.php
124:            $ts = $timestamp->getHumanTimestamp();

/shared/mediawiki/extensions/Echo/includes/formatters/EchoFlyoutFormatter.php
35:             $ts = $this->language->getHumanTimestamp(

/shared/mediawiki/extensions/Echo/includes/formatters/SpecialNotificationsFormatter.php
31:             $ts = $this->language->getHumanTimestamp(

/shared/mediawiki/extensions/Translate/specials/SpecialManageTranslatorSandbox.php
227:                                    $lastReminderTimestamp->getHumanTimestamp()
280:            $agoEnc = htmlspecialchars( $timestamp->getHumanTimestamp() );

/shared/mediawiki/extensions/ArticleFeedbackv5/ArticleFeedbackv5.utils.php
315:                    ->params( static::formatId( $feedbackId ), $username, $timestamp->getHumanTimestamp() )

/shared/mediawiki/extensions/ArticleFeedbackv5/ArticleFeedbackv5.render.php
489:                                    $timestamp->getHumanTimestamp()
1252:                                                   ->params( $timestamp->getHumanTimestamp() )

/shared/mediawiki/extensions/PagesList/PagesList.class.php
438:            return $timestamp->getHumanTimestamp();

/shared/mediawiki/extensions/cldr/tests/TimeUnitsTest.php
22:                     $tsTime->getHumanTimestamp( $currentTime, null, Language::factory( $language ) ),

Looks good! Thanks mhutti1.