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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
|
<?php
/**
* This file holds a message group interface.
*
* @file
* @defgroup MessageGroup Message group
* @author Niklas Laxström
* @copyright Copyright © 2010-2013, Niklas Laxström
* @license GPL-2.0-or-later
*/
/**
* Interface for message groups.
*
* Message groups are the heart of the Translate extension. They encapsulate
* a set of messages each. Aside from basic information like id, label and
* description, the class defines which mangler, validators and file
* system support (FFS), if any, the group uses.
*
* @ingroup MessageGroup
*/
interface MessageGroup {
/**
* Returns the parsed YAML configuration.
* @todo Remove from the interface. Only usage is in FFS. Figure out a better way.
* @return array
*/
public function getConfiguration();
/**
* Returns the unique identifier for this group.
* @return string
*/
public function getId();
/**
* Returns the human readable label (as plain text).
* Parameter $context was added in 2012-10-22.
* @param IContextSource|null $context Context can be used by subclasses to provide
* translated descriptions, for example.
* @return string
*/
public function getLabel( IContextSource $context = null );
/**
* Returns a longer description about the group. Description can use wikitext.
* Parameter $context was added in 2012-10-22.
* @param IContextSource|null $context Context can be used by subclasses to provide
* translated descriptions, for example.
* @return string
*/
public function getDescription( IContextSource $context = null );
/**
* Returns an icon for this message group if any.
* @return string|null File reference in one of the supported protocols:
* - file://Filename.ext - Accessible via MediaWiki functions
* @since 2012-12-04
*/
public function getIcon();
/**
* Returns the namespace where messages are placed.
* @return int
*/
public function getNamespace();
/**
* @todo Unclear usage. Perhaps rename to isSecondary with the only purpose
* suppress warnings about message key conflicts.
* @return bool
*/
public function isMeta();
/**
* If this function returns false, the message group is ignored and treated
* like it would not be configured at all. Useful for graceful degradation.
* Try to keep the check fast to avoid performance problems.
* @return bool
*/
public function exists();
/**
* Returns a FFS object that handles reading and writing messages to files.
* May also return null if it doesn't make sense.
* @return FFS|null
*/
public function getFFS();
/**
* Returns a message validator object or null.
* @return MessageValidator|null
*/
public function getValidator();
/**
* Return a message mangler or null.
* @todo Make an interface for message manglers
* @return StringMatcher|null
*/
public function getMangler();
/**
* Initialises a message collection with the given language code,
* message definitions and message tags.
* @param string $code
* @return MessageCollection
*/
public function initCollection( $code );
/**
* Returns a list of messages in a given language code. For some groups
* that list may be identical with the translation in the wiki. For other
* groups the messages may be loaded from a file (and differ from the
* current translations or definitions).
* @param string $code
* @return string[]
*/
public function load( $code );
/**
* Shortcut for load( getSourceLanguage() ).
* @return string[]
*/
public function getDefinitions();
/**
* Shortcut for array_keys( getDefinitions() ) that can be optimized by
* the implementing classes.
* @return string[] List of message keys.
*/
public function getKeys();
/**
* Returns message tags. If type is given, only message keys with that
* tag are returned. Otherwise an array[tag => keys] is returned.
* @param string|null $type
* @return array
*/
public function getTags( $type = null );
/**
* Returns the definition or translation for given message key in given
* language code.
* @param string $key Message key
* @param string $code Language code
* @return string|null
*/
public function getMessage( $key, $code );
/**
* Returns language code depicting the language of source text.
* @return string
*/
public function getSourceLanguage();
/**
* Get the message group workflow state configuration.
* @return MessageGroupStates
*/
public function getMessageGroupStates();
/**
* Get all the translatable languages for a group, considering the whitelisting
* and blacklisting.
* @return array|null The language codes as array keys.
*/
public function getTranslatableLanguages();
/**
* List of available message types mapped to the classes
* implementing them.
*
* @return array
*/
public function getTranslationAids();
}
|