updated SRI hashes, added missing formula for slowene plurals and unit test for it, updated credits and changelog

This commit is contained in:
El RIDO 2017-01-01 14:35:39 +01:00
parent 910c3b3f9d
commit 4a036aea80
No known key found for this signature in database
GPG Key ID: 0F5C940A6BD81F92
12 changed files with 32 additions and 10 deletions

View File

@ -1,5 +1,7 @@
# PrivateBin version history # PrivateBin version history
* **next (not yet released)**
* ADDED: Translations for Spanish
* **1.1 (2016-12-26)** * **1.1 (2016-12-26)**
* ADDED: Translations for Italian and Russian * ADDED: Translations for Italian and Russian
* ADDED: Loading message displayed until decryption succeeded for slower (in terms of CPU or network) systems * ADDED: Loading message displayed until decryption succeeded for slower (in terms of CPU or network) systems

View File

@ -32,3 +32,4 @@ Sébastien Sauvage - original idea and main developer
* Jiawei Zhou - Chinese * Jiawei Zhou - Chinese
* Stefano Marty - Italian * Stefano Marty - Italian
* R4SAS - Russian * R4SAS - Russian
* Alfredo Fabián Altamirano Tena - Spanish

View File

@ -7,7 +7,7 @@
* @link https://github.com/PrivateBin/PrivateBin * @link https://github.com/PrivateBin/PrivateBin
* @copyright 2012 Sébastien SAUVAGE (sebsauvage.net) * @copyright 2012 Sébastien SAUVAGE (sebsauvage.net)
* @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License * @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
* @version 1.0 * @version 1.1
*/ */
// change this, if your php files and data is outside of your webservers document root // change this, if your php files and data is outside of your webservers document root

View File

@ -414,10 +414,12 @@ $(function() {
case 'zh': case 'zh':
return (n > 1 ? 1 : 0); return (n > 1 ? 1 : 0);
case 'pl': 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 'ru':
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));
// en, de case 'sl':
return (n % 100 === 1 ? 1 : (n % 100 === 2 ? 2 : (n % 100 === 3 || n % 100 === 4 ? 3 : 0)));
// de, en, es, it
default: default:
return (n !== 1 ? 1 : 0); return (n !== 1 ? 1 : 0);
} }

View File

@ -301,7 +301,9 @@ class I18n
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 'ru':
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);
// en, de case 'sl':
return $n % 100 == 1 ? 1 : ($n % 100 == 2 ? 2 : ($n % 100 == 3 || $n % 100 == 4 ? 3 : 0));
// de, en, es, it
default: default:
return $n != 1 ? 1 : 0; return $n != 1 ? 1 : 0;
} }

View File

@ -52,7 +52,7 @@ if ($MARKDOWN):
<?php <?php
endif; endif;
?> ?>
<script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-q/2ZUVaS+RVZEaIzIufFOAbhkq2/hYXix2f/Dt3+MxWouGt7vxB3rIU3jkn3f7VHNBnK/wL3KjKL+xZuaaKPVQ==" crossorigin="anonymous"></script> <script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-Sv8/rtOGZh+j57yWAeP2birjDh9VI7lRByNtVKGLgZc5iwFEtDCu7ZZwFrD3D673B8q+ET+eiuhVPmy5IxBVBw==" crossorigin="anonymous"></script>
<!--[if lt IE 10]> <!--[if lt IE 10]>
<style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;} #oldienotice {display:block;}</style> <style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;} #oldienotice {display:block;}</style>
<![endif]--> <![endif]-->

View File

@ -52,7 +52,7 @@ if ($MARKDOWN):
<?php <?php
endif; endif;
?> ?>
<script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-q/2ZUVaS+RVZEaIzIufFOAbhkq2/hYXix2f/Dt3+MxWouGt7vxB3rIU3jkn3f7VHNBnK/wL3KjKL+xZuaaKPVQ==" crossorigin="anonymous"></script> <script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-Sv8/rtOGZh+j57yWAeP2birjDh9VI7lRByNtVKGLgZc5iwFEtDCu7ZZwFrD3D673B8q+ET+eiuhVPmy5IxBVBw==" crossorigin="anonymous"></script>
<!--[if lt IE 10]> <!--[if lt IE 10]>
<style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;} #oldienotice {display:block;}</style> <style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;} #oldienotice {display:block;}</style>
<![endif]--> <![endif]-->

View File

