From b61b4253a6f7332a36ec099e139f272252eb4bfd Mon Sep 17 00:00:00 2001 From: El RIDO Date: Thu, 29 Sep 2022 05:34:49 +0200 Subject: [PATCH 1/2] enabled use of Slovak translations --- CHANGELOG.md | 2 +- CREDITS.md | 1 + js/privatebin.js | 7 ++++--- lib/I18n.php | 11 ++++++----- tpl/bootstrap.php | 2 +- tpl/page.php | 2 +- 6 files changed, 14 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1343024c..efdcfa31 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ # PrivateBin version history * **1.4.1 (not yet released)** - * ADDED: Translations for Turkish + * ADDED: Translations for Turkish and Slovak * CHANGED: Avoid `SUPER` privilege for setting the `sql_mode` for MariaDB/MySQL (#919) * FIXED: Revert to CREATE INDEX without IF NOT EXISTS clauses, to support MySQL (#943) * FIXED: Apply table prefix to indexes as well, to support multiple instances sharing a single database (#943) diff --git a/CREDITS.md b/CREDITS.md index 1badfb9b..0498fe4a 100644 --- a/CREDITS.md +++ b/CREDITS.md @@ -57,3 +57,4 @@ * Patriccollu di Santa Maria è Sichè - Corsican * Markus Mikkonen - Finnish * Emir Ensar Rahmanlar - Turkish +* Stevo984 - Slovak \ No newline at end of file diff --git a/js/privatebin.js b/js/privatebin.js index 9eec6e09..04798da0 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', 'es', 'et', 'fi', 'fr', 'he', 'hu', 'id', 'it', 'jbo', 'lt', 'no', 'nl', 'pl', 'pt', 'oc', 'ru', 'sl', 'tr', 'uk', 'zh']; + const supportedLanguages = ['bg', 'ca', 'co', 'cs', 'de', 'es', 'et', 'fi', 'fr', 'he', 'hu', 'id', 'it', 'jbo', 'lt', 'no', 'nl', 'pl', 'pt', 'oc', 'ru', 'sk', 'sl', 'tr', 'uk', 'zh']; /** * built in language @@ -803,7 +803,8 @@ jQuery.PrivateBin = (function($, RawDeflate) { switch (language) { case 'cs': - return n === 1 ? 0 : (n >= 2 && n <=4 ? 1 : 2); + case 'sk': + return n === 1 ? 0 : (n >= 2 && n <= 4 ? 1 : 2); case 'co': case 'fr': case 'oc': @@ -818,7 +819,7 @@ jQuery.PrivateBin = (function($, RawDeflate) { 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); + return n === 1 ? 0 : (n % 10 >= 2 && n %10 <= 4 && (n % 100 < 10 || n % 100 >= 20) ? 1 : 2); case 'ru': case 'uk': return n % 10 === 1 && n % 100 !== 11 ? 0 : (n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 10 || n % 100 >= 20) ? 1 : 2); diff --git a/lib/I18n.php b/lib/I18n.php index 0d4734a3..7248c255 100644 --- a/lib/I18n.php +++ b/lib/I18n.php @@ -316,7 +316,8 @@ class I18n { switch (self::$_language) { case 'cs': - return $n == 1 ? 0 : ($n >= 2 && $n <= 4 ? 1 : 2); + case 'sk': + return $n === 1 ? 0 : ($n >= 2 && $n <= 4 ? 1 : 2); case 'co': case 'fr': case 'oc': @@ -331,15 +332,15 @@ class I18n 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); + return $n === 1 ? 0 : ($n % 10 >= 2 && $n % 10 <= 4 && ($n % 100 < 10 || $n % 100 >= 20) ? 1 : 2); case 'ru': case 'uk': - return $n % 10 == 1 && $n % 100 != 11 ? 0 : ($n % 10 >= 2 && $n % 10 <= 4 && ($n % 100 < 10 || $n % 100 >= 20) ? 1 : 2); + 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)); + return $n % 100 === 1 ? 1 : ($n % 100 === 2 ? 2 : ($n % 100 === 3 || $n % 100 === 4 ? 3 : 0)); // bg, ca, de, en, es, et, fi, hu, it, nl, no, pt default: - return $n != 1 ? 1 : 0; + return $n !== 1 ? 1 : 0; } } diff --git a/tpl/bootstrap.php b/tpl/bootstrap.php index 65f093ef..746a1671 100644 --- a/tpl/bootstrap.php +++ b/tpl/bootstrap.php @@ -73,7 +73,7 @@ endif; ?> - + diff --git a/tpl/page.php b/tpl/page.php index 1e377609..82dc443c 100644 --- a/tpl/page.php +++ b/tpl/page.php @@ -51,7 +51,7 @@ endif; ?> - + From 77409e6065afd459e9911f4539f9f1af4ef3bb39 Mon Sep 17 00:00:00 2001 From: El RIDO Date: Thu, 29 Sep 2022 21:15:00 +0200 Subject: [PATCH 2/2] crediting greek language as well, plus docs --- CHANGELOG.md | 2 +- CREDITS.md | 3 ++- js/privatebin.js | 2 +- lib/I18n.php | 2 +- tpl/bootstrap.php | 2 +- tpl/page.php | 2 +- 6 files changed, 7 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index efdcfa31..15bb1b1f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ # PrivateBin version history * **1.4.1 (not yet released)** - * ADDED: Translations for Turkish and Slovak + * ADDED: Translations for Turkish, Slovak and Greek * CHANGED: Avoid `SUPER` privilege for setting the `sql_mode` for MariaDB/MySQL (#919) * FIXED: Revert to CREATE INDEX without IF NOT EXISTS clauses, to support MySQL (#943) * FIXED: Apply table prefix to indexes as well, to support multiple instances sharing a single database (#943) diff --git a/CREDITS.md b/CREDITS.md index 0498fe4a..c0be0ad2 100644 --- a/CREDITS.md +++ b/CREDITS.md @@ -57,4 +57,5 @@ * Patriccollu di Santa Maria è Sichè - Corsican * Markus Mikkonen - Finnish * Emir Ensar Rahmanlar - Turkish -* Stevo984 - Slovak \ No newline at end of file +* Stevo984 - Slovak +* Christos Karamolegkos - Greek \ No newline at end of file diff --git a/js/privatebin.js b/js/privatebin.js index be0cfe21..fe326b49 100644 --- a/js/privatebin.js +++ b/js/privatebin.js @@ -825,7 +825,7 @@ jQuery.PrivateBin = (function($, RawDeflate) { 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, ca, de, en, es, et, fi, hu, it, nl, no, pt + // bg, ca, de, el, en, es, et, fi, hu, it, nl, no, pt default: return n !== 1 ? 1 : 0; } diff --git a/lib/I18n.php b/lib/I18n.php index 7248c255..6394a584 100644 --- a/lib/I18n.php +++ b/lib/I18n.php @@ -338,7 +338,7 @@ class I18n 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, ca, de, en, es, et, fi, hu, it, nl, no, pt + // bg, ca, de, el, en, es, et, fi, hu, it, nl, no, pt default: return $n !== 1 ? 1 : 0; } diff --git a/tpl/bootstrap.php b/tpl/bootstrap.php index dc123cb7..8eb5565d 100644 --- a/tpl/bootstrap.php +++ b/tpl/bootstrap.php @@ -73,7 +73,7 @@ endif; ?> - + diff --git a/tpl/page.php b/tpl/page.php index a3754174..eddbb4b7 100644 --- a/tpl/page.php +++ b/tpl/page.php @@ -51,7 +51,7 @@ endif; ?> - +