jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/402401 )

Change subject: Use moment’s relative time for “x seconds ago” message
......................................................................


Use moment’s relative time for “x seconds ago” message

Formatting the duration stand-alone and then appending some string does
not always yield correct results. For example, in German, the
stand-alone duration is in the nominative case („eine Minute“), but the
suffix requires the dative case („vor einer Minute“, not „vor eine
Minute“). Moment.js can fix this for us; unfortunately, it requires an
incompatible change to the message (Moment.js already adds the “ago”, so
we can’t have it in the message), so the message key is changed and we
lose all existing translations.

Change-Id: I08fd2133a1cd772e844fa4b73c5a9673662f6945
---
M i18n/en.json
M i18n/qqq.json
M wikibase/queryService/ui/App.js
3 files changed, 4 insertions(+), 4 deletions(-)

Approvals:
  Jonas Kress (WMDE): Looks good to me, approved
  jenkins-bot: Verified



diff --git a/i18n/en.json b/i18n/en.json
index 9c2679a..c82a4ed 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -35,7 +35,7 @@
     "wdqs-app-help-copy": "Licensing information",
     "wdqs-app-help-queryhelper": "Query Helper",
     "wdqs-app-footer-help": "Press <i>[CTRL-SPACE]</i> to activate auto 
completion.",
-    "wdqs-app-footer-updated": "Data updated $1 ago",
+    "wdqs-app-footer-updated-ago": "Data updated $1",
     "wdqs-app-result-shorturl": "Short URL to result",
     "wdqs-app-result-shorturl-title": "Short URL to this result",
     "wdqs-app-result-rawgraphs": "Open in RAWGraphs.io",
diff --git a/i18n/qqq.json b/i18n/qqq.json
index 63ab7ba..89f9246 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -37,7 +37,7 @@
        "wdqs-app-help-copy": "Link to page with licensing information",
        "wdqs-app-help-queryhelper": "Heading of the Query Helper widget",
        "wdqs-app-footer-help": "Help message at the footer of the editor",
-       "wdqs-app-footer-updated": "Message displaying how long ago data was 
updated",
+       "wdqs-app-footer-updated-ago": "Message displaying how long ago data 
was updated. $1 contains the time period, including a suffix indicating that 
the period is in the past, e.&nbsp;g. “a few seconds ago” or “two minutes 
ago”.",
        "wdqs-app-result-shorturl": "Link message in the footer link dropdown",
        "wdqs-app-result-shorturl-title": "Title of link message in the footer 
link dropdown",
        "wdqs-app-result-rawgraphs": "Link message in the footer link dropdown",
diff --git a/wikibase/queryService/ui/App.js b/wikibase/queryService/ui/App.js
index 6f60eb4..6a7dcb8 100644
--- a/wikibase/queryService/ui/App.js
+++ b/wikibase/queryService/ui/App.js
@@ -447,7 +447,7 @@
 
                        var e = $( this );
                        self._sparqlApi.queryDataUpdatedTime().done( function( 
time, difference ) {
-                               var text = moment.duration( difference, 
'seconds' ).humanize(),
+                               var text = moment.duration( -difference, 
'seconds' ).humanize( true ),
                                        title = time,
                                        badge = '<span class="badge">' + text + 
'</span>';
 
@@ -456,7 +456,7 @@
                                        html: true,
                                        trigger: 'hover',
                                        placement: 'top',
-                                       content: $.i18n( 
'wdqs-app-footer-updated', badge )
+                                       content: $.i18n( 
'wdqs-app-footer-updated-ago', badge )
                                } );
                        } ).fail( function() {
                                e.popover( {

-- 
To view, visit https://gerrit.wikimedia.org/r/402401
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I08fd2133a1cd772e844fa4b73c5a9673662f6945
Gerrit-PatchSet: 1
Gerrit-Project: wikidata/query/gui
Gerrit-Branch: master
Gerrit-Owner: Lucas Werkmeister (WMDE) <lucas.werkmeis...@wikimedia.de>
Gerrit-Reviewer: Jonas Kress (WMDE) <jonas.kr...@wikimedia.de>
Gerrit-Reviewer: Lucas Werkmeister (WMDE) <lucas.werkmeis...@wikimedia.de>
Gerrit-Reviewer: Siebrand <siebr...@kitano.nl>
Gerrit-Reviewer: Smalyshev <smalys...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to