Replace t() and mt() with translate() in setup module's forms

refs #7551
This commit is contained in:
Johannes Meyer 2015-01-19 11:07:39 +01:00
parent 970006838c
commit 8c87a9df13
11 changed files with 69 additions and 82 deletions

View File

@ -74,16 +74,15 @@ class AdminAccountPage extends Form
$choices = array();
if ($this->backendConfig['backend'] !== 'db') {
$choices['by_name'] = mt('setup', 'By Name', 'setup.admin');
$choices['by_name'] = $this->translate('By Name', 'setup.admin');
$this->addElement(
'text',
'by_name',
array(
'required' => isset($formData['user_type']) && $formData['user_type'] === 'by_name',
'value' => $this->getUsername(),
'label' => mt('setup', 'Username'),
'description' => mt(
'setup',
'label' => $this->translate('Username'),
'description' => $this->translate(
'Define the initial administrative account by providing a username that reflects'
. ' a user created later or one that is authenticated using external mechanisms'
)
@ -94,21 +93,20 @@ class AdminAccountPage extends Form
if ($this->backendConfig['backend'] === 'db' || $this->backendConfig['backend'] === 'ldap') {
$users = $this->fetchUsers();
if (false === empty($users)) {
$choices['existing_user'] = mt('setup', 'Existing User');
$choices['existing_user'] = $this->translate('Existing User');
$this->addElement(
'select',
'existing_user',
array(
'required' => isset($formData['user_type']) && $formData['user_type'] === 'existing_user',
'label' => mt('setup', 'Username'),
'label' => $this->translate('Username'),
'description' => sprintf(
mt(
'setup',
$this->translate(
'Choose a user reported by the %s backend as the initial administrative account',
'setup.admin'
),
$this->backendConfig['backend'] === 'db'
? mt('setup', 'database', 'setup.admin.authbackend')
? $this->translate('database', 'setup.admin.authbackend')
: 'LDAP'
),
'multiOptions' => array_combine($users, $users)
@ -118,16 +116,15 @@ class AdminAccountPage extends Form
}
if ($this->backendConfig['backend'] === 'db') {
$choices['new_user'] = mt('setup', 'New User');
$choices['new_user'] = $this->translate('New User');
$required = isset($formData['user_type']) && $formData['user_type'] === 'new_user';
$this->addElement(
'text',
'new_user',
array(
'required' => $required,
'label' => mt('setup', 'Username'),
'description' => mt(
'setup',
'label' => $this->translate('Username'),
'description' => $this->translate(
'Enter the username to be used when creating an initial administrative account'
)
)
@ -137,8 +134,8 @@ class AdminAccountPage extends Form
'new_user_password',
array(
'required' => $required,
'label' => mt('setup', 'Password'),
'description' => mt('setup', 'Enter the password to assign to the newly created account')
'label' => $this->translate('Password'),
'description' => $this->translate('Enter the password to assign to the newly created account')
)
);
$this->addElement(
@ -146,8 +143,8 @@ class AdminAccountPage extends Form
'new_user_2ndpass',
array(
'required' => $required,
'label' => mt('setup', 'Repeat password'),
'description' => mt('setup', 'Please repeat the password given above to avoid typing errors'),
'label' => $this->translate('Repeat password'),
'description' => $this->translate('Please repeat the password given above to avoid typing errors'),
'validators' => array(
array('identical', false, array('new_user_password'))
)
@ -179,7 +176,7 @@ class AdminAccountPage extends Form
'note',
'title',
array(
'value' => mt('setup', 'Administration', 'setup.page.title'),
'value' => $this->translate('Administration', 'setup.page.title'),
'decorators' => array(
'ViewHelper',
array('HtmlTag', array('tag' => 'h2'))
@ -215,7 +212,7 @@ class AdminAccountPage extends Form
}
if ($data['user_type'] === 'new_user' && array_search($data['new_user'], $this->fetchUsers()) !== false) {
$this->getElement('new_user')->addError(mt('setup', 'Username already exists.'));
$this->getElement('new_user')->addError($this->translate('Username already exists.'));
return false;
}

View File

@ -62,7 +62,7 @@ class AuthBackendPage extends Form
'note',
'title',
array(
'value' => mt('setup', 'Authentication Backend', 'setup.page.title'),
'value' => $this->translate('Authentication Backend', 'setup.page.title'),
'decorators' => array(
'ViewHelper',
array('HtmlTag', array('tag' => 'h2'))
@ -71,20 +71,17 @@ class AuthBackendPage extends Form
);
if ($this->config['type'] === 'db') {
$note = mt(
'setup',
$note = $this->translate(
'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.'
);
} elseif ($this->config['type'] === 'ldap') {
$note = mt(
'setup',
$note = $this->translate(
'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.'
);
} else { // if ($this->config['type'] === 'autologin'
$note = mt(
'setup',
$note = $this->translate(
'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.'
);
@ -150,8 +147,8 @@ class AuthBackendPage extends Form
'order' => 2,
'ignore' => true,
'required' => true,
'label' => mt('setup', 'Skip Validation'),
'description' => mt('setup', 'Check this to not to validate authentication using this backend')
'label' => $this->translate('Skip Validation'),
'description' => $this->translate('Check this to not to validate authentication using this backend')
)
);
}

View File

@ -29,7 +29,7 @@ class AuthenticationPage extends Form
'note',
'title',
array(
'value' => mt('setup', 'Authentication', 'setup.page.title'),
'value' => $this->translate('Authentication', 'setup.page.title'),
'decorators' => array(
'ViewHelper',
array('HtmlTag', array('tag' => 'h2'))
@ -40,8 +40,7 @@ class AuthenticationPage extends Form
'note',
'description',
array(
'value' => mt(
'setup',
'value' => $this->translate(
'Please choose how you want to authenticate when accessing Icinga Web 2.'
. ' Configuring backend specific details follows in a later step.'
)
@ -50,20 +49,20 @@ class AuthenticationPage extends Form
$backendTypes = array();
if (Platform::hasMysqlSupport() || Platform::hasPostgresqlSupport()) {
$backendTypes['db'] = t('Database');
$backendTypes['db'] = $this->translate('Database');
}
if (Platform::extensionLoaded('ldap')) {
$backendTypes['ldap'] = 'LDAP';
}
$backendTypes['autologin'] = t('Autologin');
$backendTypes['autologin'] = $this->translate('Autologin');
$this->addElement(
'select',
'type',
array(
'required' => true,
'label' => mt('setup', 'Authentication Type'),
'description' => mt('setup', 'The type of authentication to use when accessing Icinga Web 2'),
'label' => $this->translate('Authentication Type'),
'description' => $this->translate('The type of authentication to use when accessing Icinga Web 2'),
'multiOptions' => $backendTypes
)
);

View File

@ -90,7 +90,7 @@ class DatabaseCreationPage extends Form
'note',
'title',
array(
'value' => mt('setup', 'Database Setup', 'setup.page.title'),
'value' => $this->translate('Database Setup', 'setup.page.title'),
'decorators' => array(
'ViewHelper',
array('HtmlTag', array('tag' => 'h2'))
@ -101,8 +101,7 @@ class DatabaseCreationPage extends Form
'note',
'description',
array(
'value' => mt(
'setup',
'value' => $this->translate(
'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 '
. 'be operated by Icinga Web 2. Please provide appropriate access credentials to solve this.'
@ -116,16 +115,16 @@ class DatabaseCreationPage extends Form
'username',
array(
'required' => false === $skipValidation,
'label' => mt('setup', 'Username'),
'description' => mt('setup', 'A user which is able to create databases and/or touch the database schema')
'label' => $this->translate('Username'),
'description' => $this->translate('A user which is able to create databases and/or touch the database schema')
)
);
$this->addElement(
'password',
'password',
array(
'label' => mt('setup', 'Password'),
'description' => mt('setup', 'The password for the database user defined above')
'label' => $this->translate('Password'),
'description' => $this->translate('The password for the database user defined above')
)
);
@ -182,7 +181,7 @@ class DatabaseCreationPage extends Form
// form need to be granted to create databases, users...
if (false === $db->checkPrivileges($this->databaseSetupPrivileges)) {
$this->addError(
mt('setup', 'The provided credentials cannot be used to create the database and/or the user.')
$this->translate('The provided credentials cannot be used to create the database and/or the user.')
);
$this->addSkipValidationCheckbox();
return false;
@ -191,8 +190,7 @@ class DatabaseCreationPage extends Form
// ...and to grant all required usage privileges to others
if (false === $db->isGrantable($this->databaseUsagePrivileges)) {
$this->addError(sprintf(
mt(
'setup',
$this->translate(
'The provided credentials cannot be used to grant all required privileges to the login "%s".'
),
$this->config['username']
@ -215,9 +213,8 @@ class DatabaseCreationPage extends Form
array(
'order' => 2,
'required' => true,
'label' => mt('setup', 'Skip Validation'),
'description' => mt(
'setup',
'label' => $this->translate('Skip Validation'),
'description' => $this->translate(
'Check this to not to validate the ability to login and required privileges'
)
)

View File

@ -39,7 +39,7 @@ class DbResourcePage extends Form
'note',
'title',
array(
'value' => mt('setup', 'Database Resource', 'setup.page.title'),
'value' => $this->translate('Database Resource', 'setup.page.title'),
'decorators' => array(
'ViewHelper',
array('HtmlTag', array('tag' => 'h2'))
@ -50,8 +50,7 @@ class DbResourcePage extends Form
'note',
'description',
array(
'value' => mt(
'setup',
'value' => $this->translate(
'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.'
)
@ -121,8 +120,10 @@ class DbResourcePage extends Form
'skip_validation',
array(
'required' => true,
'label' => mt('setup', 'Skip Validation'),
'description' => mt('setup', 'Check this to not to validate connectivity with the given database server')
'label' => $this->translate('Skip Validation'),
'description' => $this->translate(
'Check this to not to validate connectivity with the given database server'
)
)
);
}

View File

@ -29,7 +29,7 @@ class GeneralConfigPage extends Form
'note',
'title',
array(
'value' => mt('setup', 'Application Configuration', 'setup.page.title'),
'value' => $this->translate('Application Configuration', 'setup.page.title'),
'decorators' => array(
'ViewHelper',
array('HtmlTag', array('tag' => 'h2'))
@ -40,8 +40,7 @@ class GeneralConfigPage extends Form
'note',
'description',
array(
'value' => mt(
'setup',
'value' => $this->translate(
'Now please adjust all application and logging related configuration options to fit your needs.'
)
)

View File

@ -82,7 +82,7 @@ EOT;
'note',
'title',
array(
'value' => mt('setup', 'LDAP Discovery Results', 'setup.page.title'),
'value' => $this->translate('LDAP Discovery Results', 'setup.page.title'),
'decorators' => array(
'ViewHelper',
array('HtmlTag', array('tag' => 'h2'))
@ -94,7 +94,7 @@ EOT;
'description',
array(
'value' => sprintf(
mt('setup', 'The following directory service has been found on domain "%s":'),
$this->translate('The following directory service has been found on domain "%s":'),
$this->config['domain']
)
)
@ -119,7 +119,7 @@ EOT;
'confirm',
array(
'value' => '1',
'label' => mt('setup', 'Use this configuration?')
'label' => $this->translate('Use this configuration?')
)
);
}

View File

@ -36,7 +36,7 @@ class LdapDiscoveryPage extends Form
'note',
'title',
array(
'value' => mt('setup', 'LDAP Discovery', 'setup.page.title'),
'value' => $this->translate('LDAP Discovery', 'setup.page.title'),
'decorators' => array(
'ViewHelper',
array('HtmlTag', array('tag' => 'h2'))
@ -47,8 +47,7 @@ class LdapDiscoveryPage extends Form
'note',
'description',
array(
'value' => mt(
'setup',
'value' => $this->translate(
'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.'
)
@ -66,8 +65,8 @@ class LdapDiscoveryPage extends Form
'skip_validation',
array(
'required' => true,
'label' => mt('setup', 'Skip'),
'description' => mt('setup', 'Do not discover LDAP servers and enter all settings manually.')
'label' => $this->translate('Skip'),
'description' => $this->translate('Do not discover LDAP servers and enter all settings manually.')
)
);
}
@ -94,7 +93,9 @@ class LdapDiscoveryPage extends Form
return true;
}
}
$this->addError(sprintf(t('Could not find any LDAP servers on the domain "%s".'), $data['domain']));
$this->addError(
sprintf($this->translate('Could not find any LDAP servers on the domain "%s".'), $data['domain'])
);
return false;
}

View File

@ -37,7 +37,7 @@ class LdapResourcePage extends Form
'note',
'title',
array(
'value' => mt('setup', 'LDAP Resource', 'setup.page.title'),
'value' => $this->translate('LDAP Resource', 'setup.page.title'),
'decorators' => array(
'ViewHelper',
array('HtmlTag', array('tag' => 'h2'))
@ -48,8 +48,7 @@ class LdapResourcePage extends Form
'note',
'description',
array(
'value' => mt(
'setup',
'value' => $this->translate(
'Now please configure your AD/LDAP resource. This will later '
. 'be used to authenticate users logging in to Icinga Web 2.'
)
@ -107,9 +106,8 @@ class LdapResourcePage extends Form
'skip_validation',
array(
'required' => true,
'label' => mt('setup', 'Skip Validation'),
'description' => mt(
'setup',
'label' => $this->translate('Skip Validation'),
'description' => $this->translate(
'Check this to not to validate connectivity with the given directory service'
)
)

View File

@ -30,8 +30,7 @@ class PreferencesPage extends Form
$this->getElement('type')
->setValue('db')
->setDescription(
mt(
'setup',
$this->translate(
'Note that choosing "Database" causes Icinga Web 2 to use the same database as for authentication.'
)
);
@ -47,7 +46,7 @@ class PreferencesPage extends Form
'note',
'title',
array(
'value' => mt('setup', 'Preferences', 'setup.page.title'),
'value' => $this->translate('Preferences', 'setup.page.title'),
'decorators' => array(
'ViewHelper',
array('HtmlTag', array('tag' => 'h2'))
@ -58,23 +57,23 @@ class PreferencesPage extends Form
'note',
'description',
array(
'value' => mt('setup', 'Please choose how Icinga Web 2 should store user preferences.')
'value' => $this->translate('Please choose how Icinga Web 2 should store user preferences.')
)
);
$storageTypes = array();
$storageTypes['ini'] = t('File System (INI Files)');
$storageTypes['ini'] = $this->translate('File System (INI Files)');
if (Platform::hasMysqlSupport() || Platform::hasPostgresqlSupport()) {
$storageTypes['db'] = t('Database');
$storageTypes['db'] = $this->translate('Database');
}
$storageTypes['null'] = t('Don\'t Store Preferences');
$storageTypes['null'] = $this->translate('Don\'t Store Preferences');
$this->addElement(
'select',
'type',
array(
'required' => true,
'label' => t('User Preference Storage Type'),
'label' => $this->translate('User Preference Storage Type'),
'multiOptions' => $storageTypes
)
);

View File

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