diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6197bb4b..2dc2e3c7 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 47d0bc2f..dfb2d83e 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 7030afb9..60e27754 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 6419fee3..4c59ef57 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..aa91756c 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 a4bdce32..484b299e 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 7c75b696..91c92aa6 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';