Switching language correctly switches URL and content but does not seem to switch locale.
This is my lang switcher echoed code in localhost:
<nav class="languages">
<a href="http://localhost/~jaume/dev/femsa/es" hreflang="es">es</a>
<a href="http://localhost/~jaume/dev/femsa/en" hreflang="en">en</a>
</nav>
This is my config:
<?php
return [
'hooks' => [
'page.create:after' => function ($page) {
buildPageTree($page);
}
],
'languages' => true,
'date.handler' => 'strftime',
'panel' =>[
'install' => false
],
'debug' => true
];
And these are my language files
site/languages/es.php
<?php
return [
'code' => 'es',
'default' => true,
'direction' => 'ltr',
'locale' => 'es_MX',
'name' => 'Español',
'translations' => [
'proxeventos' => 'PRÓXIMOS EVENTOS Y PROGRAMAS ',
'artistasInvitados' => 'ARTISTAS invitados ',
'curadoresInvitados' => 'CURADORES invitados ',
'hoy' => 'hoy',
'mañana' => 'mañana',
'estaSemana' => 'esta semana',
'proxSemana' => 'prox. week',
'infoViaje' => 'información de viaje INFORMACIÓN DE VIAJE ',
'sedes' => 'sedes ',
'progPublico' => 'programa PÚBLICO ',
'progPedagogico' => 'programa PEDAGÓGICO ',
'aquiDescarga' => 'AQUÍ DESCARGA: ',
'programa' => 'PROGRAMA',
'convocatoria' => 'CONVOCATORIA',
'fechasConfirmar' => 'Fechas por confirmar ',
'sinEventos' => 'Sin eventos',
'contacto' => 'CONTACTO',
'siguenos' => 'SIGUENOS EN',
'descargas' => 'DESCARGAS',
'materialesPrensa' => 'Materiales de prensa',
'avisoPrivacidad' => 'Aviso de privacidad',
'suscribirse' => 'suscribirse'
],
'url' => NULL
];
site/languages/en.php
<?php
return [
'code' => 'en',
'default' => false,
'direction' => 'ltr',
'locale' => 'en_US',
'name' => 'English',
'translations' => [
'proxeventos' => 'UPCOMING PROGRAMS AND EVENTS ',
'artistasInvitados' => 'guest ARTISTS ',
'curadoresInvitados' => 'guest CURATORS ',
'hoy' => 'today',
'mañana' => 'tomorrow',
'estaSemana' => 'this week',
'proxSemana' => 'next week',
'infoViaje' => 'trip information TRIP INFORMATION ',
'sedes' => 'event locations ',
'progPublico' => 'programa PÚBLICO ',
'progPedagogico' => 'educational PROGRAM ',
'aquiDescarga' => 'DOWNLOAD HERE: ',
'programa' => 'PROGRAM',
'convocatoria' => 'APPLICATION',
'fechasConfirmar' => 'Dates to be confirmed ',
'sinEventos' => 'No events',
'contacto' => 'CONTACT',
'siguenos' => 'FOLLOW US',
'descargas' => 'DOWNLOADS',
'materialesPrensa' => 'Press materials',
'avisoPrivacidad' => 'Privacy notice',
'suscribirse' => 'subscribe'
],
'url' => NULL
];
When I click any of the links in the language switcher, URL and content switch accordingly but not the locale. The result of the following code:
<?php echo setlocale(LC_ALL, 0); ?>
is…
es_MX.utf8
…in both cases.
What may be going on ?
Thank you