Fix incorrect uses of translation around sprintf

This commit is contained in:
Markus Frosch 2017-11-09 14:17:46 +01:00 committed by Johannes Meyer
parent 67e207f781
commit 2493cb8d63
4 changed files with 27 additions and 23 deletions

View File

@ -719,10 +719,12 @@ class NavigationConfigForm extends ConfigForm
if (! empty($forbiddenUsers)) { if (! empty($forbiddenUsers)) {
$valid = false; $valid = false;
$this->getElement('users')->addError( $this->getElement('users')->addError(
$this->translate(sprintf( sprintf(
'You are not permitted to share this navigation item with the following users: %s', $this->translate(
'You are not permitted to share this navigation item with the following users: %s'
),
implode(', ', $forbiddenUsers) implode(', ', $forbiddenUsers)
)) )
); );
} }
} }
@ -741,10 +743,12 @@ class NavigationConfigForm extends ConfigForm
if (! empty($forbiddenGroups)) { if (! empty($forbiddenGroups)) {
$valid = false; $valid = false;
$this->getElement('groups')->addError( $this->getElement('groups')->addError(
$this->translate(sprintf( sprintf(
'You are not permitted to share this navigation item with the following groups: %s', $this->translate(
'You are not permitted to share this navigation item with the following groups: %s'
),
implode(', ', $forbiddenGroups) implode(', ', $forbiddenGroups)
)) )
); );
} }
} }

View File

@ -332,7 +332,7 @@ EOT;
$caption = t('Content'); $caption = t('Content');
} }
$label = t(sprintf('Refresh the %s', $caption)); $label = sprintf(t('Refresh the %s'), $caption);
$title = $label; $title = $label;
$tpl = str_replace( $tpl = str_replace(

View File

@ -158,11 +158,11 @@ class IdoResourcePage extends Form
$db = new DbTool($this->getValues()); $db = new DbTool($this->getValues());
$version = $db->connectToDb()->getServerVersion(); $version = $db->connectToDb()->getServerVersion();
if (version_compare($version, '9.1', '<')) { if (version_compare($version, '9.1', '<')) {
$this->error($this->translate(sprintf( $this->error(sprintf(
'The server\'s version %s is too old. The minimum required version is %s.', $this->translate('The server\'s version %s is too old. The minimum required version is %s.'),
$version, $version,
'9.1' '9.1'
))); ));
return false; return false;
} }
} }

View File

@ -141,22 +141,22 @@ class DbResourcePage extends Form
if ($this->getValue('db') === 'pgsql') { if ($this->getValue('db') === 'pgsql') {
if ($connectionError !== null) { if ($connectionError !== null) {
$this->warning($this->translate(sprintf( $this->warning(sprintf(
'Unable to check the server\'s version. This is usually not a critical error as there is' $this->translate('Unable to check the server\'s version. This is usually not a critical error'
. ' probably only access to the database permitted which does not exist yet. If you are' . ' as there is probably only access to the database permitted which does not exist yet. If you are'
. ' absolutely sure you are running PostgreSQL in a version equal to or newer than 9.1,' . ' absolutely sure you are running PostgreSQL in a version equal to or newer than 9.1,'
. ' you can skip the validation and safely proceed to the next step. The error was: %s', . ' you can skip the validation and safely proceed to the next step. The error was: %s'),
$connectionError->getMessage() $connectionError->getMessage()
))); ));
$state = false; $state = false;
} else { } else {
$version = $db->getServerVersion(); $version = $db->getServerVersion();
if (version_compare($version, '9.1', '<')) { if (version_compare($version, '9.1', '<')) {
$this->error($this->translate(sprintf( $this->error(sprintf(
'The server\'s version %s is too old. The minimum required version is %s.', $this->translate('The server\'s version %s is too old. The minimum required version is %s.'),
$version, $version,
'9.1' '9.1'
))); ));
$state = false; $state = false;
} }
} }