Use mt() instead of just t() in the setup module

refs #7163
This commit is contained in:
Johannes Meyer 2014-11-11 09:24:53 +01:00
parent 105934ce7f
commit e1f75b5f5f
25 changed files with 250 additions and 191 deletions

View File

@ -75,15 +75,16 @@ class AdminAccountPage extends Form
$choices = array(); $choices = array();
if ($this->backendConfig['backend'] !== 'db') { if ($this->backendConfig['backend'] !== 'db') {
$choices['by_name'] = t('By Name', 'setup.admin'); $choices['by_name'] = mt('setup', 'By Name', 'setup.admin');
$this->addElement( $this->addElement(
'text', 'text',
'by_name', 'by_name',
array( array(
'required' => isset($formData['user_type']) && $formData['user_type'] === 'by_name', 'required' => isset($formData['user_type']) && $formData['user_type'] === 'by_name',
'value' => $this->getUsername(), 'value' => $this->getUsername(),
'label' => t('Username'), 'label' => mt('setup', 'Username'),
'description' => t( 'description' => mt(
'setup',
'Define the initial administrative account by providing a username that reflects' 'Define the initial administrative account by providing a username that reflects'
. ' a user created later or one that is authenticated using external mechanisms' . ' a user created later or one that is authenticated using external mechanisms'
) )
@ -94,19 +95,22 @@ class AdminAccountPage extends Form
if ($this->backendConfig['backend'] === 'db' || $this->backendConfig['backend'] === 'ldap') { if ($this->backendConfig['backend'] === 'db' || $this->backendConfig['backend'] === 'ldap') {
$users = $this->fetchUsers(); $users = $this->fetchUsers();
if (false === empty($users)) { if (false === empty($users)) {
$choices['existing_user'] = t('Existing User'); $choices['existing_user'] = mt('setup', 'Existing User');
$this->addElement( $this->addElement(
'select', 'select',
'existing_user', 'existing_user',
array( array(
'required' => isset($formData['user_type']) && $formData['user_type'] === 'existing_user', 'required' => isset($formData['user_type']) && $formData['user_type'] === 'existing_user',
'label' => t('Username'), 'label' => mt('setup', 'Username'),
'description' => sprintf( 'description' => sprintf(
t( mt(
'setup',
'Choose a user reported by the %s backend as the initial administrative account', 'Choose a user reported by the %s backend as the initial administrative account',
'setup.admin' 'setup.admin'
), ),
$this->backendConfig['backend'] === 'db' ? t('database', 'setup.admin.authbackend') : 'LDAP' $this->backendConfig['backend'] === 'db'
? mt('setup', 'database', 'setup.admin.authbackend')
: 'LDAP'
), ),
'multiOptions' => array_combine($users, $users) 'multiOptions' => array_combine($users, $users)
) )
@ -115,15 +119,16 @@ class AdminAccountPage extends Form
} }
if ($this->backendConfig['backend'] === 'db') { if ($this->backendConfig['backend'] === 'db') {
$choices['new_user'] = t('New User'); $choices['new_user'] = mt('setup', 'New User');
$required = isset($formData['user_type']) && $formData['user_type'] === 'new_user'; $required = isset($formData['user_type']) && $formData['user_type'] === 'new_user';
$this->addElement( $this->addElement(
'text', 'text',
'new_user', 'new_user',
array( array(
'required' => $required, 'required' => $required,
'label' => t('Username'), 'label' => mt('setup', 'Username'),
'description' => t( 'description' => mt(
'setup',
'Enter the username to be used when creating an initial administrative account' 'Enter the username to be used when creating an initial administrative account'
) )
) )
@ -133,8 +138,8 @@ class AdminAccountPage extends Form
'new_user_password', 'new_user_password',
array( array(
'required' => $required, 'required' => $required,
'label' => t('Password'), 'label' => mt('setup', 'Password'),
'description' => t('Enter the password to assign to the newly created account') 'description' => mt('setup', 'Enter the password to assign to the newly created account')
) )
); );
$this->addElement( $this->addElement(
@ -142,8 +147,8 @@ class AdminAccountPage extends Form
'new_user_2ndpass', 'new_user_2ndpass',
array( array(
'required' => $required, 'required' => $required,
'label' => t('Repeat password'), 'label' => mt('setup', 'Repeat password'),
'description' => t('Please repeat the password given above to avoid typing errors'), 'description' => mt('setup', 'Please repeat the password given above to avoid typing errors'),
'validators' => array( 'validators' => array(
array('identical', false, array('new_user_password')) array('identical', false, array('new_user_password'))
) )
@ -201,7 +206,7 @@ class AdminAccountPage extends Form
} }
if ($data['user_type'] === 'new_user' && array_search($data['new_user'], $this->fetchUsers()) !== false) { if ($data['user_type'] === 'new_user' && array_search($data['new_user'], $this->fetchUsers()) !== false) {
$this->getElement('new_user')->addError(t('Username already exists.')); $this->getElement('new_user')->addError(mt('setup', 'Username already exists.'));
return false; return false;
} }

View File

@ -60,17 +60,20 @@ class AuthBackendPage extends Form
public function createElements(array $formData) public function createElements(array $formData)
{ {
if ($this->config['type'] === 'db') { if ($this->config['type'] === 'db') {
$note = t( $note = mt(
'setup',
'As you\'ve chosen to use a database for authentication all you need ' 'As you\'ve chosen to use a database for authentication all you need '
. 'to do now is defining a name for your first authentication backend.' . 'to do now is defining a name for your first authentication backend.'
); );
} elseif ($this->config['type'] === 'ldap') { } elseif ($this->config['type'] === 'ldap') {
$note = t( $note = mt(
'setup',
'Before you are able to authenticate using the LDAP connection defined earlier you need to' 'Before you are able to authenticate using the LDAP connection defined earlier you need to'
. ' provide some more information so that Icinga Web 2 is able to locate account details.' . ' provide some more information so that Icinga Web 2 is able to locate account details.'
); );
} else { // if ($this->config['type'] === 'autologin' } else { // if ($this->config['type'] === 'autologin'
$note = t( $note = mt(
'setup',
'You\'ve chosen to authenticate using a web server\'s mechanism so it may be necessary' 'You\'ve chosen to authenticate using a web server\'s mechanism so it may be necessary'
. ' to adjust usernames before any permissions, restrictions, etc. are being applied.' . ' to adjust usernames before any permissions, restrictions, etc. are being applied.'
); );
@ -136,8 +139,8 @@ class AuthBackendPage extends Form
'order' => 1, 'order' => 1,
'ignore' => true, 'ignore' => true,
'required' => true, 'required' => true,
'label' => t('Skip Validation'), 'label' => mt('setup', 'Skip Validation'),
'description' => t('Check this to not to validate authentication using this backend') 'description' => mt('setup', 'Check this to not to validate authentication using this backend')
) )
); );
} }

View File

@ -30,7 +30,8 @@ class AuthenticationPage extends Form
new Note( new Note(
'description', 'description',
array( array(
'value' => t( 'value' => mt(
'setup',
'Please choose how you want to authenticate when accessing Icinga Web 2.' 'Please choose how you want to authenticate when accessing Icinga Web 2.'
. ' Configuring backend specific details follows in a later step.' . ' Configuring backend specific details follows in a later step.'
) )
@ -52,8 +53,8 @@ class AuthenticationPage extends Form
'type', 'type',
array( array(
'required' => true, 'required' => true,
'label' => t('Authentication Type'), 'label' => mt('setup', 'Authentication Type'),
'description' => t('The type of authentication to use when accessing Icinga Web 2'), 'description' => mt('setup', 'The type of authentication to use when accessing Icinga Web 2'),
'multiOptions' => $backendTypes 'multiOptions' => $backendTypes
) )
); );

View File

@ -91,7 +91,8 @@ class DatabaseCreationPage extends Form
new Note( new Note(
'description', 'description',
array( array(
'value' => t( 'value' => mt(
'setup',
'It seems that either the database you defined earlier does not yet exist and cannot be created' 'It seems that either the database you defined earlier does not yet exist and cannot be created'
. ' using the provided access credentials or the database does not have the required schema to ' . ' using the provided access credentials or the database does not have the required schema to '
. 'be operated by Icinga Web 2. Please provide appropriate access credentials to solve this.' . 'be operated by Icinga Web 2. Please provide appropriate access credentials to solve this.'
@ -106,16 +107,16 @@ class DatabaseCreationPage extends Form
'username', 'username',
array( array(
'required' => false === $skipValidation, 'required' => false === $skipValidation,
'label' => t('Username'), 'label' => mt('setup', 'Username'),
'description' => t('A user which is able to create databases and/or touch the database schema') 'description' => mt('setup', 'A user which is able to create databases and/or touch the database schema')
) )
); );
$this->addElement( $this->addElement(
'password', 'password',
'password', 'password',
array( array(
'label' => t('Password'), 'label' => mt('setup', 'Password'),
'description' => t('The password for the database user defined above') 'description' => mt('setup', 'The password for the database user defined above')
) )
); );
@ -171,7 +172,9 @@ class DatabaseCreationPage extends Form
// In case we are connected the credentials filled into this // In case we are connected the credentials filled into this
// form need to be granted to create databases, users... // form need to be granted to create databases, users...
if (false === $db->checkPrivileges($this->databaseSetupPrivileges)) { if (false === $db->checkPrivileges($this->databaseSetupPrivileges)) {
$this->addError(t('The provided credentials cannot be used to create the database and/or the user.')); $this->addError(
mt('setup', 'The provided credentials cannot be used to create the database and/or the user.')
);
$this->addSkipValidationCheckbox(); $this->addSkipValidationCheckbox();
return false; return false;
} }
@ -179,7 +182,10 @@ class DatabaseCreationPage extends Form
// ...and to grant all required usage privileges to others // ...and to grant all required usage privileges to others
if (false === $db->isGrantable($this->databaseUsagePrivileges)) { if (false === $db->isGrantable($this->databaseUsagePrivileges)) {
$this->addError(sprintf( $this->addError(sprintf(
t('The provided credentials cannot be used to grant all required privileges to the login "%s".'), mt(
'setup',
'The provided credentials cannot be used to grant all required privileges to the login "%s".'
),
$this->config['username'] $this->config['username']
)); ));
$this->addSkipValidationCheckbox(); $this->addSkipValidationCheckbox();
@ -200,8 +206,11 @@ class DatabaseCreationPage extends Form
array( array(
'order' => 1, 'order' => 1,
'required' => true, 'required' => true,
'label' => t('Skip Validation'), 'label' => mt('setup', 'Skip Validation'),
'description' => t('Check this to not to validate the ability to login and required privileges') 'description' => mt(
'setup',
'Check this to not to validate the ability to login and required privileges'
)
) )
); );
} }

View File

@ -40,7 +40,8 @@ class DbResourcePage extends Form
new Note( new Note(
'description', 'description',
array( array(
'value' => t( 'value' => mt(
'setup',
'Now please configure your database resource. Note that the database itself does not need to' 'Now please configure your database resource. Note that the database itself does not need to'
. ' exist at this time as it is going to be created once the wizard is about to be finished.' . ' exist at this time as it is going to be created once the wizard is about to be finished.'
) )
@ -110,8 +111,8 @@ class DbResourcePage extends Form
'skip_validation', 'skip_validation',
array( array(
'required' => true, 'required' => true,
'label' => t('Skip Validation'), 'label' => mt('setup', 'Skip Validation'),
'description' => t('Check this to not to validate connectivity with the given database server') 'description' => mt('setup', 'Check this to not to validate connectivity with the given database server')
) )
); );
} }

View File

@ -31,7 +31,8 @@ class GeneralConfigPage extends Form
new Note( new Note(
'description', 'description',
array( array(
'value' => t( 'value' => mt(
'setup',
'Now please adjust all application and logging related configuration options to fit your needs.' 'Now please adjust all application and logging related configuration options to fit your needs.'
) )
) )

View File

@ -100,7 +100,7 @@ EOT;
'confirm', 'confirm',
array( array(
'value' => '1', 'value' => '1',
'label' => t('Use this configuration?') 'label' => mt('setup', 'Use this configuration?')
) )
); );
} }

View File

@ -35,7 +35,8 @@ class LdapDiscoveryPage extends Form
new Note( new Note(
'description', 'description',
array( array(
'value' => t( 'value' => mt(
'setup',
'You can use this page to discover LDAP or ActiveDirectory servers ' . 'You can use this page to discover LDAP or ActiveDirectory servers ' .
' for authentication. If you don\' want to execute a discovery, just skip this step.' ' for authentication. If you don\' want to execute a discovery, just skip this step.'
) )
@ -51,8 +52,8 @@ class LdapDiscoveryPage extends Form
'skip_validation', 'skip_validation',
array( array(
'required' => true, 'required' => true,
'label' => t('Skip'), 'label' => mt('setup', 'Skip'),
'description' => t('Do not discover LDAP servers and enter all settings manually.') 'description' => mt('setup', 'Do not discover LDAP servers and enter all settings manually.')
) )
); );
} }

View File

@ -38,7 +38,8 @@ class LdapResourcePage extends Form
new Note( new Note(
'description', 'description',
array( array(
'value' => t( 'value' => mt(
'setup',
'Now please configure your AD/LDAP resource. This will later ' 'Now please configure your AD/LDAP resource. This will later '
. 'be used to authenticate users logging in to Icinga Web 2.' . 'be used to authenticate users logging in to Icinga Web 2.'
) )
@ -96,8 +97,11 @@ class LdapResourcePage extends Form
'skip_validation', 'skip_validation',
array( array(
'required' => true, 'required' => true,
'label' => t('Skip Validation'), 'label' => mt('setup', 'Skip Validation'),
'description' => t('Check this to not to validate connectivity with the given directory service') 'description' => mt(
'setup',
'Check this to not to validate connectivity with the given directory service'
)
) )
); );
} }

View File

@ -31,7 +31,10 @@ class PreferencesPage extends Form
$this->getElement('type') $this->getElement('type')
->setValue('db') ->setValue('db')
->setDescription( ->setDescription(
t('Note that choosing "Database" causes Icinga Web 2 to use the same database as for authentication.') mt(
'setup',
'Note that choosing "Database" causes Icinga Web 2 to use the same database as for authentication.'
)
); );
return $this; return $this;
} }
@ -45,7 +48,7 @@ class PreferencesPage extends Form
new Note( new Note(
'description', 'description',
array( array(
'value' => t('Please choose how Icinga Web 2 should store user preferences.') 'value' => mt('setup', 'Please choose how Icinga Web 2 should store user preferences.')
) )
) )
); );

View File

@ -32,8 +32,9 @@ class WelcomePage extends Form
'token', 'token',
array( array(
'required' => true, 'required' => true,
'label' => t('Setup Token'), 'label' => mt('setup', 'Setup Token'),
'description' => t( 'description' => mt(
'setup',
'For security reasons we need to ensure that you are permitted to run this wizard.' 'For security reasons we need to ensure that you are permitted to run this wizard.'
. ' Please provide a token by following the instructions below.' . ' Please provide a token by following the instructions below.'
), ),

View File

@ -4,8 +4,8 @@ use Icinga\Web\Wizard;
?> ?>
<div class="module-menu"> <div class="module-menu">
<p><?= t('The following modules can be set up by using a web-based wizard as well. To setup a module, just complete its wizard and advance to the summary!'); ?></p> <p><?= mt('setup', 'The following modules can be set up by using a web-based wizard as well. To setup a module, just complete its wizard and advance to the summary!'); ?></p>
<p><?= t('You can freely switch to a module\'s wizard by clicking its name below. The wizard you are currently looking at is written in bold. A small tick is shown on the right once a wizard has been completed.'); ?></p> <p><?= mt('setup', 'You can freely switch to a module\'s wizard by clicking its name below. The wizard you are currently looking at is written in bold. A small tick is shown on the right once a wizard has been completed.'); ?></p>
<form name="<?= $form->getName(); ?>" enctype="<?= $form->getEncType(); ?>" method="<?= $form->getMethod(); ?>" action="<?= $form->getAction(); ?>"> <form name="<?= $form->getName(); ?>" enctype="<?= $form->getEncType(); ?>" method="<?= $form->getMethod(); ?>" action="<?= $form->getAction(); ?>">
<?= $form->getElement($form->getTokenElementName()); ?> <?= $form->getElement($form->getTokenElementName()); ?>
<?= $form->getElement($form->getUidElementName()); ?> <?= $form->getElement($form->getUidElementName()); ?>
@ -19,7 +19,7 @@ use Icinga\Web\Wizard;
<?= $isActive ? '<strong>' : '' ?><?= $module->getTitle(); ?><?= $isActive ? '</strong>' : '' ?> <?= $isActive ? '<strong>' : '' ?><?= $module->getTitle(); ?><?= $isActive ? '</strong>' : '' ?>
</button> </button>
<?php if ($module->getSetupWizard()->isFinished()): ?> <?php if ($module->getSetupWizard()->isFinished()): ?>
<?= $this->icon('acknowledgement.png', t('Completed', 'setup.modules.wizard.state')); ?> <?= $this->icon('acknowledgement.png', mt('setup', 'Completed', 'setup.modules.wizard.state')); ?>
<?php else: ?> <?php else: ?>
<?php $allFinished = false; ?> <?php $allFinished = false; ?>
<?php endif ?> <?php endif ?>
@ -29,9 +29,9 @@ use Icinga\Web\Wizard;
</ul> </ul>
</form> </form>
<?php if ($allFinished): ?> <?php if ($allFinished): ?>
<p class="all-completed"><?= t('You\'ve completed all module wizards!'); ?></p> <p class="all-completed"><?= mt('setup', 'You\'ve completed all module wizards!'); ?></p>
<?php else: ?> <?php else: ?>
<p style="font-size: 80%;"><?= t('Note that you can skip a specific module by just not completing its wizard.'); ?></p> <p style="font-size: 80%;"><?= mt('setup', 'Note that you can skip a specific module by just not completing its wizard.'); ?></p>
<?php endif ?> <?php endif ?>
</div> </div>
<div class="module-wizard"> <div class="module-wizard">

View File

@ -22,7 +22,7 @@ $requirements = $form->getRequirements();
<td></td> <td></td>
<td class="btn-update"> <td class="btn-update">
<div class="buttons"> <div class="buttons">
<a href="<?= $this->href(); ?>" class="button-like"><?= t('Update'); ?></a> <a href="<?= $this->href(); ?>" class="button-like"><?= mt('setup', 'Update'); ?></a>
</div> </div>
</td> </td>
</tr> </tr>

View File

@ -4,7 +4,8 @@ use Icinga\Web\Wizard;
?> ?>
<p><?= sprintf( <p><?= sprintf(
t( mt(
'setup',
'The wizard is now complete. You can review the changes supposed to be made before setting up %1$s.' 'The wizard is now complete. You can review the changes supposed to be made before setting up %1$s.'
. ' Make sure that everything is correct (Feel free to navigate back to make any corrections!) so' . ' Make sure that everything is correct (Feel free to navigate back to make any corrections!) so'
. ' that you can start using %1$s right after it has successfully been set up.' . ' that you can start using %1$s right after it has successfully been set up.'

View File

@ -9,7 +9,7 @@ $setupTokenPath = rtrim(Icinga::app()->getConfigDir(), '/') . '/setup.token';
?> ?>
<div class="welcome-page"> <div class="welcome-page">
<h2><?= t('Welcome to the configuration of Icinga Web 2!') ?></h2> <h2><?= mt('setup', 'Welcome to the configuration of Icinga Web 2!') ?></h2>
<!-- TODO: Remove this once we release the first public version --> <!-- TODO: Remove this once we release the first public version -->
<div style="border:1px solid #777;border-radius:1em;background-color:beige;padding:1em;margin-bottom:1em;display:inline-block;"> <div style="border:1px solid #777;border-radius:1em;background-color:beige;padding:1em;margin-bottom:1em;display:inline-block;">
Icinga Web 2 is still in development and not meant for production deployment. Icinga Web 2 is still in development and not meant for production deployment.
@ -18,29 +18,33 @@ $setupTokenPath = rtrim(Icinga::app()->getConfigDir(), '/') . '/setup.token';
</div> </div>
<div class="info"> <div class="info">
<p><?= sprintf( <p><?= sprintf(
t( mt(
'setup',
'Icinga Web 2 is the next generation monitoring web interface,' 'Icinga Web 2 is the next generation monitoring web interface,'
. ' framework and CLI tool developed by the %s.' . ' framework and CLI tool developed by the %s.'
), ),
'<a href="https://www.icinga.org/community/team/">' . t('Icinga Project') . '</a>' '<a href="https://www.icinga.org/community/team/">' . mt('setup', 'Icinga Project') . '</a>'
); ?></p> ); ?></p>
<p><?= t( <p><?= mt(
'setup',
'Responsive and fast, rewritten from scratch supporting multiple backends and' 'Responsive and fast, rewritten from scratch supporting multiple backends and'
. ' providing a CLI tool. Compatible with Icinga Core 2.x and 1.x.' . ' providing a CLI tool. Compatible with Icinga Core 2.x and 1.x.'
); ?></p> ); ?></p>
<p><?= sprintf( <p><?= sprintf(
t('Check the Icinga website for some %s.', 'setup.welcome.screenshots'), mt('setup', 'Check the Icinga website for some %s.', 'setup.welcome.screenshots'),
'<a href="https://www.icinga.org/icinga/screenshots/icinga-web-2/">' '<a href="https://www.icinga.org/icinga/screenshots/icinga-web-2/">'
. t('insights', 'setup.welcome.screenshots.label') . '</a>' . mt('setup', 'insights', 'setup.welcome.screenshots.label') . '</a>'
); ?></p> ); ?></p>
</div> </div>
<?php if (false === file_exists($setupTokenPath) && file_exists(Config::resolvePath('config.ini'))): ?> <?php if (false === file_exists($setupTokenPath) && file_exists(Config::resolvePath('config.ini'))): ?>
<p class="restart-warning"><?= t( <p class="restart-warning"><?= mt(
'setup',
'You\'ve already completed the configuration of Icinga Web 2. Note that most of your configuration' 'You\'ve already completed the configuration of Icinga Web 2. Note that most of your configuration'
. ' files will be overwritten in case you\'ll re-configure Icinga Web 2 using this wizard!' . ' files will be overwritten in case you\'ll re-configure Icinga Web 2 using this wizard!'
); ?></p> ); ?></p>
<?php else: ?> <?php else: ?>
<p><?= t( <p><?= mt(
'setup',
'This wizard will guide you through the configuration of Icinga Web 2. Once completed and successfully' 'This wizard will guide you through the configuration of Icinga Web 2. Once completed and successfully'
. ' finished you are able to log in and to explore all the new and stunning features!' . ' finished you are able to log in and to explore all the new and stunning features!'
); ?></p> ); ?></p>
@ -55,28 +59,30 @@ $setupTokenPath = rtrim(Icinga::app()->getConfigDir(), '/') . '/setup.token';
</form> </form>
<div class="note"> <div class="note">
<div class="title"> <div class="title">
<img src="<?= $this->href('img/icons/comment.png'); ?>" alt="<?= t('Note'); ?>"> <img src="<?= $this->href('img/icons/comment.png'); ?>" alt="<?= mt('setup', 'Note'); ?>">
<strong>Generating a New Setup Token</strong> <strong>Generating a New Setup Token</strong>
</div> </div>
<div> <div>
<p><?= <p><?=
t('To run this wizard a user needs to authenticate using a token which is usually' mt(
. ' provided to him by an administrator who\'d followed the instructions below.' 'setup',
'To run this wizard a user needs to authenticate using a token which is usually'
. ' provided to him by an administrator who\'d followed the instructions below.'
); ?></p> ); ?></p>
<p><?= t('If you\'ve got the IcingaCLI installed you can do the following:'); ?></p> <p><?= mt('setup', 'If you\'ve got the IcingaCLI installed you can do the following:'); ?></p>
<div class="code"> <div class="code">
<span>icingacli setup config createDirectory <?= ($user = Platform::getPhpUser()) !== null ? $user : 'your_webserver_group'; ?>;</span> <span>icingacli setup config createDirectory <?= ($user = Platform::getPhpUser()) !== null ? $user : 'your_webserver_group'; ?>;</span>
<span>icingacli setup token create;</span> <span>icingacli setup token create;</span>
</div> </div>
<p><?= t('In case the IcingaCLI is missing you can create the token manually:'); ?></p> <p><?= mt('setup', 'In case the IcingaCLI is missing you can create the token manually:'); ?></p>
<div class="code"> <div class="code">
<span>su <?= ($user = Platform::getPhpUser()) !== null ? $user : 'your_webserver_group'; ?> && mkdir -m 2775 <?= dirname($setupTokenPath); ?>;</span> <span>su <?= ($user = Platform::getPhpUser()) !== null ? $user : 'your_webserver_group'; ?> && mkdir -m 2775 <?= dirname($setupTokenPath); ?>;</span>
<span>head -c 12 /dev/urandom | base64 | tee <?= $setupTokenPath; ?>;</span> <span>head -c 12 /dev/urandom | base64 | tee <?= $setupTokenPath; ?>;</span>
<span>chmod 0660 <?= $setupTokenPath; ?>;</span> <span>chmod 0660 <?= $setupTokenPath; ?>;</span>
</div> </div>
<p style="font-size: 85%;"><?= sprintf( <p style="font-size: 85%;"><?= sprintf(
t('Please see the %s for an extensive description on how to access and use this wizard.'), mt('setup', 'Please see the %s for an extensive description on how to access and use this wizard.'),
'<a href="http://docs.icinga.org/">' . t('Icinga Web 2 documentation') . '</a>' // TODO: Add link to iw2 docs which points to the installation topic '<a href="http://docs.icinga.org/">' . mt('setup', 'Icinga Web 2 documentation') . '</a>' // TODO: Add link to iw2 docs which points to the installation topic
); ?></p> ); ?></p>
</div> </div>
</div> </div>

View File

@ -30,7 +30,7 @@ if ($notifications->hasMessages()) {
<?= $this->img('img/logo_icinga_big.png'); ?> <?= $this->img('img/logo_icinga_big.png'); ?>
<div class="progress-bar"> <div class="progress-bar">
<div class="step" style="width: 10%;"> <div class="step" style="width: 10%;">
<h1><?= t('Welcome', 'setup.progress'); ?></h1> <h1><?= mt('setup', 'Welcome', 'setup.progress'); ?></h1>
<?php $stateClass = $finished || $currentPos > 0 ? 'complete' : ( <?php $stateClass = $finished || $currentPos > 0 ? 'complete' : (
$maxProgress > 0 ? 'visited' : 'active' $maxProgress > 0 ? 'visited' : 'active'
); ?> ); ?>
@ -41,7 +41,7 @@ if ($notifications->hasMessages()) {
</tr></tbody></table> </tr></tbody></table>
</div> </div>
<div class="step" style="width: 10%;"> <div class="step" style="width: 10%;">
<h1><?= t('Requirements', 'setup.progress'); ?></h1> <h1><?= mt('setup', 'Requirements', 'setup.progress'); ?></h1>
<?php $stateClass = $finished || $currentPos > 1 ? ' complete' : ( <?php $stateClass = $finished || $currentPos > 1 ? ' complete' : (
$maxProgress > 1 ? ' visited' : ( $maxProgress > 1 ? ' visited' : (
$currentPos === 1 ? ' active' : '' $currentPos === 1 ? ' active' : ''
@ -54,7 +54,7 @@ if ($notifications->hasMessages()) {
</tr></tbody></table> </tr></tbody></table>
</div> </div>
<div class="step" style="width: 50%;"> <div class="step" style="width: 50%;">
<h1><?= t('Configuration', 'setup.progress'); ?></h1> <h1><?= mt('setup', 'Configuration', 'setup.progress'); ?></h1>
<table><tbody><tr> <table><tbody><tr>
<td class="left"> <td class="left">
<?php <?php
@ -105,7 +105,7 @@ if ($notifications->hasMessages()) {
</tr></tbody></table> </tr></tbody></table>
</div> </div>
<div class="step" style="width: 10%;"> <div class="step" style="width: 10%;">
<h1><?= t('Modules', 'setup.progress'); ?></h1> <h1><?= mt('setup', 'Modules', 'setup.progress'); ?></h1>
<?php $stateClass = $finished || $currentPos > count($pages) - 2 ? ' complete' : ( <?php $stateClass = $finished || $currentPos > count($pages) - 2 ? ' complete' : (
$maxProgress > count($pages) - 2 ? ' visited' : ($currentPos === count($pages) - 2 ? ' active' : '') $maxProgress > count($pages) - 2 ? ' visited' : ($currentPos === count($pages) - 2 ? ' active' : '')
); ?> ); ?>
@ -116,7 +116,7 @@ if ($notifications->hasMessages()) {
</tr></tbody></table> </tr></tbody></table>
</div> </div>
<div class="step" style="width: 10%;"> <div class="step" style="width: 10%;">
<h1><?= t('Summary', 'setup.progress'); ?></h1> <h1><?= mt('setup', 'Summary', 'setup.progress'); ?></h1>
<?php $stateClass = $finished ? ' complete' : ($currentPos === count($pages) - 1 ? ' active' : ''); ?> <?php $stateClass = $finished ? ' complete' : ($currentPos === count($pages) - 1 ? ' active' : ''); ?>
<table><tbody><tr> <table><tbody><tr>
<td class="left"><div class="line left<?= $stateClass; ?>"></div></td> <td class="left"><div class="line left<?= $stateClass; ?>"></div></td>
@ -125,7 +125,7 @@ if ($notifications->hasMessages()) {
</tr></tbody></table> </tr></tbody></table>
</div> </div>
<div class="step" style="width: 10%;"> <div class="step" style="width: 10%;">
<h1><?= t('Finish', 'setup.progress'); ?></h1> <h1><?= mt('setup', 'Finish', 'setup.progress'); ?></h1>
<?php $stateClass = $finished ? ' active' : ''; ?> <?php $stateClass = $finished ? ' active' : ''; ?>
<table><tbody><tr> <table><tbody><tr>
<td class="left"><div class="line left<?= $stateClass; ?>"></div></td> <td class="left"><div class="line left<?= $stateClass; ?>"></div></td>

View File

@ -11,16 +11,16 @@
<?php endif ?> <?php endif ?>
<?php endforeach ?> <?php endforeach ?>
<?php if ($success): ?> <?php if ($success): ?>
<p class="success"><?= t('Congratulations! Icinga Web 2 has been successfully set up.'); ?></p> <p class="success"><?= mt('setup', 'Congratulations! Icinga Web 2 has been successfully set up.'); ?></p>
<?php else: ?> <?php else: ?>
<p class="failure"><?= t('Sorry! Failed to set up Icinga Web 2 successfully.'); ?></p> <p class="failure"><?= mt('setup', 'Sorry! Failed to set up Icinga Web 2 successfully.'); ?></p>
<?php endif ?> <?php endif ?>
</div> </div>
<div class="buttons"> <div class="buttons">
<?php if ($success): ?> <?php if ($success): ?>
<a href="<?= $this->href('authentication/login'); ?>" class="button-like login"><?= t('Login to Icinga Web 2'); ?></a> <a href="<?= $this->href('authentication/login'); ?>" class="button-like login"><?= mt('setup', 'Login to Icinga Web 2'); ?></a>
<?php else: ?> <?php else: ?>
<a href="<?= $this->href(); ?>" class="button-like"><?= t('Back'); ?></a> <a href="<?= $this->href(); ?>" class="button-like"><?= mt('setup', 'Back'); ?></a>
<?php endif ?> <?php endif ?>
</div> </div>
</div> </div>

View File

@ -113,15 +113,15 @@ class AuthenticationStep extends Step
public function getSummary() public function getSummary()
{ {
$pageTitle = '<h2>' . t('Authentication') . '</h2>'; $pageTitle = '<h2>' . mt('setup', 'Authentication') . '</h2>';
$backendTitle = '<h3>' . t('Backend Configuration') . '</h3>'; $backendTitle = '<h3>' . mt('setup', 'Backend Configuration') . '</h3>';
$adminTitle = '<h3>' . t('Initial Administrative Account') . '</h3>'; $adminTitle = '<h3>' . mt('setup', 'Initial Administrative Account') . '</h3>';
$authType = $this->data['backendConfig']['backend']; $authType = $this->data['backendConfig']['backend'];
$backendDesc = '<p>' . sprintf( $backendDesc = '<p>' . sprintf(
t('Users will authenticate using %s.', 'setup.summary.auth'), mt('setup', 'Users will authenticate using %s.', 'setup.summary.auth'),
$authType === 'db' ? t('a database', 'setup.summary.auth.type') : ( $authType === 'db' ? mt('setup', 'a database', 'setup.summary.auth.type') : (
$authType === 'ldap' ? 'LDAP' : t('webserver authentication', 'setup.summary.auth.type') $authType === 'ldap' ? 'LDAP' : mt('setup', 'webserver authentication', 'setup.summary.auth.type')
) )
) . '</p>'; ) . '</p>';
@ -151,10 +151,10 @@ class AuthenticationStep extends Step
. '</table>'; . '</table>';
$adminHtml = '<p>' . (isset($this->data['adminAccountData']['resourceConfig']) ? sprintf( $adminHtml = '<p>' . (isset($this->data['adminAccountData']['resourceConfig']) ? sprintf(
t('Administrative rights will initially be granted to a new account called "%s".'), mt('setup', 'Administrative rights will initially be granted to a new account called "%s".'),
$this->data['adminAccountData']['username'] $this->data['adminAccountData']['username']
) : sprintf( ) : sprintf(
t('Administrative rights will initially be granted to an existing account called "%s".'), mt('setup', 'Administrative rights will initially be granted to an existing account called "%s".'),
$this->data['adminAccountData']['username'] $this->data['adminAccountData']['username']
)) . '</p>'; )) . '</p>';
@ -166,28 +166,28 @@ class AuthenticationStep extends Step
{ {
$report = ''; $report = '';
if ($this->authIniError === false) { if ($this->authIniError === false) {
$message = t('Authentication configuration has been successfully written to: %s'); $message = mt('setup', 'Authentication configuration has been successfully written to: %s');
$report .= '<p>' . sprintf($message, Config::resolvePath('authentication.ini')) . '</p>'; $report .= '<p>' . sprintf($message, Config::resolvePath('authentication.ini')) . '</p>';
} elseif ($this->authIniError !== null) { } elseif ($this->authIniError !== null) {
$message = t('Authentication configuration could not be written to: %s; An error occured:'); $message = mt('setup', 'Authentication configuration could not be written to: %s; An error occured:');
$report .= '<p class="error">' . sprintf($message, Config::resolvePath('authentication.ini')) . '</p>' $report .= '<p class="error">' . sprintf($message, Config::resolvePath('authentication.ini')) . '</p>'
. '<p>' . $this->authIniError->getMessage() . '</p>'; . '<p>' . $this->authIniError->getMessage() . '</p>';
} }
if ($this->dbError === false) { if ($this->dbError === false) {
$message = t('Account "%s" has been successfully created.'); $message = mt('setup', 'Account "%s" has been successfully created.');
$report .= '<p>' . sprintf($message, $this->data['adminAccountData']['username']) . '</p>'; $report .= '<p>' . sprintf($message, $this->data['adminAccountData']['username']) . '</p>';
} elseif ($this->dbError !== null) { } elseif ($this->dbError !== null) {
$message = t('Unable to create account "%s". An error occured:'); $message = mt('setup', 'Unable to create account "%s". An error occured:');
$report .= '<p class="error">' . sprintf($message, $this->data['adminAccountData']['username']) . '</p>' $report .= '<p class="error">' . sprintf($message, $this->data['adminAccountData']['username']) . '</p>'
. '<p>' . $this->dbError->getMessage() . '</p>'; . '<p>' . $this->dbError->getMessage() . '</p>';
} }
if ($this->permIniError === false) { if ($this->permIniError === false) {
$message = t('Account "%s" has been successfully defined as initial administrator.'); $message = mt('setup', 'Account "%s" has been successfully defined as initial administrator.');
$report .= '<p>' . sprintf($message, $this->data['adminAccountData']['username']) . '</p>'; $report .= '<p>' . sprintf($message, $this->data['adminAccountData']['username']) . '</p>';
} elseif ($this->permIniError !== null) { } elseif ($this->permIniError !== null) {
$message = t('Unable to define account "%s" as initial administrator. An error occured:'); $message = mt('setup', 'Unable to define account "%s" as initial administrator. An error occured:');
$report .= '<p class="error">' . sprintf($message, $this->data['adminAccountData']['username']) . '</p>' $report .= '<p class="error">' . sprintf($message, $this->data['adminAccountData']['username']) . '</p>'
. '<p>' . $this->permIniError->getMessage() . '</p>'; . '<p>' . $this->permIniError->getMessage() . '</p>';
} }

View File

@ -57,38 +57,41 @@ class DatabaseStep extends Step
try { try {
$db->connectToDb(); $db->connectToDb();
$this->log( $this->log(
t('Successfully connected to existing database "%s"...'), mt('setup', 'Successfully connected to existing database "%s"...'),
$this->data['resourceConfig']['dbname'] $this->data['resourceConfig']['dbname']
); );
} catch (PDOException $_) { } catch (PDOException $_) {
$db->connectToHost(); $db->connectToHost();
$this->log(t('Creating new database "%s"...'), $this->data['resourceConfig']['dbname']); $this->log(mt('setup', 'Creating new database "%s"...'), $this->data['resourceConfig']['dbname']);
$db->exec('CREATE DATABASE ' . $db->quoteIdentifier($this->data['resourceConfig']['dbname'])); $db->exec('CREATE DATABASE ' . $db->quoteIdentifier($this->data['resourceConfig']['dbname']));
$db->reconnect($this->data['resourceConfig']['dbname']); $db->reconnect($this->data['resourceConfig']['dbname']);
} }
if (array_search(key($this->data['tables']), $db->listTables()) !== false) { if (array_search(key($this->data['tables']), $db->listTables()) !== false) {
$this->log(t('Database schema already exists...')); $this->log(mt('setup', 'Database schema already exists...'));
} else { } else {
$this->log(t('Creating database schema...')); $this->log(mt('setup', 'Creating database schema...'));
$db->import(Icinga::app()->getApplicationDir() . '/../etc/schema/mysql.schema.sql'); $db->import(Icinga::app()->getApplicationDir() . '/../etc/schema/mysql.schema.sql');
} }
if ($db->hasLogin($this->data['resourceConfig']['username'])) { if ($db->hasLogin($this->data['resourceConfig']['username'])) {
$this->log(t('Login "%s" already exists...'), $this->data['resourceConfig']['username']); $this->log(mt('setup', 'Login "%s" already exists...'), $this->data['resourceConfig']['username']);
} else { } else {
$this->log(t('Creating login "%s"...'), $this->data['resourceConfig']['username']); $this->log(mt('setup', 'Creating login "%s"...'), $this->data['resourceConfig']['username']);
$db->addLogin($this->data['resourceConfig']['username'], $this->data['resourceConfig']['password']); $db->addLogin($this->data['resourceConfig']['username'], $this->data['resourceConfig']['password']);
} }
$username = $this->data['resourceConfig']['username']; $username = $this->data['resourceConfig']['username'];
if ($db->checkPrivileges($this->data['privileges'], $this->data['tables'], $username)) { if ($db->checkPrivileges($this->data['privileges'], $this->data['tables'], $username)) {
$this->log( $this->log(
t('Required privileges were already granted to login "%s".'), mt('setup', 'Required privileges were already granted to login "%s".'),
$this->data['resourceConfig']['username'] $this->data['resourceConfig']['username']
); );
} else { } else {
$this->log(t('Granting required privileges to login "%s"...'), $this->data['resourceConfig']['username']); $this->log(
mt('setup', 'Granting required privileges to login "%s"...'),
$this->data['resourceConfig']['username']
);
$db->grantPrivileges( $db->grantPrivileges(
$this->data['privileges'], $this->data['privileges'],
$this->data['tables'], $this->data['tables'],
@ -102,12 +105,12 @@ class DatabaseStep extends Step
try { try {
$db->connectToDb(); $db->connectToDb();
$this->log( $this->log(
t('Successfully connected to existing database "%s"...'), mt('setup', 'Successfully connected to existing database "%s"...'),
$this->data['resourceConfig']['dbname'] $this->data['resourceConfig']['dbname']
); );
} catch (PDOException $_) { } catch (PDOException $_) {
$db->connectToHost(); $db->connectToHost();
$this->log(t('Creating new database "%s"...'), $this->data['resourceConfig']['dbname']); $this->log(mt('setup', 'Creating new database "%s"...'), $this->data['resourceConfig']['dbname']);
$db->exec(sprintf( $db->exec(sprintf(
"CREATE DATABASE %s WITH ENCODING 'UTF-8'", "CREATE DATABASE %s WITH ENCODING 'UTF-8'",
$db->quoteIdentifier($this->data['resourceConfig']['dbname']) $db->quoteIdentifier($this->data['resourceConfig']['dbname'])
@ -116,27 +119,30 @@ class DatabaseStep extends Step
} }
if (array_search(key($this->data['tables']), $db->listTables()) !== false) { if (array_search(key($this->data['tables']), $db->listTables()) !== false) {
$this->log(t('Database schema already exists...')); $this->log(mt('setup', 'Database schema already exists...'));
} else { } else {
$this->log(t('Creating database schema...')); $this->log(mt('setup', 'Creating database schema...'));
$db->import(Icinga::app()->getApplicationDir() . '/../etc/schema/pgsql.schema.sql'); $db->import(Icinga::app()->getApplicationDir() . '/../etc/schema/pgsql.schema.sql');
} }
if ($db->hasLogin($this->data['resourceConfig']['username'])) { if ($db->hasLogin($this->data['resourceConfig']['username'])) {
$this->log(t('Login "%s" already exists...'), $this->data['resourceConfig']['username']); $this->log(mt('setup', 'Login "%s" already exists...'), $this->data['resourceConfig']['username']);
} else { } else {
$this->log(t('Creating login "%s"...'), $this->data['resourceConfig']['username']); $this->log(mt('setup', 'Creating login "%s"...'), $this->data['resourceConfig']['username']);
$db->addLogin($this->data['resourceConfig']['username'], $this->data['resourceConfig']['password']); $db->addLogin($this->data['resourceConfig']['username'], $this->data['resourceConfig']['password']);
} }
$username = $this->data['resourceConfig']['username']; $username = $this->data['resourceConfig']['username'];
if ($db->checkPrivileges($this->data['privileges'], $this->data['tables'], $username)) { if ($db->checkPrivileges($this->data['privileges'], $this->data['tables'], $username)) {
$this->log( $this->log(
t('Required privileges were already granted to login "%s".'), mt('setup', 'Required privileges were already granted to login "%s".'),
$this->data['resourceConfig']['username'] $this->data['resourceConfig']['username']
); );
} else { } else {
$this->log(t('Granting required privileges to login "%s"...'), $this->data['resourceConfig']['username']); $this->log(
mt('setup', 'Granting required privileges to login "%s"...'),
$this->data['resourceConfig']['username']
);
$db->grantPrivileges( $db->grantPrivileges(
$this->data['privileges'], $this->data['privileges'],
$this->data['tables'], $this->data['tables'],
@ -162,7 +168,8 @@ class DatabaseStep extends Step
if (array_search(key($this->data['tables']), $db->listTables()) === false) { if (array_search(key($this->data['tables']), $db->listTables()) === false) {
if ($resourceConfig['username'] !== $this->data['resourceConfig']['username']) { if ($resourceConfig['username'] !== $this->data['resourceConfig']['username']) {
$message = sprintf( $message = sprintf(
t( mt(
'setup',
'The database user "%s" will be used to setup the missing schema required by Icinga' 'The database user "%s" will be used to setup the missing schema required by Icinga'
. ' Web 2 in database "%s" and to grant access to it to a new login called "%s".' . ' Web 2 in database "%s" and to grant access to it to a new login called "%s".'
), ),
@ -172,7 +179,8 @@ class DatabaseStep extends Step
); );
} else { } else {
$message = sprintf( $message = sprintf(
t( mt(
'setup',
'The database user "%s" will be used to setup the missing' 'The database user "%s" will be used to setup the missing'
. ' schema required by Icinga Web 2 in database "%s".' . ' schema required by Icinga Web 2 in database "%s".'
), ),
@ -182,7 +190,7 @@ class DatabaseStep extends Step
} }
} else { } else {
$message = sprintf( $message = sprintf(
t('The database "%s" already seems to be fully set up. No action required.'), mt('setup', 'The database "%s" already seems to be fully set up. No action required.'),
$resourceConfig['dbname'] $resourceConfig['dbname']
); );
} }
@ -192,7 +200,8 @@ class DatabaseStep extends Step
if ($resourceConfig['username'] !== $this->data['resourceConfig']['username']) { if ($resourceConfig['username'] !== $this->data['resourceConfig']['username']) {
if ($db->hasLogin($this->data['resourceConfig']['username'])) { if ($db->hasLogin($this->data['resourceConfig']['username'])) {
$message = sprintf( $message = sprintf(
t( mt(
'setup',
'The database user "%s" will be used to create the missing database' 'The database user "%s" will be used to create the missing database'
. ' "%s" with the schema required by Icinga Web 2 and to grant' . ' "%s" with the schema required by Icinga Web 2 and to grant'
. ' access to it to an existing login called "%s".' . ' access to it to an existing login called "%s".'
@ -203,7 +212,8 @@ class DatabaseStep extends Step
); );
} else { } else {
$message = sprintf( $message = sprintf(
t( mt(
'setup',
'The database user "%s" will be used to create the missing database' 'The database user "%s" will be used to create the missing database'
. ' "%s" with the schema required by Icinga Web 2 and to grant' . ' "%s" with the schema required by Icinga Web 2 and to grant'
. ' access to it to a new login called "%s".' . ' access to it to a new login called "%s".'
@ -215,7 +225,8 @@ class DatabaseStep extends Step
} }
} else { } else {
$message = sprintf( $message = sprintf(
t( mt(
'setup',
'The database user "%s" will be used to create the missing' 'The database user "%s" will be used to create the missing'
. ' database "%s" with the schema required by Icinga Web 2.' . ' database "%s" with the schema required by Icinga Web 2.'
), ),
@ -224,23 +235,24 @@ class DatabaseStep extends Step
); );
} }
} catch (Exception $_) { } catch (Exception $_) {
$message = t( $message = mt(
'setup',
'No connection to database host possible. You\'ll need to setup the' 'No connection to database host possible. You\'ll need to setup the'
. ' database with the schema required by Icinga Web 2 manually.' . ' database with the schema required by Icinga Web 2 manually.'
); );
} }
} }
return '<h2>' . t('Database Setup') . '</h2><p>' . $message . '</p>'; return '<h2>' . mt('setup', 'Database Setup') . '</h2><p>' . $message . '</p>';
} }
public function getReport() public function getReport()
{ {
if ($this->error === false) { if ($this->error === false) {
return '<p>' . join('</p><p>', $this->messages) . '</p>' return '<p>' . join('</p><p>', $this->messages) . '</p>'
. '<p>' . t('The database has been fully set up!') . '</p>'; . '<p>' . mt('setup', 'The database has been fully set up!') . '</p>';
} elseif ($this->error !== null) { } elseif ($this->error !== null) {
$message = t('Failed to fully setup the database. An error occured:'); $message = mt('setup', 'Failed to fully setup the database. An error occured:');
return '<p>' . join('</p><p>', $this->messages) . '</p>' return '<p>' . join('</p><p>', $this->messages) . '</p>'
. '<p class="error">' . $message . '</p><p>' . $this->error->getMessage() . '</p>'; . '<p class="error">' . $message . '</p><p>' . $this->error->getMessage() . '</p>';
} }

View File

@ -53,14 +53,14 @@ class GeneralConfigStep extends Step
public function getSummary() public function getSummary()
{ {
$pageTitle = '<h2>' . t('Application Configuration') . '</h2>'; $pageTitle = '<h2>' . mt('setup', 'Application Configuration') . '</h2>';
$generalTitle = '<h3>' . t('General', 'app.config') . '</h3>'; $generalTitle = '<h3>' . t('General', 'app.config') . '</h3>';
$loggingTitle = '<h3>' . t('Logging', 'app.config') . '</h3>'; $loggingTitle = '<h3>' . t('Logging', 'app.config') . '</h3>';
$generalHtml = '' $generalHtml = ''
. '<ul>' . '<ul>'
. '<li>' . sprintf( . '<li>' . sprintf(
t('Icinga Web 2 will save new configuration files using the mode "%s".'), mt('setup', 'Icinga Web 2 will save new configuration files using the mode "%s".'),
$this->data['generalConfig']['global_filemode'] $this->data['generalConfig']['global_filemode']
) . '</li>' ) . '</li>'
. '<li>' . sprintf( . '<li>' . sprintf(
@ -77,7 +77,7 @@ class GeneralConfigStep extends Step
$type = $this->data['generalConfig']['logging_log']; $type = $this->data['generalConfig']['logging_log'];
if ($type === 'none') { if ($type === 'none') {
$loggingHtml = '<p>' . t('Logging will be disabled.') . '</p>'; $loggingHtml = '<p>' . mt('setup', 'Logging will be disabled.') . '</p>';
} else { } else {
$level = $this->data['generalConfig']['logging_level']; $level = $this->data['generalConfig']['logging_level'];
$loggingHtml = '' $loggingHtml = ''
@ -117,10 +117,10 @@ class GeneralConfigStep extends Step
public function getReport() public function getReport()
{ {
if ($this->error === false) { if ($this->error === false) {
$message = t('General configuration has been successfully written to: %s'); $message = mt('setup', 'General configuration has been successfully written to: %s');
return '<p>' . sprintf($message, Config::resolvePath('config.ini')) . '</p>'; return '<p>' . sprintf($message, Config::resolvePath('config.ini')) . '</p>';
} elseif ($this->error !== null) { } elseif ($this->error !== null) {
$message = t('General configuration could not be written to: %s; An error occured:'); $message = mt('setup', 'General configuration could not be written to: %s; An error occured:');
return '<p class="error">' . sprintf($message, Config::resolvePath('config.ini')) . '</p>' return '<p class="error">' . sprintf($message, Config::resolvePath('config.ini')) . '</p>'
. '<p>' . $this->error->getMessage() . '</p>'; . '<p>' . $this->error->getMessage() . '</p>';
} }

View File

@ -57,13 +57,13 @@ class ResourceStep extends Step
public function getSummary() public function getSummary()
{ {
if (isset($this->data['dbResourceConfig']) && isset($this->data['ldapResourceConfig'])) { if (isset($this->data['dbResourceConfig']) && isset($this->data['ldapResourceConfig'])) {
$pageTitle = '<h2>' . t('Resources') . '</h2>'; $pageTitle = '<h2>' . mt('setup', 'Resources') . '</h2>';
} else { } else {
$pageTitle = '<h2>' . t('Resource') . '</h2>'; $pageTitle = '<h2>' . mt('setup', 'Resource') . '</h2>';
} }
if (isset($this->data['dbResourceConfig'])) { if (isset($this->data['dbResourceConfig'])) {
$dbTitle = '<h3>' . t('Database') . '</h3>'; $dbTitle = '<h3>' . mt('setup', 'Database') . '</h3>';
$dbHtml = '' $dbHtml = ''
. '<table>' . '<table>'
. '<tbody>' . '<tbody>'
@ -139,10 +139,10 @@ class ResourceStep extends Step
public function getReport() public function getReport()
{ {
if ($this->error === false) { if ($this->error === false) {
$message = t('Resource configuration has been successfully written to: %s'); $message = mt('setup', 'Resource configuration has been successfully written to: %s');
return '<p>' . sprintf($message, Config::resolvePath('resources.ini')) . '</p>'; return '<p>' . sprintf($message, Config::resolvePath('resources.ini')) . '</p>';
} elseif ($this->error !== null) { } elseif ($this->error !== null) {
$message = t('Resource configuration could not be written to: %s; An error occured:'); $message = mt('setup', 'Resource configuration could not be written to: %s; An error occured:');
return '<p class="error">' . sprintf($message, Config::resolvePath('resources.ini')) . '</p>' return '<p class="error">' . sprintf($message, Config::resolvePath('resources.ini')) . '</p>'
. '<p>' . $this->error->getMessage() . '</p>'; . '<p>' . $this->error->getMessage() . '</p>';
} }

View File

@ -49,9 +49,9 @@ class EnableModuleStep extends Step
public function getReport() public function getReport()
{ {
if ($this->error === false) { if ($this->error === false) {
return '<p>' . sprintf(t('Module "%s" has been successfully enabled.'), $this->moduleName) . '</p>'; return '<p>' . sprintf(mt('setup', 'Module "%s" has been successfully enabled.'), $this->moduleName) . '</p>';
} elseif ($this->error !== null) { } elseif ($this->error !== null) {
$message = t('Module "%s" could not be enabled. An error occured:'); $message = mt('setup', 'Module "%s" could not be enabled. An error occured:');
return '<p class="error">' . sprintf($message, $this->moduleName) . '</p>' return '<p class="error">' . sprintf($message, $this->moduleName) . '</p>'
. '<p>' . $this->error->getMessage() . '</p>'; . '<p>' . $this->error->getMessage() . '</p>';
} }

View File

@ -53,8 +53,8 @@ class MakeDirStep extends Step
public function getReport() public function getReport()
{ {
$okMessage = t('Directory "%s" in "%s" has been successfully created.'); $okMessage = mt('setup', 'Directory "%s" in "%s" has been successfully created.');
$failMessage = t('Unable to create directory "%s" in "%s". An error occured:'); $failMessage = mt('setup', 'Unable to create directory "%s" in "%s". An error occured:');
$report = ''; $report = '';
foreach ($this->paths as $path) { foreach ($this->paths as $path) {

View File

@ -30,19 +30,19 @@ class TokenValidator extends Zend_Validate_Abstract
$this->tokenPath = $tokenPath; $this->tokenPath = $tokenPath;
$this->_messageTemplates = array( $this->_messageTemplates = array(
'TOKEN_FILE_ERROR' => sprintf( 'TOKEN_FILE_ERROR' => sprintf(
t('Cannot validate token: %s (%s)'), mt('setup', 'Cannot validate token: %s (%s)'),
$tokenPath, $tokenPath,
'%value%' '%value%'
), ),
'TOKEN_FILE_EMPTY' => sprintf( 'TOKEN_FILE_EMPTY' => sprintf(
t('Cannot validate token, file "%s" is empty. Please define a token.'), mt('setup', 'Cannot validate token, file "%s" is empty. Please define a token.'),
$tokenPath $tokenPath
), ),
'TOKEN_FILE_PUBLIC' => sprintf( 'TOKEN_FILE_PUBLIC' => sprintf(
t('Cannot validate token, file "%s" must only be accessible by the webserver\'s user.'), mt('setup', 'Cannot validate token, file "%s" must only be accessible by the webserver\'s user.'),
$tokenPath $tokenPath
), ),
'TOKEN_INVALID' => t('Invalid token supplied.') 'TOKEN_INVALID' => mt('setup', 'Invalid token supplied.')
); );
} }

View File

@ -141,13 +141,15 @@ class WebWizard extends Wizard implements SetupWizard
} elseif ($page->getName() === 'setup_db_resource') { } elseif ($page->getName() === 'setup_db_resource') {
$ldapData = $this->getPageData('setup_ldap_resource'); $ldapData = $this->getPageData('setup_ldap_resource');
if ($ldapData !== null && $request->getPost('name') === $ldapData['name']) { if ($ldapData !== null && $request->getPost('name') === $ldapData['name']) {
$page->addError(t('The given resource name must be unique and is already in use by the LDAP resource')); $page->addError(
mt('setup', 'The given resource name must be unique and is already in use by the LDAP resource')
);
} }
} elseif ($page->getName() === 'setup_ldap_resource') { } elseif ($page->getName() === 'setup_ldap_resource') {
$dbData = $this->getPageData('setup_db_resource'); $dbData = $this->getPageData('setup_db_resource');
if ($dbData !== null && $request->getPost('name') === $dbData['name']) { if ($dbData !== null && $request->getPost('name') === $dbData['name']) {
$page->addError( $page->addError(
t('The given resource name must be unique and is already in use by the database resource') mt('setup', 'The given resource name must be unique and is already in use by the database resource')
); );
} }
@ -248,9 +250,9 @@ class WebWizard extends Wizard implements SetupWizard
$pages = $this->getPages(); $pages = $this->getPages();
$index = array_search($page, $pages, true); $index = array_search($page, $pages, true);
if ($index === 0) { if ($index === 0) {
$page->getElement(static::BTN_NEXT)->setLabel(t('Start', 'setup.welcome.btn.next')); $page->getElement(static::BTN_NEXT)->setLabel(mt('setup', 'Start', 'setup.welcome.btn.next'));
} elseif ($index === count($pages) - 1) { } elseif ($index === count($pages) - 1) {
$page->getElement(static::BTN_NEXT)->setLabel(t('Setup Icinga Web 2', 'setup.summary.btn.finish')); $page->getElement(static::BTN_NEXT)->setLabel(mt('setup', 'Setup Icinga Web 2', 'setup.summary.btn.finish'));
} }
} }
@ -374,140 +376,149 @@ class WebWizard extends Wizard implements SetupWizard
$phpVersion = Platform::getPhpVersion(); $phpVersion = Platform::getPhpVersion();
$requirements->addMandatory( $requirements->addMandatory(
t('PHP Version'), mt('setup', 'PHP Version'),
t( mt(
'setup',
'Running Icinga Web 2 requires PHP version 5.3.2. Advanced features' 'Running Icinga Web 2 requires PHP version 5.3.2. Advanced features'
. ' like the built-in web server require PHP version 5.4.' . ' like the built-in web server require PHP version 5.4.'
), ),
version_compare($phpVersion, '5.3.2', '>='), version_compare($phpVersion, '5.3.2', '>='),
sprintf(t('You are running PHP version %s.'), $phpVersion) sprintf(mt('setup', 'You are running PHP version %s.'), $phpVersion)
); );
$defaultTimezone = Platform::getPhpConfig('date.timezone'); $defaultTimezone = Platform::getPhpConfig('date.timezone');
$requirements->addMandatory( $requirements->addMandatory(
t('Default Timezone'), mt('setup', 'Default Timezone'),
t('It is required that a default timezone has been set using date.timezone in php.ini.'), mt('setup', 'It is required that a default timezone has been set using date.timezone in php.ini.'),
$defaultTimezone, $defaultTimezone,
$defaultTimezone ? sprintf(t('Your default timezone is: %s'), $defaultTimezone) : ( $defaultTimezone ? sprintf(mt('setup', 'Your default timezone is: %s'), $defaultTimezone) : (
t('You did not define a default timezone.') mt('setup', 'You did not define a default timezone.')
) )
); );
$requirements->addOptional( $requirements->addOptional(
t('Linux Platform'), mt('setup', 'Linux Platform'),
t( mt(
'setup',
'Icinga Web 2 is developed for and tested on Linux. While we cannot' 'Icinga Web 2 is developed for and tested on Linux. While we cannot'
. ' guarantee they will, other platforms may also perform as well.' . ' guarantee they will, other platforms may also perform as well.'
), ),
Platform::isLinux(), Platform::isLinux(),
sprintf(t('You are running PHP on a %s system.'), Platform::getOperatingSystemName()) sprintf(mt('setup', 'You are running PHP on a %s system.'), Platform::getOperatingSystemName())
); );
$requirements->addOptional( $requirements->addOptional(
t('PHP Module: JSON'), mt('setup', 'PHP Module: JSON'),
t('The JSON module for PHP is required for various export functionalities as well as APIs.'), mt('setup', 'The JSON module for PHP is required for various export functionalities as well as APIs.'),
Platform::extensionLoaded('json'), Platform::extensionLoaded('json'),
Platform::extensionLoaded('json') ? t('The PHP module JSON is available.') : ( Platform::extensionLoaded('json') ? mt('setup', 'The PHP module JSON is available.') : (
t('The PHP module JSON is missing.') mt('setup', 'The PHP module JSON is missing.')
) )
); );
$requirements->addOptional( $requirements->addOptional(
t('PHP Module: LDAP'), mt('setup', 'PHP Module: LDAP'),
t('If you\'d like to authenticate users using LDAP the corresponding PHP module is required'), mt('setup', 'If you\'d like to authenticate users using LDAP the corresponding PHP module is required'),
Platform::extensionLoaded('ldap'), Platform::extensionLoaded('ldap'),
Platform::extensionLoaded('ldap') ? t('The PHP module LDAP is available') : ( Platform::extensionLoaded('ldap') ? mt('setup', 'The PHP module LDAP is available') : (
t('The PHP module LDAP is missing') mt('setup', 'The PHP module LDAP is missing')
) )
); );
$requirements->addOptional( $requirements->addOptional(
t('PHP Module: INTL'), mt('setup', 'PHP Module: INTL'),
t( mt(
'setup',
'If you want your users to benefit from language, timezone and date/time' 'If you want your users to benefit from language, timezone and date/time'
. ' format negotiation, the INTL module for PHP is required.' . ' format negotiation, the INTL module for PHP is required.'
), ),
Platform::extensionLoaded('intl'), Platform::extensionLoaded('intl'),
Platform::extensionLoaded('intl') ? t('The PHP module INTL is available') : ( Platform::extensionLoaded('intl') ? mt('setup', 'The PHP module INTL is available') : (
t('The PHP module INTL is missing') mt('setup', 'The PHP module INTL is missing')
) )
); );
// TODO(6172): Remove this requirement once we do not ship dompdf with Icinga Web 2 anymore // TODO(6172): Remove this requirement once we do not ship dompdf with Icinga Web 2 anymore
$requirements->addOptional( $requirements->addOptional(
t('PHP Module: DOM'), mt('setup', 'PHP Module: DOM'),
t('To be able to export views and reports to PDF, the DOM module for PHP is required.'), mt('setup', 'To be able to export views and reports to PDF, the DOM module for PHP is required.'),
Platform::extensionLoaded('dom'), Platform::extensionLoaded('dom'),
Platform::extensionLoaded('dom') ? t('The PHP module DOM is available') : ( Platform::extensionLoaded('dom') ? mt('setup', 'The PHP module DOM is available') : (
t('The PHP module DOM is missing') mt('setup', 'The PHP module DOM is missing')
) )
); );
$requirements->addOptional( $requirements->addOptional(
t('PHP Module: GD'), mt('setup', 'PHP Module: GD'),
t( mt(
'setup',
'In case you want icons and graphs being exported to PDF' 'In case you want icons and graphs being exported to PDF'
. ' as well, you\'ll need the GD extension for PHP.' . ' as well, you\'ll need the GD extension for PHP.'
), ),
Platform::extensionLoaded('gd'), Platform::extensionLoaded('gd'),
Platform::extensionLoaded('gd') ? t('The PHP module GD is available') : ( Platform::extensionLoaded('gd') ? mt('setup', 'The PHP module GD is available') : (
t('The PHP module GD is missing') mt('setup', 'The PHP module GD is missing')
) )
); );
$requirements->addOptional( $requirements->addOptional(
t('PHP Module: PDO-MySQL'), mt('setup', 'PHP Module: PDO-MySQL'),
t('Is Icinga Web 2 supposed to access a MySQL database the PDO-MySQL module for PHP is required.'), mt(
'setup',
'Is Icinga Web 2 supposed to access a MySQL database the PDO-MySQL module for PHP is required.'
),
Platform::extensionLoaded('mysql'), Platform::extensionLoaded('mysql'),
Platform::extensionLoaded('mysql') ? t('The PHP module PDO-MySQL is available.') : ( Platform::extensionLoaded('mysql') ? mt('setup', 'The PHP module PDO-MySQL is available.') : (
t('The PHP module PDO-MySQL is missing.') mt('setup', 'The PHP module PDO-MySQL is missing.')
) )
); );
$requirements->addOptional( $requirements->addOptional(
t('PHP Module: PDO-PostgreSQL'), mt('setup', 'PHP Module: PDO-PostgreSQL'),
t( mt(
'setup',
'Is Icinga Web 2 supposed to access a PostgreSQL database' 'Is Icinga Web 2 supposed to access a PostgreSQL database'
. ' the PDO-PostgreSQL module for PHP is required.' . ' the PDO-PostgreSQL module for PHP is required.'
), ),
Platform::extensionLoaded('pgsql'), Platform::extensionLoaded('pgsql'),
Platform::extensionLoaded('pgsql') ? t('The PHP module PDO-PostgreSQL is available.') : ( Platform::extensionLoaded('pgsql') ? mt('setup', 'The PHP module PDO-PostgreSQL is available.') : (
t('The PHP module PDO-PostgreSQL is missing.') mt('setup', 'The PHP module PDO-PostgreSQL is missing.')
) )
); );
// TODO(7464): Re-enable or remove this entirely once a decision has been made regarding shipping Zend with Iw2 // TODO(7464): Re-enable or remove this entirely once a decision has been made regarding shipping Zend with Iw2
/*$mysqlAdapterFound = Platform::zendClassExists('Zend_Db_Adapter_Pdo_Mysql'); /*$mysqlAdapterFound = Platform::zendClassExists('Zend_Db_Adapter_Pdo_Mysql');
$requirements->addOptional( $requirements->addOptional(
t('Zend Database Adapter For MySQL'), mt('setup', 'Zend Database Adapter For MySQL'),
t('The Zend database adapter for MySQL is required to access a MySQL database.'), mt('setup', 'The Zend database adapter for MySQL is required to access a MySQL database.'),
$mysqlAdapterFound, $mysqlAdapterFound,
$mysqlAdapterFound ? t('The Zend database adapter for MySQL is available.') : ( $mysqlAdapterFound ? mt('setup', 'The Zend database adapter for MySQL is available.') : (
t('The Zend database adapter for MySQL is missing.') mt('setup', 'The Zend database adapter for MySQL is missing.')
) )
); );
$pgsqlAdapterFound = Platform::zendClassExists('Zend_Db_Adapter_Pdo_Pgsql'); $pgsqlAdapterFound = Platform::zendClassExists('Zend_Db_Adapter_Pdo_Pgsql');
$requirements->addOptional( $requirements->addOptional(
t('Zend Database Adapter For PostgreSQL'), mt('setup', 'Zend Database Adapter For PostgreSQL'),
t('The Zend database adapter for PostgreSQL is required to access a PostgreSQL database.'), mt('setup', 'The Zend database adapter for PostgreSQL is required to access a PostgreSQL database.'),
$pgsqlAdapterFound, $pgsqlAdapterFound,
$pgsqlAdapterFound ? t('The Zend database adapter for PostgreSQL is available.') : ( $pgsqlAdapterFound ? mt('setup', 'The Zend database adapter for PostgreSQL is available.') : (
t('The Zend database adapter for PostgreSQL is missing.') mt('setup', 'The Zend database adapter for PostgreSQL is missing.')
) )
);*/ );*/
$configDir = $this->getConfigDir(); $configDir = $this->getConfigDir();
$requirements->addMandatory( $requirements->addMandatory(
t('Writable Config Directory'), mt('setup', 'Writable Config Directory'),
t( mt(
'setup',
'The Icinga Web 2 configuration directory defaults to "/etc/icingaweb", if' . 'The Icinga Web 2 configuration directory defaults to "/etc/icingaweb", if' .
' not explicitly set in the environment variable "ICINGAWEB_CONFIGDIR".' ' not explicitly set in the environment variable "ICINGAWEB_CONFIGDIR".'
), ),
is_writable($configDir), is_writable($configDir),
sprintf( sprintf(
is_writable($configDir) ? t('The current configuration directory is writable: %s') : ( is_writable($configDir) ? mt('setup', 'The current configuration directory is writable: %s') : (
t('The current configuration directory is not writable: %s') mt('setup', 'The current configuration directory is not writable: %s')
), ),
$configDir $configDir
) )