From 65b70777561cb62743655483a16e64626ef21c1a Mon Sep 17 00:00:00 2001 From: Andriy Zhuk Date: Fri, 18 Oct 2019 12:31:40 +0300 Subject: [PATCH] Added plural rules for ukrainian --- js/privatebin.js | 4 +++- lib/I18n.php | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/js/privatebin.js b/js/privatebin.js index d411ebbe..218bafd4 100644 --- a/js/privatebin.js +++ b/js/privatebin.js @@ -433,7 +433,7 @@ jQuery.PrivateBin = (function($, RawDeflate) { * @prop {string[]} * @readonly */ - const supportedLanguages = ['bg', 'cs', 'de', 'es', 'fr', 'it', 'hu', 'no', 'nl', 'pl', 'pt', 'oc', 'ru', 'sl', 'zh']; + const supportedLanguages = ['bg', 'cs', 'de', 'es', 'fr', 'it', 'hu', 'no', 'nl', 'pl', 'pt', 'oc', 'ru', 'sl', 'uk', 'zh']; /** * built in language @@ -591,6 +591,8 @@ jQuery.PrivateBin = (function($, RawDeflate) { return n === 1 ? 0 : (n % 10 >= 2 && n %10 <=4 && (n % 100 < 10 || n % 100 >= 20) ? 1 : 2); case 'ru': return n % 10 === 1 && n % 100 !== 11 ? 0 : (n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 10 || n % 100 >= 20) ? 1 : 2); + case 'uk': + return n % 10 === 1 && n % 100 !== 11 ? 0 : (n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 10 || n % 100 >= 20) ? 1 : 2); case 'sl': return n % 100 === 1 ? 1 : (n % 100 === 2 ? 2 : (n % 100 === 3 || n % 100 === 4 ? 3 : 0)); // bg, de, en, es, hu, it, nl, no, pt diff --git a/lib/I18n.php b/lib/I18n.php index e7dbfcea..7bc674b2 100644 --- a/lib/I18n.php +++ b/lib/I18n.php @@ -304,6 +304,8 @@ class I18n return $n == 1 ? 0 : ($n % 10 >= 2 && $n % 10 <= 4 && ($n % 100 < 10 || $n % 100 >= 20) ? 1 : 2); case 'ru': return $n % 10 == 1 && $n % 100 != 11 ? 0 : ($n % 10 >= 2 && $n % 10 <= 4 && ($n % 100 < 10 || $n % 100 >= 20) ? 1 : 2); + case 'uk': + return $n % 10 == 1 && $n % 100 != 11 ? 0 : ($n % 10 >= 2 && $n % 10 <= 4 && ($n % 100 < 10 || $n % 100 >= 20) ? 1 : 2); case 'sl': return $n % 100 == 1 ? 1 : ($n % 100 == 2 ? 2 : ($n % 100 == 3 || $n % 100 == 4 ? 3 : 0)); // bg, de, en, es, hu, it, nl, no, pt