diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6197bb4..2dc2e3c 100644
--- a/CHANGELOG.md
+++ b/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)**
diff --git a/CREDITS.md b/CREDITS.md
index 47d0bc2..dfb2d83 100644
--- a/CREDITS.md
+++ b/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
diff --git a/js/privatebin.js b/js/privatebin.js
index 7030afb..60e2775 100644
--- a/js/privatebin.js
+++ b/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);
}
diff --git a/lib/I18n.php b/lib/I18n.php
index 6419fee..4c59ef5 100644
--- a/lib/I18n.php
+++ b/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;
}
diff --git a/tpl/bootstrap.php b/tpl/bootstrap.php
index 951ba1f6..aa91756 100644
--- a/tpl/bootstrap.php
+++ b/tpl/bootstrap.php
@@ -69,7 +69,7 @@ if ($MARKDOWN):
-
+
diff --git a/tpl/page.php b/tpl/page.php
index a4bdce3..484b299 100644
--- a/tpl/page.php
+++ b/tpl/page.php
@@ -47,7 +47,7 @@ if ($MARKDOWN):
-
+
diff --git a/tst/I18nTest.php b/tst/I18nTest.php
index 7c75b69..91c92aa 100644
--- a/tst/I18nTest.php
+++ b/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';