Enabled translation when not logged in

Reads from the Accept-Language HTTP header.
Also fixed some encoding for ES translations.

Fixes #375
This commit is contained in:
Dan Brown
2017-04-29 16:47:41 +01:00
parent 92108d710d
commit ad4642c2c4
6 changed files with 34 additions and 4 deletions

View File

@ -14,6 +14,23 @@ class LanguageTest extends TestCase
$this->langs = array_diff(scandir(resource_path('lang')), ['..', '.']);
}
public function test_locales_config_key_set_properly()
{
$configLocales = config('app.locales');
sort($configLocales);
sort($this->langs);
$this->assertTrue(implode(':', $this->langs) === implode(':', $configLocales), 'app.locales configuration variable matches found lang files');
}
public function test_correct_language_if_not_logged_in()
{
$loginReq = $this->get('/login');
$loginReq->assertSee('Log In');
$loginPageFrenchReq = $this->get('/login', ['Accept-Language' => 'fr']);
$loginPageFrenchReq->assertSee('Se Connecter');
}
public function test_js_endpoint_for_each_language()
{