summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Legler <alex@a3li.li>2015-01-06 13:46:47 +0100
committerAlex Legler <alex@a3li.li>2015-01-06 13:46:47 +0100
commitb325b70df7a490c6664af9bb80507c5c1af4e885 (patch)
treec3360830cadc9bde71f348f9685bc5df927c8f5b /GentooToolbox
parentAdd smarty (diff)
downloadextensions-b325b70df7a490c6664af9bb80507c5c1af4e885.tar.gz
extensions-b325b70df7a490c6664af9bb80507c5c1af4e885.tar.bz2
extensions-b325b70df7a490c6664af9bb80507c5c1af4e885.zip
Add localized message support
Diffstat (limited to 'GentooToolbox')
-rw-r--r--GentooToolbox/GentooToolbox.php4
-rw-r--r--GentooToolbox/localizedmsg/LocalizedMsg.php14
2 files changed, 18 insertions, 0 deletions
diff --git a/GentooToolbox/GentooToolbox.php b/GentooToolbox/GentooToolbox.php
index a5da0537..8ef161df 100644
--- a/GentooToolbox/GentooToolbox.php
+++ b/GentooToolbox/GentooToolbox.php
@@ -44,3 +44,7 @@ $wgAutoloadClasses['GTBXTranslationProperties'] = $dir . '/properties/Translat
$wgHooks['smwInitProperties'][] = 'GTBXTranslationProperties::setupProperties';
$wgHooks['SMWStore::updateDataBefore'][] = 'GTBXTranslationProperties::updateDataBefore';
+
+// LocalizedMessage
+$wgAutoloadClasses['GTBXLocalizedMsg'] = $dir . '/localizedmsg/LocalizedMsg.php';
+$wgHooks['ParserFirstCallInit'][] = 'GTBXLocalizedMsg::SetUpLocalizedMsgParserFunction';
diff --git a/GentooToolbox/localizedmsg/LocalizedMsg.php b/GentooToolbox/localizedmsg/LocalizedMsg.php
new file mode 100644
index 00000000..9db1abb2
--- /dev/null
+++ b/GentooToolbox/localizedmsg/LocalizedMsg.php
@@ -0,0 +1,14 @@
+<?php
+
+class GTBXLocalizedMsg {
+ public static function SetUpLocalizedMsgParserFunction( &$parser ) {
+ $parser->setFunctionHook( 'msg', 'GTBXLocalizedMsg::LocalizedMsgParserFunction' );
+
+ return true;
+ }
+
+ public static function LocalizedMsgParserFunction( $parser, $message, $language = 'en' ) {
+ return wfMessage( $message )->inLanguage( $language )->escaped();
+ }
+}
+?> \ No newline at end of file