Skip to content

Commit

Permalink
PageGuide: fixed messages
Browse files Browse the repository at this point in the history
messages: updated messages
  • Loading branch information
[email protected] committed May 3, 2022
1 parent 55695c9 commit b562ce3
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 9 deletions.
4 changes: 3 additions & 1 deletion src/messages/en/model.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@
return [
'ID' => 'Id',
'Url' => 'Url page for guide',
'Rules' => 'Rules'
'Rules' => 'Rules',
'Rules not set' => 'At least one rule step must be set',
'Rules not valid' => 'Rule is not valid',
];
1 change: 0 additions & 1 deletion src/messages/en/view.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,4 @@
'next' => 'Next',
'skip' => 'Skip',
'done' => 'Done',
'Rules not set' => 'At least one rule step must be set'
];
4 changes: 3 additions & 1 deletion src/messages/it/model.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@
return [
'ID' => 'Id',
'Url' => 'Url della pagina per la guida',
'Rules' => 'Regole'
'Rules' => 'Regole',
'Rules not set' => 'Regola non impostata',
'Rules not valid' => 'Il formato della regola non è valido',
];
1 change: 0 additions & 1 deletion src/messages/it/view.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,4 @@
'next' => 'Successivo',
'skip' => 'Salta',
'done' => 'Fine',
'Rules not set' => 'Rules not set'
];
4 changes: 3 additions & 1 deletion src/messages/sk/model.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@
return [
'ID' => 'Id',
'Url' => 'Stránka návodu',
'Rules' => 'Pravidlá'
'Rules' => 'Pravidlá',
'Rules not set' => 'Musíte nastaviť aspoň jeden krok',
'Rules not valid' => 'Rule is not valid',
];
1 change: 0 additions & 1 deletion src/messages/sk/view.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,4 @@
'next' => 'Ďalej',
'skip' => 'Preskočiť',
'done' => 'Ukončiť',
'Rules not set' => 'Musíte nastaviť aspoň jeden krok'
];
6 changes: 3 additions & 3 deletions src/models/PageGuide.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function validateRuleFormat($attribute, $params, $validator): void
$this->rules = Json::decode($this->rules);
} catch (Exception $e) {
$this->rules = '{}';
$this->addError('rules', 'Invalid rule format');
$this->addError('rules', Yii::t('pageGuide/model', 'Rules not valid'));
return;
}
}
Expand All @@ -60,13 +60,13 @@ public function validateRuleFormat($attribute, $params, $validator): void
});
if (empty($this->rules)) {
$this->rules = '{}';
$this->addError('rules', Yii::t('pageGuide/view', 'Rules not set'));
$this->addError('rules', Yii::t('pageGuide/model', 'Rules not set'));
return;
}

foreach ($this->rules as $rule) {
if (!is_array($rule) || !isset($rule['step'], $rule['element'], $rule['intro'])) {
$this->addError('rules', Yii::t('pageGuide/view', 'Invalid rule format'));
$this->addError('rules', Yii::t('pageGuide/model', 'Rules not valid'));
break;
}
}
Expand Down

0 comments on commit b562ce3

Please sign in to comment.