* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 * @author Icinga Development Team * */ // {{{ICINGA_LICENSE_HEADER}}} 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. * * Once a PO-file is compiled it's content is used by Icinga Web 2 to display * 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: * * icingaweb translation compile icinga * * EXAMPLES: * * icingaweb translation compile icinga de_DE * icingaweb translation compile icinga fr_FR */ public function icingaAction() { $locale = $this->validateLocaleCode($this->params->shift()); $helper = new GettextTranslationHelper($this->app, $locale); $helper->compileIcingaTranslation(); } /** * Compile a module domain * * This will compile the PO-file of the given module domain. * * USAGE: * * icingaweb translation compile * * EXAMPLES: * * icingaweb translation compile monitoring de_DE * icingaweb trnslations compile monitoring de_DE */ public function moduleAction() { $module = $this->validateModuleName($this->params->shift()); $locale = $this->validateLocaleCode($this->params->shift()); $helper = new GettextTranslationHelper($this->app, $locale); $helper->compileModuleTranslation($module); } }