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

@ -215,7 +215,7 @@ class NavigationConfigForm extends ConfigForm
foreach ($this->getShareConfig($type) as $sectionName => $sectionConfig) {
if ($sectionName !== $this->itemToLoad
&& $sectionConfig->owner === ($owner ?: $this->getUser()->getUsername())
&& !in_array($sectionName, $children, true)
&& ! in_array($sectionName, $children, true)
) {
$names[] = $sectionName;
}
@ -223,7 +223,7 @@ class NavigationConfigForm extends ConfigForm
foreach ($this->getUserConfig($type) as $sectionName => $sectionConfig) {
if ($sectionName !== $this->itemToLoad
&& !in_array($sectionName, $children, true)
&& ! in_array($sectionName, $children, true)
) {
$names[] = $sectionName;
}
@ -363,8 +363,8 @@ class NavigationConfigForm extends ConfigForm
$shared = false;
if ($this->hasBeenShared($name)) {
if (isset($data['parent']) && $data['parent']
? !$this->hasBeenShared($data['parent'])
: ((! isset($data['users']) || !$data['users']) && (! isset($data['groups']) || !$data['groups']))
? ! $this->hasBeenShared($data['parent'])
: ((! isset($data['users']) || ! $data['users']) && (! isset($data['groups']) || ! $data['groups']))
) {
// It is shared but shouldn't anymore
$config = $this->unshare($name, isset($data['parent']) ? $data['parent'] : null);
@ -579,7 +579,7 @@ class NavigationConfigForm extends ConfigForm
)
);
if ((! $itemForm->requiresParentSelection() || !isset($formData['parent']) || !$formData['parent'])
if ((! $itemForm->requiresParentSelection() || ! isset($formData['parent']) || ! $formData['parent'])
&& $this->getUser()->can('application/share/navigation')
) {
$checked = isset($formData['shared']) ? null : (isset($formData['users']) || isset($formData['groups']));
@ -719,10 +719,12 @@ class NavigationConfigForm extends ConfigForm
if (! empty($forbiddenUsers)) {
$valid = false;
$this->getElement('users')->addError(
$this->translate(sprintf(
'You are not permitted to share this navigation item with the following users: %s',
sprintf(
$this->translate(
'You are not permitted to share this navigation item with the following users: %s'
),
implode(', ', $forbiddenUsers)
))
)
);
}
}
@ -741,10 +743,12 @@ class NavigationConfigForm extends ConfigForm
if (! empty($forbiddenGroups)) {
$valid = false;
$this->getElement('groups')->addError(
$this->translate(sprintf(
'You are not permitted to share this navigation item with the following groups: %s',
sprintf(
$this->translate(
'You are not permitted to share this navigation item with the following groups: %s'
),
implode(', ', $forbiddenGroups)
))
)
);
}
}

View File

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

View File

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

View File

@ -141,22 +141,22 @@ class DbResourcePage extends Form
if ($this->getValue('db') === 'pgsql') {
if ($connectionError !== null) {
$this->warning($this->translate(sprintf(
'Unable to check the server\'s version. This is usually not a critical error as there is'
. ' probably only access to the database permitted which does not exist yet. If you are'
$this->warning(sprintf(
$this->translate('Unable to check the server\'s version. This is usually not a critical error'
. ' 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,'
. ' 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()
)));
));
$state = false;
} else {
$version = $db->getServerVersion();
if (version_compare($version, '9.1', '<')) {
$this->error($this->translate(sprintf(
'The server\'s version %s is too old. The minimum required version is %s.',
$this->error(sprintf(
$this->translate('The server\'s version %s is too old. The minimum required version is %s.'),
$version,
'9.1'
)));
));
$state = false;
}
}