mirror of
https://github.com/grocy/grocy.git
synced 2025-08-24 05:56:55 +00:00
Fixed an issue when a plural translation is empty/null (can be the case for quantity units, fixes #259)
This commit is contained in:
@@ -109,7 +109,7 @@ class LocalizationService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function __t(string $text, ...$placeholderValues)
|
public function __t($text, ...$placeholderValues)
|
||||||
{
|
{
|
||||||
$this->CheckAndAddMissingTranslationToPot($text);
|
$this->CheckAndAddMissingTranslationToPot($text);
|
||||||
|
|
||||||
@@ -123,14 +123,14 @@ class LocalizationService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function __n($number, string $singularForm, ?string $pluralForm)
|
public function __n($number, $singularForm, $pluralForm)
|
||||||
{
|
{
|
||||||
$this->CheckAndAddMissingTranslationToPot($singularForm);
|
$this->CheckAndAddMissingTranslationToPot($singularForm);
|
||||||
|
|
||||||
return sprintf($this->Translator->ngettext($singularForm, $pluralForm, $number), $number);
|
return sprintf($this->Translator->ngettext($singularForm, $pluralForm, $number), $number);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function CheckAndAddMissingTranslationToPot(string $text)
|
public function CheckAndAddMissingTranslationToPot($text)
|
||||||
{
|
{
|
||||||
if (GROCY_MODE === 'dev')
|
if (GROCY_MODE === 'dev')
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user