Get Values

Issue #5 closed
Hugo Lopes created an issue

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)

  1. Mark Garrett repo owner

    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 extends Phalcon\DI\Injectable such as Phalcon\Mvc\Controller.

  2. Log in to comment