다음은 해결책입니다. 이것은 Controller 클래스를 확장하여 작동합니다.이 클래스는 로그인을 처리하는 Security와 같은 컨트롤러에도 영향을 줄 정도로 충분히 낮습니다.
이전 페이지의 로캘을 기억한 다음이를 사용하여 "기본 제공 페이지"를 렌더링합니다.
ControllerDecorator.php
<?php
class ControllerDecorator extends Extension {
function onBeforeInit() {
// If we're on a page, use its Locale information
if($this->getOwner() instanceof ContentController) {
$locale = $this->getOwner()->Locale;
i18n::set_locale($locale);
Cookie::set('Locale', $locale);
}
// Otherwise, use the stored Locale
else if(Cookie::get('Locale')) {
i18n::set_locale(Cookie::get('Locale'));
}
}
}
config.yml
Controller:
extensions:
- ControllerDecorator
난 당신이 컨트롤러 : 초기화에서 해당 매개 변수를() 자신을 확인하고 수동으로 로케일을 설정해야 할 것 같아요. – wmk