2014-01-30 10:51:10 +01:00
|
|
|
<?php
|
2016-02-08 15:41:00 +01:00
|
|
|
/* Icinga Web 2 | (c) 2014 Icinga Development Team | GPLv2+ */
|
2014-01-30 10:51:10 +01:00
|
|
|
|
|
|
|
namespace Icinga\Module\Translation\Clicommands;
|
|
|
|
|
|
|
|
use Icinga\Module\Translation\Cli\TranslationCommand;
|
|
|
|
use Icinga\Module\Translation\Util\GettextTranslationHelper;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Translation compiler
|
|
|
|
*
|
|
|
|
* This command will compile the PO-file of a domain. The actions below allow
|
|
|
|
* you to select a particular domain for which the PO-file should be compiled.
|
|
|
|
*
|
|
|
|
* Domains are the global one 'icinga' and all available and enabled modules
|
|
|
|
* identified by their name.
|
|
|
|
*
|
2015-03-08 14:39:53 +01:00
|
|
|
* Once a PO-file is compiled its content is used by Icinga Web 2 to display
|
2014-01-30 10:51:10 +01:00
|
|
|
* messages in the configured language.
|
|
|
|
*/
|
|
|
|
class CompileCommand extends TranslationCommand
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Compile the global domain
|
|
|
|
*
|
|
|
|
* This will compile the PO-file of the global 'icinga' domain.
|
|
|
|
*
|
|
|
|
* USAGE:
|
|
|
|
*
|
2014-03-19 17:25:53 +01:00
|
|
|
* icingacli translation compile icinga <locale>
|
2014-01-30 10:51:10 +01:00
|
|
|
*
|
|
|
|
* EXAMPLES:
|
|
|
|
*
|
2014-03-19 17:25:53 +01:00
|
|
|
* icingacli translation compile icinga de_DE
|
|
|
|
* icingacli translation compile icinga fr_FR
|
2014-01-30 10:51:10 +01:00
|
|
|
*/
|
|
|
|
public function icingaAction()
|
|
|
|
{
|
|
|
|
$locale = $this->validateLocaleCode($this->params->shift());
|
|
|
|
|
2015-07-30 15:47:35 +02:00
|
|
|
$helper = $this->getTranslationHelper($locale);
|
2014-01-30 10:51:10 +01:00
|
|
|
$helper->compileIcingaTranslation();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Compile a module domain
|
|
|
|
*
|
|
|
|
* This will compile the PO-file of the given module domain.
|
|
|
|
*
|
|
|
|
* USAGE:
|
|
|
|
*
|
2014-03-19 17:25:53 +01:00
|
|
|
* icingacli translation compile <module> <locale>
|
2014-01-30 10:51:10 +01:00
|
|
|
*
|
|
|
|
* EXAMPLES:
|
|
|
|
*
|
2014-03-19 17:25:53 +01:00
|
|
|
* icingacli translation compile monitoring de_DE
|
|
|
|
* icingacli trnslations compile monitoring de_DE
|
2014-01-30 10:51:10 +01:00
|
|
|
*/
|
|
|
|
public function moduleAction()
|
|
|
|
{
|
|
|
|
$module = $this->validateModuleName($this->params->shift());
|
|
|
|
$locale = $this->validateLocaleCode($this->params->shift());
|
|
|
|
|
2015-07-30 15:47:35 +02:00
|
|
|
$helper = $this->getTranslationHelper($locale);
|
2014-01-30 10:51:10 +01:00
|
|
|
$helper->compileModuleTranslation($module);
|
|
|
|
}
|
|
|
|
}
|