diff options
author | Thomas Steur <tsteur@users.noreply.github.com> | 2018-04-20 23:24:16 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-20 23:24:16 +0300 |
commit | 2d5601e48361523e971fefd2bdaafedd70415315 (patch) | |
tree | f7e19a631ba29760481a9983c1cf0a9f75200203 /plugins/CoreConsole | |
parent | ceaa0fc4eb8f9c39ad629ca59c5d1d2c2e3e6898 (diff) |
Add possibility to let a plugin generator define the translation key (#12746)
Needed in another plugin to have better translation key.
Diffstat (limited to 'plugins/CoreConsole')
-rw-r--r-- | plugins/CoreConsole/Commands/GeneratePluginBase.php | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/plugins/CoreConsole/Commands/GeneratePluginBase.php b/plugins/CoreConsole/Commands/GeneratePluginBase.php index 61db237479..211dc94db3 100644 --- a/plugins/CoreConsole/Commands/GeneratePluginBase.php +++ b/plugins/CoreConsole/Commands/GeneratePluginBase.php @@ -67,10 +67,11 @@ abstract class GeneratePluginBase extends ConsoleCommand * * @param $pluginName * @param $translatedText + * @param string $translationKey Optional, by default the key will be generated automatically * @return string Either the generated translation key or the original text if a different translation for this * generated translation key already exists. */ - protected function makeTranslationIfPossible($pluginName, $translatedText) + protected function makeTranslationIfPossible($pluginName, $translatedText, $translationKey = '') { $defaultLang = array($pluginName => array()); @@ -85,7 +86,11 @@ abstract class GeneratePluginBase extends ConsoleCommand $translations[$pluginName] = array(); } - $key = $this->buildTranslationKey($translatedText); + if (!empty($translationKey)) { + $key = $translationKey; + } else { + $key = $this->buildTranslationKey($translatedText); + } if (array_key_exists($key, $translations[$pluginName])) { // we do not want to overwrite any existing translations |