From 3b0462271d37c948bfac43132aa3e49f2197b5d7 Mon Sep 17 00:00:00 2001 From: Ryan Cramer Date: Mon, 10 Jul 2023 09:33:27 -0400 Subject: [PATCH] Update for processwire/processwire-issues#1757 --- wire/core/LanguageFunctions.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/wire/core/LanguageFunctions.php b/wire/core/LanguageFunctions.php index 4a0fb01e..d261d7b2 100644 --- a/wire/core/LanguageFunctions.php +++ b/wire/core/LanguageFunctions.php @@ -285,12 +285,11 @@ function _x($text, $context, $textdomain = null) { */ function _n($textSingular, $textPlural, $count, $textdomain = null) { $count = (int) $count; - $value = $count === 1 ? __($textSingular, $textdomain) : __($textPlural, $textdomain); - if($count === 0 && $value !== $textPlural && wire()->languages) { + if($count === 0 && wire()->languages) { $plural = __('0-plural', 'common'); - if(strtolower($plural) === '0-singular') { - $value = __($textSingular, $textdomain); - } + $value = strtolower($plural) === '0-singular' ? __($textSingular, $textdomain) : __($textPlural, $textdomain); + } else { + $value = $count === 1 ? __($textSingular, $textdomain) : __($textPlural, $textdomain); } return $value; }