From fe37b7f0e51350383a6d3ac71fc9afbb3eabfd15 Mon Sep 17 00:00:00 2001 From: El RIDO Date: Tue, 1 Aug 2023 14:00:45 +0200 Subject: [PATCH] enable & credit Japanese & Arabic translations --- CHANGELOG.md | 1 + CREDITS.md | 2 ++ js/privatebin.js | 5 ++++- lib/I18n.php | 3 +++ 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 90067847..1619fe0c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # PrivateBin version history * **1.6.0 (not yet released)** + * ADDED: Translations for Japanese & Arabic * CHANGED: Minimum required PHP version is 7.3, due to upgrading PHPunit (#707) * **1.5.2 (2023-07-09)** * ADDED: Allow AWS SDK to use default credential provider chain for S3Storage (#1070) diff --git a/CREDITS.md b/CREDITS.md index c07b2ee2..59e7892f 100644 --- a/CREDITS.md +++ b/CREDITS.md @@ -63,3 +63,5 @@ * Stevo984 - Slovak * Christos Karamolegkos - Greek * jaideejung007 - Thai +* Nicolas Le Gall - Japanese +* lazerns - Arabic diff --git a/js/privatebin.js b/js/privatebin.js index e0ec5634..bad47cd5 100644 --- a/js/privatebin.js +++ b/js/privatebin.js @@ -627,7 +627,7 @@ jQuery.PrivateBin = (function($, RawDeflate) { * @prop {string[]} * @readonly */ - const supportedLanguages = ['bg', 'ca', 'co', 'cs', 'de', 'el', 'es', 'et', 'fi', 'fr', 'he', 'hu', 'id', 'it', 'jbo', 'lt', 'no', 'nl', 'pl', 'pt', 'oc', 'ru', 'sk', 'sl', 'th', 'tr', 'uk', 'zh']; + const supportedLanguages = ['ar', 'bg', 'ca', 'co', 'cs', 'de', 'el', 'es', 'et', 'fi', 'fr', 'he', 'hu', 'id', 'it', 'ja', 'jbo', 'lt', 'no', 'nl', 'pl', 'pt', 'oc', 'ru', 'sk', 'sl', 'th', 'tr', 'uk', 'zh']; /** * built in language @@ -802,6 +802,8 @@ jQuery.PrivateBin = (function($, RawDeflate) { me.getPluralForm = function(n) { switch (language) { + case 'ar': + return n === 0 ? 0 : (n === 1 ? 1 : (n === 2 ? 2 : (n % 100 >= 3 && n % 100 <= 10 ? 3 : (n % 100 >= 11 ? 4 : 5)))); case 'cs': case 'sk': return n === 1 ? 0 : (n >= 2 && n <= 4 ? 1 : 2); @@ -814,6 +816,7 @@ jQuery.PrivateBin = (function($, RawDeflate) { case 'he': return n === 1 ? 0 : (n === 2 ? 1 : ((n < 0 || n > 10) && (n % 10 === 0) ? 2 : 3)); case 'id': + case 'ja': case 'jbo': case 'th': return 0; diff --git a/lib/I18n.php b/lib/I18n.php index 8df94553..9acea5fd 100644 --- a/lib/I18n.php +++ b/lib/I18n.php @@ -315,6 +315,8 @@ class I18n protected static function _getPluralForm($n) { switch (self::$_language) { + case 'ar': + return $n === 0 ? 0 : ($n === 1 ? 1 : ($n === 2 ? 2 : ($n % 100 >= 3 && $n % 100 <= 10 ? 3 : ($n % 100 >= 11 ? 4 : 5)))); case 'cs': case 'sk': return $n === 1 ? 0 : ($n >= 2 && $n <= 4 ? 1 : 2); @@ -327,6 +329,7 @@ class I18n case 'he': return $n === 1 ? 0 : ($n === 2 ? 1 : (($n < 0 || $n > 10) && ($n % 10 === 0) ? 2 : 3)); case 'id': + case 'ja': case 'jbo': case 'th': return 0;