added supported language, updated credits and changelog

This commit is contained in:
El RIDO 2017-01-10 20:37:14 +01:00
parent 4a49613b47
commit a7de0e095b
No known key found for this signature in database
GPG Key ID: 0F5C940A6BD81F92
7 changed files with 17 additions and 6 deletions

View File

@ -1,7 +1,7 @@
# PrivateBin version history
* **next (not yet released)**
* ADDED: Translations for Spanish and Occitan
* ADDED: Translations for Spanish, Occitan and Norwegian
* ADDED: Option in configuration to change the default "PrivateBin" title of the site
* CHANGED: Cleanup of bootstrap template variants and moved icons to `img` directory
* **1.1 (2016-12-26)**

View File

@ -34,3 +34,4 @@ Sébastien Sauvage - original idea and main developer
* R4SAS - Russian
* Alfredo Fabián Altamirano Tena - Spanish
* Quent-in - Occitan
* idarlund - Norwegian

View File

@ -329,7 +329,7 @@ $(function() {
/**
* supported languages, minus the built in 'en'
*/
supportedLanguages: ['de', 'es', 'fr', 'it', 'pl', 'oc', 'ru', 'sl', 'zh'],
supportedLanguages: ['de', 'es', 'fr', 'it', 'no', 'pl', 'oc', 'ru', 'sl', 'zh'],
/**
* translate a string, alias for translate()
@ -420,7 +420,7 @@ $(function() {
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)));
// de, en, es, it
// de, en, es, it, no
default:
return (n !== 1 ? 1 : 0);
}

View File

@ -304,7 +304,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));
// de, en, es, it
// de, en, es, it, no
default:
return $n != 1 ? 1 : 0;
}

View File

@ -69,7 +69,7 @@ if ($MARKDOWN):
<?php
endif;
?>
<script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-7C0R3df9nbM/VHCi2PpuEy14FC3os6JQfEkI6u4fjKn5xMlNJAozHJCwP/4bQiXxeqMy64Xi6VmZgaG6dwjAgg==" crossorigin="anonymous"></script>
<script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-eiKDhuH9ab6eBlJbn0nggiYIvCJd82nnzfmr94+NMaSqImQe3V61FKaOwfiBg6AHQCn0GE9OX4xLN5ATfJPGkg==" crossorigin="anonymous"></script>
<!--[if lt IE 10]>
<style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;} #oldienotice {display:block;}</style>
<![endif]-->

View File

@ -47,7 +47,7 @@ if ($MARKDOWN):
<?php
endif;
?>
<script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-7C0R3df9nbM/VHCi2PpuEy14FC3os6JQfEkI6u4fjKn5xMlNJAozHJCwP/4bQiXxeqMy64Xi6VmZgaG6dwjAgg==" crossorigin="anonymous"></script>
<script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-eiKDhuH9ab6eBlJbn0nggiYIvCJd82nnzfmr94+NMaSqImQe3V61FKaOwfiBg6AHQCn0GE9OX4xLN5ATfJPGkg==" crossorigin="anonymous"></script>
<!--[if lt IE 10]>
<style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;} #oldienotice {display:block;}</style>
<![endif]-->

View File

@ -58,6 +58,16 @@ class I18nTest extends PHPUnit_Framework_TestCase
$this->assertEquals('2 heures', I18n::_('%d hours', 2), '2 hours in French');
}
public function testBrowserLanguageNoDetection()
{
$_SERVER['HTTP_ACCEPT_LANGUAGE'] = 'no;q=0.8,en-GB;q=0.6,en-US;q=0.4,en;q=0.2';
I18n::loadTranslations();
$this->assertEquals('no', I18n::_('en'), 'browser language no');
$this->assertEquals('0 timer', I18n::_('%d hours', 0), '0 hours in Norwegian');
$this->assertEquals('1 time', I18n::_('%d hours', 1), '1 hour in Norwegian');
$this->assertEquals('2 timer', I18n::_('%d hours', 2), '2 hours in Norwegian');
}
public function testBrowserLanguageOcDetection()
{
$_SERVER['HTTP_ACCEPT_LANGUAGE'] = 'oc;q=0.8,en-GB;q=0.6,en-US;q=0.4,en;q=0.2';