Allow extensions to specify the list of special parameters
This commit is contained in:
parent
b33d8a3d60
commit
1b18554aa7
|
@ -167,6 +167,25 @@ class ActivityManager implements IManager {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $app
|
||||||
|
* @param string $text
|
||||||
|
* @return array|false
|
||||||
|
*/
|
||||||
|
function getSpecialParameterList($app, $text) {
|
||||||
|
foreach($this->extensions as $extension) {
|
||||||
|
$c = $extension();
|
||||||
|
if ($c instanceof IExtension) {
|
||||||
|
$specialParameter = $c->getSpecialParameterList($app, $text);
|
||||||
|
if (is_array($specialParameter)) {
|
||||||
|
return $specialParameter;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $type
|
* @param string $type
|
||||||
* @return string
|
* @return string
|
||||||
|
|
|
@ -79,6 +79,19 @@ interface IExtension {
|
||||||
*/
|
*/
|
||||||
public function translate($app, $text, $params, $stripPath, $highlightParams, $languageCode);
|
public function translate($app, $text, $params, $stripPath, $highlightParams, $languageCode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The extension can define the type of parameters for translation
|
||||||
|
*
|
||||||
|
* Currently known types are:
|
||||||
|
* * file => will strip away the path of the file and add a tooltip with it
|
||||||
|
* * username => will add the avatar of the user
|
||||||
|
*
|
||||||
|
* @param string $app
|
||||||
|
* @param string $text
|
||||||
|
* @return array|false
|
||||||
|
*/
|
||||||
|
function getSpecialParameterList($app, $text);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A string naming the css class for the icon to be used can be returned.
|
* A string naming the css class for the icon to be used can be returned.
|
||||||
* If no icon is known for the given type false is to be returned.
|
* If no icon is known for the given type false is to be returned.
|
||||||
|
|
|
@ -99,6 +99,13 @@ interface IManager {
|
||||||
*/
|
*/
|
||||||
function translate($app, $text, $params, $stripPath, $highlightParams, $languageCode);
|
function translate($app, $text, $params, $stripPath, $highlightParams, $languageCode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $app
|
||||||
|
* @param string $text
|
||||||
|
* @return array|false
|
||||||
|
*/
|
||||||
|
function getSpecialParameterList($app, $text);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $type
|
* @param string $type
|
||||||
* @return string
|
* @return string
|
||||||
|
|
Loading…
Reference in New Issue