Introduce a Language::getMessagesFileName hook that will allow extensions to define new language messages files outside of core.
This commit is contained in:
parent
0ffccfcb69
commit
9d0ee321b6
3 changed files with 13 additions and 6 deletions
|
|
@ -103,6 +103,8 @@ production.
|
||||||
perceiving colors differently. Colors comes from the French Wikipedia.
|
perceiving colors differently. Colors comes from the French Wikipedia.
|
||||||
* (bug 32879) Upgrade jQuery to 1.7.1
|
* (bug 32879) Upgrade jQuery to 1.7.1
|
||||||
* jQuery UI upgraded to 1.8.17
|
* jQuery UI upgraded to 1.8.17
|
||||||
|
* Extensions can use the 'Language::getMessagesFileName' hook to define new
|
||||||
|
languages using messages files outside of core.
|
||||||
|
|
||||||
=== Bug fixes in 1.19 ===
|
=== Bug fixes in 1.19 ===
|
||||||
* $wgUploadNavigationUrl should be used for file redlinks if.
|
* $wgUploadNavigationUrl should be used for file redlinks if.
|
||||||
|
|
|
||||||
|
|
@ -1103,6 +1103,10 @@ $password: The password entered by the user
|
||||||
&$result: Set this and return false to override the internal checks
|
&$result: Set this and return false to override the internal checks
|
||||||
$user: User the password is being validated for
|
$user: User the password is being validated for
|
||||||
|
|
||||||
|
'Language::getMessagesFileName':
|
||||||
|
$code: The language code or the language we're looking for a messages file for
|
||||||
|
&$file: The messages file path, you can override this to change the location.
|
||||||
|
|
||||||
'LanguageGetNamespaces': Provide custom ordering for namespaces or
|
'LanguageGetNamespaces': Provide custom ordering for namespaces or
|
||||||
remove namespaces. Do not use this hook to add namespaces. Use
|
remove namespaces. Do not use this hook to add namespaces. Use
|
||||||
CanonicalNamespaces for that.
|
CanonicalNamespaces for that.
|
||||||
|
|
|
||||||
|
|
@ -659,14 +659,13 @@ class Language {
|
||||||
|
|
||||||
global $IP;
|
global $IP;
|
||||||
$names = array();
|
$names = array();
|
||||||
$dir = opendir( "$IP/languages/messages" );
|
// We do this using a foreach over the codes instead of a directory
|
||||||
while ( false !== ( $file = readdir( $dir ) ) ) {
|
// loop so that messages files in extensions will work correctly.
|
||||||
$code = self::getCodeFromFileName( $file, 'Messages' );
|
foreach ( $allNames as $code => $value ) {
|
||||||
if ( $code && isset( $allNames[$code] ) ) {
|
if ( is_readable( self::getMessagesFileName( $code ) ) ) {
|
||||||
$names[$code] = $allNames[$code];
|
$names[$code] = $allNames[$code];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
closedir( $dir );
|
|
||||||
return $names;
|
return $names;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3521,7 +3520,9 @@ class Language {
|
||||||
*/
|
*/
|
||||||
static function getMessagesFileName( $code ) {
|
static function getMessagesFileName( $code ) {
|
||||||
global $IP;
|
global $IP;
|
||||||
return self::getFileName( "$IP/languages/messages/Messages", $code, '.php' );
|
$file = self::getFileName( "$IP/languages/messages/Messages", $code, '.php' );
|
||||||
|
wfRunHooks( 'Language::getMessagesFileName', array( $code, &$file ) );
|
||||||
|
return $file;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue