blob: a69a0953e79dbfdf037a5be3ef8f3eeb07ee0823 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
/*!
* VisualEditor MWTranslateAnnotationContextItem class.
*/
/**
* Context item for a MWTranslateAnnotation
*
* @class
* @extends ve.ui.MWAnnotationContextItem
*
* @constructor
* @param {ve.ui.Context} context Context item is in
* @param {ve.dm.Model} model Model item is related to
* @param {Object} config Configuration options
*/
ve.ui.MWTranslateAnnotationContextItem = function VeUiMWTranslateAnnotationContextItem() {
// Parent constructor
ve.ui.MWTranslateAnnotationContextItem.super.apply( this, arguments );
};
/* Inheritance */
OO.inheritClass( ve.ui.MWTranslateAnnotationContextItem, ve.ui.MWAnnotationContextItem );
/* Static Properties */
ve.ui.MWTranslateAnnotationContextItem.static.name = 'mwTranslateAnnotation';
ve.ui.MWTranslateAnnotationContextItem.static.modelClasses = [
ve.dm.MWTranslateAnnotationNode
];
/* Methods */
ve.ui.MWTranslateAnnotationContextItem.prototype.getLabelMessage = function () {
var map = {
'mw:Annotation/translate': 'visualeditor-annotations-translate-start',
'mw:Annotation/translate/End': 'visualeditor-annotations-translate-end',
'mw:Annotation/tvar': 'visualeditor-annotations-tvar-start',
'mw:Annotation/tvar/End': 'visualeditor-annotations-tvar-end'
};
var type = this.model.getAttribute( 'type' );
// eslint-disable-next-line mediawiki/msg-doc
var msg = mw.message( map[ type ] );
return msg.text();
};
ve.ui.MWTranslateAnnotationContextItem.prototype.getDescriptionMessage = function () {
var type = this.model.getAttribute( 'type' );
if ( type.indexOf( '/End', type.length - 4 ) !== -1 ) {
return '';
}
var map = {
'mw:Annotation/translate': 'visualeditor-annotations-translate-description',
'mw:Annotation/tvar': 'visualeditor-annotations-tvar-description'
};
// eslint-disable-next-line mediawiki/msg-doc
var msg = mw.message( map[ type ] );
return msg.parseDom();
};
ve.ui.contextItemFactory.register( ve.ui.MWTranslateAnnotationContextItem );
|