@ -53,7 +53,7 @@ if ($MARKDOWN):
<?php <?php
endif; endif;
?> ?>
<script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-q/2ZUVaS+RVZEaIzIufFOAbhkq2/hYXix2f/Dt3+MxWouGt7vxB3rIU3jkn3f7VHNBnK/wL3KjKL+xZuaaKPVQ==" crossorigin="anonymous"></script> <script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-Sv8/rtOGZh+j57yWAeP2birjDh9VI7lRByNtVKGLgZc5iwFEtDCu7ZZwFrD3D673B8q+ET+eiuhVPmy5IxBVBw==" crossorigin="anonymous"></script>
<!--[if lt IE 10]> <!--[if lt IE 10]>
<style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;} #oldienotice {display:block;}</style> <style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;} #oldienotice {display:block;}</style>
<![endif]--> <![endif]-->

View File

@ -52,7 +52,7 @@ if ($MARKDOWN):
<?php <?php
endif; endif;
?> ?>
<script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-q/2ZUVaS+RVZEaIzIufFOAbhkq2/hYXix2f/Dt3+MxWouGt7vxB3rIU3jkn3f7VHNBnK/wL3KjKL+xZuaaKPVQ==" crossorigin="anonymous"></script> <script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-Sv8/rtOGZh+j57yWAeP2birjDh9VI7lRByNtVKGLgZc5iwFEtDCu7ZZwFrD3D673B8q+ET+eiuhVPmy5IxBVBw==" crossorigin="anonymous"></script>
<!--[if lt IE 10]> <!--[if lt IE 10]>
<style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;} #oldienotice {display:block;}</style> <style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;} #oldienotice {display:block;}</style>
<![endif]--> <![endif]-->

View File

@ -53,7 +53,7 @@ if ($MARKDOWN):
<?php <?php
endif; endif;
?> ?>
<script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-q/2ZUVaS+RVZEaIzIufFOAbhkq2/hYXix2f/Dt3+MxWouGt7vxB3rIU3jkn3f7VHNBnK/wL3KjKL+xZuaaKPVQ==" crossorigin="anonymous"></script> <script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-Sv8/rtOGZh+j57yWAeP2birjDh9VI7lRByNtVKGLgZc5iwFEtDCu7ZZwFrD3D673B8q+ET+eiuhVPmy5IxBVBw==" crossorigin="anonymous"></script>
<!--[if lt IE 10]> <!--[if lt IE 10]>
<style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;} #oldienotice {display:block;}</style> <style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;} #oldienotice {display:block;}</style>
<![endif]--> <![endif]-->

View File

@ -47,7 +47,7 @@ if ($MARKDOWN):
<?php <?php
endif; endif;
?> ?>
<script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-q/2ZUVaS+RVZEaIzIufFOAbhkq2/hYXix2f/Dt3+MxWouGt7vxB3rIU3jkn3f7VHNBnK/wL3KjKL+xZuaaKPVQ==" crossorigin="anonymous"></script> <script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-Sv8/rtOGZh+j57yWAeP2birjDh9VI7lRByNtVKGLgZc5iwFEtDCu7ZZwFrD3D673B8q+ET+eiuhVPmy5IxBVBw==" crossorigin="anonymous"></script>
<!--[if lt IE 10]> <!--[if lt IE 10]>
<style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;} #oldienotice {display:block;}</style> <style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;} #oldienotice {display:block;}</style>
<![endif]--> <![endif]-->

View File

@ -84,6 +84,21 @@ class I18nTest extends PHPUnit_Framework_TestCase
$this->assertEquals('21 минуту', I18n::_('%d minutes', 21), '21 minutes in russian'); $this->assertEquals('21 минуту', I18n::_('%d minutes', 21), '21 minutes in russian');
} }
public function testBrowserLanguageSlDetection()
{
$_SERVER['HTTP_ACCEPT_LANGUAGE'] = 'sl;q=0.8,en-GB;q=0.6,en-US;q=0.4,en;q=0.2';
I18n::loadTranslations();
$this->assertEquals('sl', I18n::_('en'), 'browser language sl');
$this->assertEquals('0 ura', I18n::_('%d hours', 0), '0 hours in slowene');
$this->assertEquals('1 uri', I18n::_('%d hours', 1), '1 hour in slowene');
$this->assertEquals('2 ure', I18n::_('%d hours', 2), '2 hours in slowene');
$this->assertEquals('3 ur', I18n::_('%d hours', 3), '3 hours in slowene');
$this->assertEquals('11 ura', I18n::_('%d hours', 11), '11 hours in slowene');
$this->assertEquals('101 uri', I18n::_('%d hours', 101), '101 hours in slowene');
$this->assertEquals('102 ure', I18n::_('%d hours', 102), '102 hours in slowene');
$this->assertEquals('104 ur', I18n::_('%d hours', 104), '104 hours in slowene');
}
public function testBrowserLanguageAnyDetection() public function testBrowserLanguageAnyDetection()
{ {
$_SERVER['HTTP_ACCEPT_LANGUAGE'] = '*'; $_SERVER['HTTP_ACCEPT_LANGUAGE'] = '*';