mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/DiscussionTools
synced 2024-11-24 00:13:36 +00:00
Add an optional suffix message to mentions
Wikis like jawiki will then be able to customize the message to include honorifics as they think appropriate. Bug: T268588 Change-Id: I213fb9fd0a9ed6592ce3548a5b2c3b11a55c1abc
This commit is contained in:
parent
7694243a9f
commit
dccaa5bf65
|
@ -48,6 +48,7 @@
|
|||
"discussiontools-replywidget-feedback-link",
|
||||
"discussiontools-replywidget-feedback-link-newtopic",
|
||||
"discussiontools-replywidget-mention-prefix",
|
||||
"discussiontools-replywidget-mention-suffix",
|
||||
"discussiontools-signature-prefix"
|
||||
]
|
||||
},
|
||||
|
|
|
@ -78,6 +78,7 @@
|
|||
"discussiontools-replywidget-feedback-link-newtopic": "https://www.mediawiki.org/wiki/Talk:Talk_pages_project/New_discussion",
|
||||
"discussiontools-replywidget-loading": "Loading…",
|
||||
"discussiontools-replywidget-mention-prefix": "@",
|
||||
"discussiontools-replywidget-mention-suffix": "",
|
||||
"discussiontools-replywidget-mention-tool-header": "Find user: $1",
|
||||
"discussiontools-replywidget-mention-tool-title": "Mention a user",
|
||||
"discussiontools-replywidget-mode-source": "Source",
|
||||
|
|
|
@ -88,6 +88,7 @@
|
|||
"discussiontools-replywidget-feedback-link-newtopic": "{{notranslate}}\nLink to a page where users can share feedback about the new topic widget. Defaults to a page on MediaWiki.org.",
|
||||
"discussiontools-replywidget-loading": "Message shown while the reply widget is loading",
|
||||
"discussiontools-replywidget-mention-prefix": "{{optional|Character to prefix mentions. This does not have to be the same as the trigger character, which is always '@'.}}",
|
||||
"discussiontools-replywidget-mention-suffix": "{{optional|Character to suffix mentions. This is intended for community customization in languages with honorifics.}}",
|
||||
"discussiontools-replywidget-mention-tool-header": "Header of search results when searching for a user to mention.\n\nParameters:\n* $1 – search query for the username. Note that this is not a full username, and '''can't''' be used with <code><nowiki>{{GENDER:}}</nowiki></code>.",
|
||||
"discussiontools-replywidget-mention-tool-title": "Title text for the user mention tool.",
|
||||
"discussiontools-replywidget-mode-source": "Label for the widget's source mode.\n\nThis should not include the word 'edit' or 'editor', and where possible should avoid 'wikitext' which is MediaWiki-specific terminology.",
|
||||
|
|
|
@ -50,6 +50,7 @@ CeMWPingNode.static.getDescription = function ( model ) {
|
|||
CeMWPingNode.prototype.initialize = function () {
|
||||
var model = this.getModel(),
|
||||
prefix = mw.msg( 'discussiontools-replywidget-mention-prefix' ),
|
||||
suffix = mw.msg( 'discussiontools-replywidget-mention-suffix' ),
|
||||
user = model.getAttribute( 'user' ),
|
||||
title = mw.Title.makeTitle( mw.config.get( 'wgNamespaceIds' ).user, user );
|
||||
|
||||
|
@ -72,7 +73,8 @@ CeMWPingNode.prototype.initialize = function () {
|
|||
|
||||
this.$element.append(
|
||||
prefix,
|
||||
$link
|
||||
$link,
|
||||
suffix
|
||||
);
|
||||
};
|
||||
|
||||
|
|
|
@ -49,6 +49,7 @@ DmMWPingNode.static.disallowedAnnotationTypes = [ 'link' ];
|
|||
DmMWPingNode.static.toDomElements = function ( dataElement, doc, converter ) {
|
||||
var domElements,
|
||||
prefix = mw.msg( 'discussiontools-replywidget-mention-prefix' ),
|
||||
suffix = mw.msg( 'discussiontools-replywidget-mention-suffix' ),
|
||||
title = mw.Title.makeTitle( mw.config.get( 'wgNamespaceIds' ).user, dataElement.attributes.user );
|
||||
|
||||
dataElement = ve.dm.MWInternalLinkAnnotation.static.dataElementFromTitle( title );
|
||||
|
@ -56,8 +57,10 @@ DmMWPingNode.static.toDomElements = function ( dataElement, doc, converter ) {
|
|||
domElements[ 0 ].appendChild(
|
||||
doc.createTextNode( title.getMainText() )
|
||||
);
|
||||
domElements.unshift( document.createTextNode( prefix ) );
|
||||
domElements.push( document.createTextNode( suffix ) );
|
||||
|
||||
return [ document.createTextNode( prefix ) ].concat( domElements );
|
||||
return domElements;
|
||||
};
|
||||
|
||||
// toDataElement should never be called for this node
|
||||
|
|
|
@ -156,11 +156,12 @@ MWUsernameCompletionAction.prototype.getHeaderLabel = function ( input, suggesti
|
|||
|
||||
MWUsernameCompletionAction.prototype.insertCompletion = function ( word, range ) {
|
||||
var prefix = mw.msg( 'discussiontools-replywidget-mention-prefix' ),
|
||||
suffix = mw.msg( 'discussiontools-replywidget-mention-suffix' ),
|
||||
title = mw.Title.newFromText( word, mw.config.get( 'wgNamespaceIds' ).user );
|
||||
|
||||
if ( this.surface.getMode() === 'source' ) {
|
||||
// TODO: this should be configurable per-wiki so that e.g. custom templates can be used
|
||||
word = prefix + '[[' + title.getPrefixedText() + '|' + word + ']]';
|
||||
word = prefix + '[[' + title.getPrefixedText() + '|' + word + ']]' + suffix;
|
||||
return MWUsernameCompletionAction.super.prototype.insertCompletion.call( this, word, range );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue