translation: Add support for ipl-i18n
This commit is contained in:
parent
8fe282b9aa
commit
5af833bb6d
|
@ -6,7 +6,8 @@ namespace Icinga\Module\Translation\Clicommands;
|
||||||
use Icinga\Date\DateFormatter;
|
use Icinga\Date\DateFormatter;
|
||||||
use Icinga\Module\Translation\Cli\ArrayToTextTableHelper;
|
use Icinga\Module\Translation\Cli\ArrayToTextTableHelper;
|
||||||
use Icinga\Module\Translation\Cli\TranslationCommand;
|
use Icinga\Module\Translation\Cli\TranslationCommand;
|
||||||
use Icinga\Util\Translator;
|
use ipl\I18n\GettextTranslator;
|
||||||
|
use ipl\I18n\StaticTranslator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Timestamp test helper
|
* Timestamp test helper
|
||||||
|
@ -89,12 +90,19 @@ class TestCommand extends TranslationCommand
|
||||||
foreach ($this->params->getAllStandalone() as $l) {
|
foreach ($this->params->getAllStandalone() as $l) {
|
||||||
$this->locales[] = $l;
|
$this->locales[] = $l;
|
||||||
}
|
}
|
||||||
// TODO: get from to environment by default?
|
|
||||||
|
if (empty($this->locales)) {
|
||||||
|
/** @var GettextTranslator $translator */
|
||||||
|
$translator = StaticTranslator::$instance;
|
||||||
|
$this->locales = $translator->listLocales();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function callTranslated($callback, $arguments, $locale = 'C')
|
protected function callTranslated($callback, $arguments, $locale = 'en_US')
|
||||||
{
|
{
|
||||||
Translator::setupLocale($locale);
|
/** @var GettextTranslator $translator */
|
||||||
|
$translator = StaticTranslator::$instance;
|
||||||
|
$translator->setLocale($locale);
|
||||||
return call_user_func_array($callback, $arguments);
|
return call_user_func_array($callback, $arguments);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -235,8 +235,12 @@ class GettextTranslationHelper
|
||||||
'--language=PHP',
|
'--language=PHP',
|
||||||
'--keyword=translate',
|
'--keyword=translate',
|
||||||
'--keyword=translate:1,2c',
|
'--keyword=translate:1,2c',
|
||||||
|
'--keyword=translateInDomain:2',
|
||||||
|
'--keyword=translateInDomain:2,3c',
|
||||||
'--keyword=translatePlural:1,2',
|
'--keyword=translatePlural:1,2',
|
||||||
'--keyword=translatePlural:1,2,4c',
|
'--keyword=translatePlural:1,2,4c',
|
||||||
|
'--keyword=translatePluralInDomain:2,3',
|
||||||
|
'--keyword=translatePluralInDomain:2,3,5c',
|
||||||
'--keyword=mt:2',
|
'--keyword=mt:2',
|
||||||
'--keyword=mt:2,3c',
|
'--keyword=mt:2,3c',
|
||||||
'--keyword=mtp:2,3',
|
'--keyword=mtp:2,3',
|
||||||
|
|
Loading…
Reference in New Issue