enable & credit Japanese & Arabic translations

This commit is contained in:
El RIDO 2023-08-01 14:00:45 +02:00
parent 8df69a1120
commit fe37b7f0e5
4 changed files with 10 additions and 1 deletions

View file

@ -1,6 +1,7 @@
# PrivateBin version history # PrivateBin version history
* **1.6.0 (not yet released)** * **1.6.0 (not yet released)**
* ADDED: Translations for Japanese & Arabic
* CHANGED: Minimum required PHP version is 7.3, due to upgrading PHPunit (#707) * CHANGED: Minimum required PHP version is 7.3, due to upgrading PHPunit (#707)
* **1.5.2 (2023-07-09)** * **1.5.2 (2023-07-09)**
* ADDED: Allow AWS SDK to use default credential provider chain for S3Storage (#1070) * ADDED: Allow AWS SDK to use default credential provider chain for S3Storage (#1070)

View file

@ -63,3 +63,5 @@
* Stevo984 - Slovak * Stevo984 - Slovak
* Christos Karamolegkos - Greek * Christos Karamolegkos - Greek
* jaideejung007 - Thai * jaideejung007 - Thai
* Nicolas Le Gall - Japanese
* lazerns - Arabic

View file

@ -627,7 +627,7 @@ jQuery.PrivateBin = (function($, RawDeflate) {
* @prop {string[]} * @prop {string[]}
* @readonly * @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 * built in language
@ -802,6 +802,8 @@ jQuery.PrivateBin = (function($, RawDeflate) {
me.getPluralForm = function(n) { me.getPluralForm = function(n) {
switch (language) 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 'cs':
case 'sk': case 'sk':
return n === 1 ? 0 : (n >= 2 && n <= 4 ? 1 : 2); return n === 1 ? 0 : (n >= 2 && n <= 4 ? 1 : 2);
@ -814,6 +816,7 @@ jQuery.PrivateBin = (function($, RawDeflate) {
case 'he': case 'he':
return n === 1 ? 0 : (n === 2 ? 1 : ((n < 0 || n > 10) && (n % 10 === 0) ? 2 : 3)); return n === 1 ? 0 : (n === 2 ? 1 : ((n < 0 || n > 10) && (n % 10 === 0) ? 2 : 3));
case 'id': case 'id':
case 'ja':
case 'jbo': case 'jbo':
case 'th': case 'th':
return 0; return 0;

View file

@ -315,6 +315,8 @@ class I18n
protected static function _getPluralForm($n) protected static function _getPluralForm($n)
{ {
switch (self::$_language) { 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 'cs':
case 'sk': case 'sk':
return $n === 1 ? 0 : ($n >= 2 && $n <= 4 ? 1 : 2); return $n === 1 ? 0 : ($n >= 2 && $n <= 4 ? 1 : 2);
@ -327,6 +329,7 @@ class I18n
case 'he': case 'he':
return $n === 1 ? 0 : ($n === 2 ? 1 : (($n < 0 || $n > 10) && ($n % 10 === 0) ? 2 : 3)); return $n === 1 ? 0 : ($n === 2 ? 1 : (($n < 0 || $n > 10) && ($n % 10 === 0) ? 2 : 3));
case 'id': case 'id':
case 'ja':
case 'jbo': case 'jbo':
case 'th': case 'th':
return 0; return 0;