From b38ebc503ea0843a5930b684eba5cbbdc057c90d Mon Sep 17 00:00:00 2001 From: El RIDO Date: Thu, 7 Jan 2021 21:16:03 +0100 Subject: [PATCH] plural rules and documenting newly added languages --- CHANGELOG.md | 1 + CREDITS.md | 4 +++- js/privatebin.js | 6 +++++- lib/I18n.php | 4 ++++ tpl/bootstrap.php | 2 +- tpl/page.php | 2 +- 6 files changed, 15 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5f566937..8e8b8eb6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # PrivateBin version history * **1.4 (not yet released)** + * ADDED: Translation for Hebrew and Lithuanian * CHANGED: Upgrading libraries to: DOMpurify 2.0.14 * **1.3.4 (2020-03-22)** * CHANGED: Minimum required PHP version is 5.6, due to a change in the identicon library and to use php's native hash_equals() diff --git a/CREDITS.md b/CREDITS.md index fec83fa0..ec593035 100644 --- a/CREDITS.md +++ b/CREDITS.md @@ -45,4 +45,6 @@ Sébastien Sauvage - original idea and main developer * Péter Tabajdi - Hungarian * info-path - Czech * BigWax - Bulgarian -* AndriiZ - Ukrainian \ No newline at end of file +* AndriiZ - Ukrainian +* Yaron Shahrabani - Hebrew +* Moo - Lithuanian diff --git a/js/privatebin.js b/js/privatebin.js index a230ec19..20e8c5e8 100644 --- a/js/privatebin.js +++ b/js/privatebin.js @@ -601,7 +601,7 @@ jQuery.PrivateBin = (function($, RawDeflate) { * @prop {string[]} * @readonly */ - const supportedLanguages = ['bg', 'cs', 'de', 'es', 'fr', 'it', 'hu', 'no', 'nl', 'pl', 'pt', 'oc', 'ru', 'sl', 'uk', 'zh']; + const supportedLanguages = ['bg', 'cs', 'de', 'es', 'fr', 'he', 'hu', 'it', 'lt', 'no', 'nl', 'pl', 'pt', 'oc', 'ru', 'sl', 'uk', 'zh']; /** * built in language @@ -782,6 +782,10 @@ jQuery.PrivateBin = (function($, RawDeflate) { case 'oc': case 'zh': return n > 1 ? 1 : 0; + case 'he': + return n === 1 ? 0 : (n === 2 ? 1 : ((n < 0 || n > 10) && (n % 10 === 0) ? 2 : 3)); + case 'lt': + return n % 10 === 1 && n % 100 !== 11 ? 0 : ((n % 10 >= 2 && n % 100 < 10 || n % 100 >= 20) ? 1 : 2); case 'pl': return n === 1 ? 0 : (n % 10 >= 2 && n %10 <=4 && (n % 100 < 10 || n % 100 >= 20) ? 1 : 2); case 'ru': diff --git a/lib/I18n.php b/lib/I18n.php index aa68df9c..f9fbd6ea 100644 --- a/lib/I18n.php +++ b/lib/I18n.php @@ -321,6 +321,10 @@ class I18n case 'oc': case 'zh': return $n > 1 ? 1 : 0; + case 'he': + return $n === 1 ? 0 : ($n === 2 ? 1 : (($n < 0 || $n > 10) && ($n % 10 === 0) ? 2 : 3)); + case 'lt': + return $n % 10 === 1 && $n % 100 !== 11 ? 0 : (($n % 10 >= 2 && $n % 100 < 10 || $n % 100 >= 20) ? 1 : 2); case 'pl': return $n == 1 ? 0 : ($n % 10 >= 2 && $n % 10 <= 4 && ($n % 100 < 10 || $n % 100 >= 20) ? 1 : 2); case 'ru': diff --git a/tpl/bootstrap.php b/tpl/bootstrap.php index 37032fbd..e171e9ef 100644 --- a/tpl/bootstrap.php +++ b/tpl/bootstrap.php @@ -72,7 +72,7 @@ endif; ?> - + diff --git a/tpl/page.php b/tpl/page.php index f960557b..2e0c385e 100644 --- a/tpl/page.php +++ b/tpl/page.php @@ -50,7 +50,7 @@ endif; ?> - +