瀏覽代碼

added supported language, updated credits and changelog

El RIDO 9 年之前
父節點
當前提交
a7de0e095b
共有 7 個文件被更改,包括 17 次插入6 次删除
  1. 1 1
      CHANGELOG.md
  2. 1 0
      CREDITS.md
  3. 2 2
      js/privatebin.js
  4. 1 1
      lib/I18n.php
  5. 1 1
      tpl/bootstrap.php
  6. 1 1
      tpl/page.php
  7. 10 0
      tst/I18nTest.php

+ 1 - 1
CHANGELOG.md

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

+ 1 - 0
CREDITS.md

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

+ 2 - 2
js/privatebin.js

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

+ 1 - 1
lib/I18n.php

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

+ 1 - 1
tpl/bootstrap.php

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

+ 1 - 1
tpl/page.php

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

+ 10 - 0
tst/I18nTest.php

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