Get Values
Hello,
How can i get the current language to get specific translations.
Another question, how can i block languages?
My code is:
'locale' => array( 'localeBasedRedirect' => true, 'defaultLocale' => 'en', 'sessionKey' => 'applocale', 'doubleCheckBrowserDefaultLangs' => true, 'useGeoIP' => false, //'geoIPEdition' => GEOIP_COUNTRY_EDITION, 'availableLocales' => array( 'en', 'fr', ) )
I want when a user enter for example www.mysite.com/fr the url redirects to default www.mysite.com/en.
Thanks in advanced..
Comments (4)
-
repo owner -
repo owner - changed status to on hold
Awaiting feedback
-
reporter thanks, its working.
However i can i do a redirect to a a default language if a user enter a language no supported?
I want when a user enter for example www.mysite.com/fr the url redirects to default www.mysite.com/en.
-
repo owner - changed status to closed
- Log in to comment
If you don't want users to fgo to /fr, you should remove it from availableLocales.
To get the current locale you should be able to use
$this->locale->getLocale()
in any class that extendsPhalcon\DI\Injectable
such asPhalcon\Mvc\Controller
.