Просмотр исходного кода

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

El RIDO 10 лет назад
Родитель
Сommit
4a036aea80
12 измененных файлов с 32 добавлено и 10 удалено
  1. 2 0
      CHANGELOG.md
  2. 1 0
      CREDITS.md
  3. 1 1
      index.php
  4. 4 2
      js/privatebin.js
  5. 3 1
      lib/I18n.php
  6. 1 1
      tpl/bootstrap-compact.php
  7. 1 1
      tpl/bootstrap-dark-page.php
  8. 1 1
      tpl/bootstrap-dark.php
  9. 1 1
      tpl/bootstrap-page.php
  10. 1 1
      tpl/bootstrap.php
  11. 1 1
      tpl/page.php
  12. 15 0
      tst/I18nTest.php

+ 2 - 0
CHANGELOG.md

@@ -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

+ 1 - 0
CREDITS.md

@@ -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

+ 1 - 1
index.php

@@ -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

+ 4 - 2
js/privatebin.js

@@ -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);
             }
             }

+ 3 - 1
lib/I18n.php

@@ -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;
         }
         }

+ 1 - 1
tpl/bootstrap-compact.php

@@ -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]-->

+ 1 - 1
tpl/bootstrap-dark-page.php

@@ -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]-->

+ 1 - 1
tpl/bootstrap-dark.php

@@ -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]-->

+ 1 - 1
tpl/bootstrap-page.php

@@ -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]-->

+ 1 - 1
tpl/bootstrap.php

@@ -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]-->

+ 1 - 1
tpl/page.php

@@ -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]-->

+ 15 - 0
tst/I18nTest.php

@@ -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'] = '*';