availability of labels to plugins
This commit is contained in:
parent
c26cf7711d
commit
8b33c09f62
1 changed files with 6 additions and 2 deletions
|
@ -28,7 +28,7 @@ class TwigLanguageExtension extends \Twig_Extension
|
|||
}
|
||||
|
||||
|
||||
public function translate( $label )
|
||||
public function translate( $label, $labels_from_plugin = NULL )
|
||||
{
|
||||
// replaces spaces, dots, comma and dash with underscores
|
||||
$string = str_replace(" ", "_", $label);
|
||||
|
@ -40,7 +40,11 @@ class TwigLanguageExtension extends \Twig_Extension
|
|||
$string = strtoupper( $string );
|
||||
|
||||
//translates the string
|
||||
$translated_label = isset($this->labels[$string]) ? $this->labels[$string] : null;
|
||||
if(isset($labels_from_plugin)){
|
||||
$translated_label = isset($labels_from_plugin[$string]) ? $labels_from_plugin[$string] : null;
|
||||
} else {
|
||||
$translated_label = isset($this->labels[$string]) ? $this->labels[$string] : null;
|
||||
}
|
||||
|
||||
// if the string is not present, set the original string
|
||||
if( empty($translated_label) ){
|
||||
|
|
Loading…
Add table
Reference in a new issue