From 8faf0501f4d39039220070d59935b1ecac4d4086 Mon Sep 17 00:00:00 2001 From: El RIDO Date: Sat, 12 Feb 2022 16:17:09 +0100 Subject: [PATCH] improve Lojban support - Crowdin has to use the 3 letter language code, since Lojban has no 2 letter code. Added support for this in the PHP backend and renamed the translation file. - Lojban has no plural cases, updated the plural-formulas accordingly. - Credited the change and documented it. - Updated the SRI hashes. --- CHANGELOG.md | 4 ++-- CREDITS.md | 1 + i18n/{jb.json => jbo.json} | 0 i18n/languages.json | 2 +- js/privatebin.js | 7 ++++--- lib/I18n.php | 3 ++- tpl/bootstrap.php | 2 +- tpl/page.php | 2 +- 8 files changed, 12 insertions(+), 9 deletions(-) rename i18n/{jb.json => jbo.json} (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 428a60ae..7c3f8045 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ # PrivateBin version history * **1.4 (not yet released)** - * ADDED: Translation for Estonian + * ADDED: Translations for Estonian and Lojban * ADDED: new HTTP headers improving security (#765) * ADDED: Download button for paste text (#774) * ADDED: Opt-out of federated learning of cohorts (FLoC) (#776) @@ -14,7 +14,7 @@ * CHANGED: Removed configurable `dir` for `traffic` & `purge` limiters (#419) * CHANGED: Server salt, traffic and purge limiter now stored in the storage backend (#419) * **1.3.5 (2021-04-05)** - * ADDED: Translation for Hebrew, Lithuanian, Indonesian and Catalan + * ADDED: Translations for Hebrew, Lithuanian, Indonesian and Catalan * ADDED: Make the project info configurable (#681) * CHANGED: Upgrading libraries to: DOMpurify 2.2.7, kjua 0.9.0 & random_compat 2.0.18 * CHANGED: Open all links in new window (#630) diff --git a/CREDITS.md b/CREDITS.md index 6c2f647c..de0ebe81 100644 --- a/CREDITS.md +++ b/CREDITS.md @@ -54,3 +54,4 @@ Sébastien Sauvage - original idea and main developer * whenwesober - Indonesian * retiolus - Catalan * sarnane - Estonian +* foxsouns - Lojban diff --git a/i18n/jb.json b/i18n/jbo.json similarity index 100% rename from i18n/jb.json rename to i18n/jbo.json diff --git a/i18n/languages.json b/i18n/languages.json index 671b3f75..2d7341dc 100644 --- a/i18n/languages.json +++ b/i18n/languages.json @@ -89,7 +89,7 @@ "ku": ["Kurdî", "Kurdish"], "kj": ["Kuanyama", "Kwanyama"], "la": ["lingua latina", "Latin"], - "jb": ["jbobau", "Lojban"], + "jbo":["jbobau", "Lojban"], "lb": ["Lëtzebuergesch", "Luxembourgish"], "lg": ["Luganda", "Ganda"], "li": ["Limburgs", "Limburgish"], diff --git a/js/privatebin.js b/js/privatebin.js index 860a2bd7..ef030fb3 100644 --- a/js/privatebin.js +++ b/js/privatebin.js @@ -601,7 +601,7 @@ jQuery.PrivateBin = (function($, RawDeflate) { * @prop {string[]} * @readonly */ - const supportedLanguages = ['bg', 'ca', 'cs', 'de', 'es', 'et', 'fr', 'he', 'hu', 'id', 'it', 'jb', 'lt', 'no', 'nl', 'pl', 'pt', 'oc', 'ru', 'sl', 'uk', 'zh']; + const supportedLanguages = ['bg', 'ca', 'cs', 'de', 'es', 'et', 'fr', 'he', 'hu', 'id', 'it', 'jbo', 'lt', 'no', 'nl', 'pl', 'pt', 'oc', 'ru', 'sl', 'uk', 'zh']; /** * built in language @@ -785,6 +785,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 'jbo': return 0; case 'lt': return n % 10 === 1 && n % 100 !== 11 ? 0 : ((n % 10 >= 2 && n % 100 < 10 || n % 100 >= 20) ? 1 : 2); @@ -5404,8 +5405,8 @@ jQuery.PrivateBin = (function($, RawDeflate) { node.setAttribute('target', '_blank'); } // set non-HTML/MathML links to xlink:show=new - if (!node.hasAttribute('target') - && (node.hasAttribute('xlink:href') + if (!node.hasAttribute('target') + && (node.hasAttribute('xlink:href') || node.hasAttribute('href'))) { node.setAttribute('xlink:show', 'new'); } diff --git a/lib/I18n.php b/lib/I18n.php index 50bf0ccf..bc8b765c 100644 --- a/lib/I18n.php +++ b/lib/I18n.php @@ -195,7 +195,7 @@ class I18n if (count(self::$_availableLanguages) == 0) { $i18n = dir(self::_getPath()); while (false !== ($file = $i18n->read())) { - if (preg_match('/^([a-z]{2}).json$/', $file, $match) === 1) { + if (preg_match('/^([a-z]{2,3}).json$/', $file, $match) === 1) { self::$_availableLanguages[] = $match[1]; } } @@ -324,6 +324,7 @@ class I18n case 'he': return $n === 1 ? 0 : ($n === 2 ? 1 : (($n < 0 || $n > 10) && ($n % 10 === 0) ? 2 : 3)); case 'id': + case 'jbo': return 0; case 'lt': return $n % 10 === 1 && $n % 100 !== 11 ? 0 : (($n % 10 >= 2 && $n % 100 < 10 || $n % 100 >= 20) ? 1 : 2); diff --git a/tpl/bootstrap.php b/tpl/bootstrap.php index 1e4eae00..ee89ea9d 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 28f37b90..98e32099 100644 --- a/tpl/page.php +++ b/tpl/page.php @@ -50,7 +50,7 @@ endif; ?> - +