Tiger_Controller_Plugin_LocalePrefix
@api· extendsZend_Controller_Plugin_Abstract
Tiger_Controller_Plugin_LocalePrefix — semantic /xx/ locale URLs + language resolution.
Makes an optional canonical /xx/ prefix work for EVERY route without editing any of them: it resolves the request's language and strips a leading supported- language segment so the existing routes match the rest.
/es/pricing -> routes "/pricing" (Spanish; cookie set to es) /es/billing/invoice -> routes "/billing/invoice" /es -> routes "/" (home, Spanish) /pricing -> routes "/pricing" (language from cookie/browser)
Resolution precedence (first match wins), then the choice is persisted to the
locale cookie so it sticks (matches AskLevi):
- URL prefix /xx/ explicit for THIS navigation; also updates the cookie
localecookie the last explicit choice (UI switcher or a prior URL)- browser Accept-Language the first-visit default
- configured default tiger.i18n.default, else the first supported language
Languages are LANGUAGE-ONLY (en, es) per Tiger convention. Only a code in the
supported list is treated as a prefix, so a content slug like "no"/"it" is never
mistaken for a locale. Defines LANG and registers Zend_Locale for the request.
The header language switcher (tiger.prefs.js) writes the same locale cookie +
localStorage client-side, so the two mechanisms agree.
Methods
__construct()
__construct(array $supported = ['en'], string $default = 'en')
Configure the supported languages and the fallback language.
$supportedarray— supported language codes (language-only)$defaultstring— fallback language when none resolves
routeStartup()
routeStartup(Zend_Controller_Request_Abstract $request)
Resolve the request language and strip a leading /xx/ prefix so the routes match.
$requestZend_Controller_Request_Abstract— the current request