Make sure locale is always set, even on first request
This commit is contained in:
parent
05959b17f0
commit
f184bda59b
3 changed files with 4 additions and 4 deletions
|
@ -81,7 +81,7 @@ class ViewFactory
|
|||
$view->registerPlugin('block', 't', [$localeManager, 'smartyTranslate']);
|
||||
|
||||
$view->offsetSet('canonical', self::getCanonicalUrl($request));
|
||||
$view->offsetSet('locale', $container->get('locale')->getLocale());
|
||||
$view->offsetSet('locale', $container->get('locale'));
|
||||
$view->offsetSet('config', $container->get('config'));
|
||||
$view->offsetSet('domain', $uri->withBasePath('')->getBaseUrl());
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<!doctype html>
|
||||
<html {if isset($locale)}lang="{$locale->getBcp47()}"{/if}>
|
||||
<html lang="{$locale->getLocale()->getBcp47()}">
|
||||
<head>
|
||||
<meta charset="UTF-8"/>
|
||||
<meta name=viewport content="width=device-width, initial-scale=1"/>
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
{if isset($supportedLocales) AND count($supportedLocales) > 1}
|
||||
<div class="locales small-font">
|
||||
<button class="localesBtn small-font" title="{t}Switch language{/t}">
|
||||
{if isset($locale) AND $locale->getCountry()}
|
||||
{$locale->getCountry()->getEmoji()}
|
||||
{if $locale->getLocale()->getCountry()}
|
||||
{$locale->getLocale()->getCountry()->getEmoji()}
|
||||
{else}
|
||||
{t}Set language{/t}
|
||||
{/if}
|
||||
|
|
Loading…
Reference in a new issue