WMDE-leszek has uploaded a new change for review. https://gerrit.wikimedia.org/r/301338
Change subject: Remove HTML tags from i18n messages ...................................................................... Remove HTML tags from i18n messages This moves all HTML formatting out of messages and makes all formatting happen in code. This should make work of translator easier and the UI of the extension no longer rely on HTML tags being included or not in i18n messages. In particular "tooltip" rows are now generated in code, with only their labels being translatable. Change-Id: I2af9b9f0e231a7b2827a202d9ac7161b8c95855a --- M extension.json M i18n/en.json M i18n/qqq.json M modules/ext.RevisionSlider.RevisionListView.js 4 files changed, 28 insertions(+), 15 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/RevisionSlider refs/changes/38/301338/1 diff --git a/extension.json b/extension.json index 315ead3..dc1d903 100644 --- a/extension.json +++ b/extension.json @@ -121,6 +121,9 @@ "modules/ext.RevisionSlider.RevisionListView.js" ], "messages": [ + "colon-separator", + "word-separator", + "revisionslider-bytes", "revisionslider-label-date", "revisionslider-label-page-size", "revisionslider-label-change-size", diff --git a/i18n/en.json b/i18n/en.json index f86e3e0..d1058e9 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -8,11 +8,12 @@ "revisionslider-desc": "Shows a slider allowing selecting and comparing of revisions on a diff page", "revisionslider-beta-feature-message": "RevisionSlider", "revisionslider-beta-feature-description": "Show a revision slider when comparing two revisions of a page.", - "revisionslider-label-date": "<strong>Date:</strong> $1", - "revisionslider-label-page-size": "<strong>Page size:</strong> $1 {{PLURAL:$2|byte|bytes}}", - "revisionslider-label-change-size": "<strong>Change size:</strong> $1 {{PLURAL:$2|byte|bytes}}", - "revisionslider-label-comment": "Comment: ", - "revisionslider-label-username": "<strong>{{GENDER:$2|Username}}:</strong> [[$3|$1]]", + "revisionslider-bytes": "{{PLURAL:$1|byte|bytes}}", + "revisionslider-label-date": "Date", + "revisionslider-label-page-size": "Page size", + "revisionslider-label-change-size": "Change size", + "revisionslider-label-comment": "Comment", + "revisionslider-label-username": "{{GENDER:$1|Username}}", "revisionslider-minoredit": "This is a minor edit", "revisionslider-loading-placeholder": "The RevisionSlider is loading...", "revisionslider-loading-failed": "The RevisionSlider failed to load.", diff --git a/i18n/qqq.json b/i18n/qqq.json index 24d86d5..c4c851c 100644 --- a/i18n/qqq.json +++ b/i18n/qqq.json @@ -10,11 +10,12 @@ "revisionslider-desc": "{{desc|name=RevisionSlider|url=https://www.mediawiki.org/wiki/Extension:RevisionSlider}}", "revisionslider-beta-feature-message": "Label for the RevisionSlider Beta Feature.", "revisionslider-beta-feature-description": "Description for the RevisionSlider Beta Feature, describing the feature that will be enabled.", - "revisionslider-label-date": "Label describing the creation date of this revision.\nParameters:\n* $1 - Creation date.\n{{Identical|Date}}", - "revisionslider-label-page-size": "Label describing the size of this revision.\nParameters:\n* $1 - Formatted page size.\n* $2 - Page size as raw number used for PLURAL.\n{{Identical|Page size}}", - "revisionslider-label-change-size": "Label describing the size of the change compared to the revision before.\nParameters:\n* $1 - Formatted change size colored with markup.\n* $2 - Change size as raw number used for PLURAL", - "revisionslider-label-comment": "Label showing the edit summary of a revision.\n{{Identical|Comment}}", - "revisionslider-label-username": "Label for the revision's author's username.\nParameters:\n* $1 - Username,\n* $2 - Gender as in user preferences (\"male\", \"female\" or \"unknown\", passed to GENDER),\n* $3 - User page or Special:Contributors subpage for IP addresses.\n\n{{Identical|Username}}", + "revisionslider-bytes": "Unit (bytes) used along with revision/change size.\n\nParameters:\n$1 - number of bytes", + "revisionslider-label-date": "Label for the creation date of the revision.", + "revisionslider-label-page-size": "Label for the size of the revision.", + "revisionslider-label-change-size": "Label for the size of the change compared to the revision before.", + "revisionslider-label-comment": "Label for the edit summary of the revision.\n{{Identical|Comment}}", + "revisionslider-label-username": "Label for the revision's author's username.\n\nParameters:\n$1 - Gender as in user preferences (suitable for GENDER)", "revisionslider-minoredit": "Text labeling a minor edit.", "revisionslider-loading-placeholder": "Message shown while the RevisionSlider is still loading on a diff page. Once loaded the message is removed.", "revisionslider-loading-failed": "Message shown if the RevisionSlider fails to initially load.", diff --git a/modules/ext.RevisionSlider.RevisionListView.js b/modules/ext.RevisionSlider.RevisionListView.js index e52ef0a..502045b 100644 --- a/modules/ext.RevisionSlider.RevisionListView.js +++ b/modules/ext.RevisionSlider.RevisionListView.js @@ -139,7 +139,8 @@ var $tooltip = $( '<div>' ) .append( $( '<p>' ).append( - mw.message( 'revisionslider-label-date', rev.getFormattedDate() ).parseDom() + $( '<strong>' ).text( mw.msg( 'revisionslider-label-date' ) + mw.msg( 'colon-separator' ) ), + rev.getFormattedDate() ), this.makeUserLine( rev.getUser(), rev.getUserGender() ), this.makeCommentLine( rev ), @@ -176,7 +177,8 @@ userGender = 'unknown'; } return $( '<bdi>' ).append( $( '<p>' ).append( - mw.message( 'revisionslider-label-username', this.stripInvalidCharacters( userString ), userGender, this.getUserPage( userString ) ).parseDom() + $( '<strong>' ).text( mw.msg( 'revisionslider-label-username', userGender ) + mw.msg( 'colon-separator' ) ), + $( '<a>' ).addClass( 'mw-userlink' ).attr( 'href', mw.util.getUrl( this.getUserPage( userString ) ) ).text( this.stripInvalidCharacters( userString ) ) ) ); }, @@ -201,7 +203,7 @@ return $( '<bdi>' ).append( $( '<p>' ).append( - $( '<strong>' ).text( mw.message( 'revisionslider-label-comment' ).text() ), + $( '<strong>' ).text( mw.msg( 'revisionslider-label-comment' ) + mw.msg( 'colon-separator' ) ), $( '<em>' ).append( rev.getParsedComment() ) @@ -217,7 +219,10 @@ */ makePageSizeLine: function ( size ) { return $( '<p>' ).append( - mw.message( 'revisionslider-label-page-size', mw.language.convertNumber( size ), size ).parseDom() + $( '<strong>' ).text( mw.msg( 'revisionslider-label-page-size' ) + mw.msg( 'colon-separator' ) ), + mw.language.convertNumber( size ), + mw.msg( 'word-separator' ), + mw.msg( 'revisionslider-bytes', size ) ); }, @@ -247,7 +252,10 @@ .text( leadingSign + mw.language.convertNumber( relativeSize ) ); return $( '<p>' ).append( - mw.message( 'revisionslider-label-change-size', $changeNumber, relativeSize ).parseDom() + $( '<strong>' ).text( mw.msg( 'revisionslider-label-change-size' ) + mw.msg( 'colon-separator' ) ), + $changeNumber, + mw.msg( 'word-separator' ), + mw.msg( 'revisionslider-bytes', relativeSize ) ); } } ); -- To view, visit https://gerrit.wikimedia.org/r/301338 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I2af9b9f0e231a7b2827a202d9ac7161b8c95855a Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/RevisionSlider Gerrit-Branch: master Gerrit-Owner: WMDE-leszek <leszek.mani...@wikimedia.de> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits