Skip to content

Commit

Permalink
Add the locale en_GB
Browse files Browse the repository at this point in the history
  • Loading branch information
levitte authored and fguillot committed Nov 9, 2018
1 parent 7c2e0f7 commit 2674def
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app/Model/LanguageModel.php
Expand Up @@ -29,6 +29,7 @@ public static function getCodes()
'cs_CZ',
'da_DK',
'de_DE',
'en_GB',
'en_US',
'es_ES',
'fr_FR',
Expand Down Expand Up @@ -89,7 +90,8 @@ public function getLanguages($prepend = false)
'cs_CZ' => 'Čeština',
'da_DK' => 'Dansk',
'de_DE' => 'Deutsch',
'en_US' => 'English',
'en_GB' => 'English (GB)',
'en_US' => 'English (US)',
'es_ES' => 'Español',
'fr_FR' => 'Français',
'el_GR' => 'Grec',
Expand Down Expand Up @@ -137,6 +139,7 @@ public function getJsLanguageCode()
'ca_ES' => 'ca',
'da_DK' => 'da',
'de_DE' => 'de',
'en_GB' => 'en-GB',
'en_US' => 'en',
'es_ES' => 'es',
'fr_FR' => 'fr',
Expand Down
5 changes: 5 additions & 0 deletions tests/units/Model/LanguageTest.php
Expand Up @@ -10,13 +10,15 @@ public function testGetCodes()
{
$codes = LanguageModel::getCodes();
$this->assertContains('fr_FR', $codes);
$this->assertContains('en_GB', $codes);
$this->assertContains('en_US', $codes);
}

public function testFindCode()
{
$this->assertSame('', LanguageModel::findCode('xx-XX'));
$this->assertSame('fr_FR', LanguageModel::findCode('fr-FR'));
$this->assertSame('en_GB', LanguageModel::findCode('en-GB'));
$this->assertSame('en_US', LanguageModel::findCode('en-US'));
}

Expand All @@ -37,6 +39,9 @@ public function testGetCurrentLanguage()
$languageModel = new LanguageModel($this->container);
$this->assertEquals('en_US', $languageModel->getCurrentLanguage());

$_SESSION['user'] = array('language' => 'en_GB');
$this->assertEquals('en_GB', $languageModel->getCurrentLanguage());

$_SESSION['user'] = array('language' => 'fr_FR');
$this->assertEquals('fr_FR', $languageModel->getCurrentLanguage());

Expand Down

0 comments on commit 2674def

Please sign in to comment.