[FLOW3-general] localization with FLOW
Federico Bernardin
typo3list at bernardin.it
Fri Dec 14 15:24:41 CET 2012
Hi list,
I'm playing with FLOW and I'm implementing the localization for my test package but I have some problem.
What I need is to create a route (example: www.mysite.com/it/mypackage/mycontroller/myaction) with a language parameter. THis part is easy and I already implemented it.
The I would like to create link in the same format: www.mysite.com/it/mypackage/mycontroller/myaction.
I created this route:
-
name: 'language'
uriPattern: '{@locale}/{@package}/{@controller}(/{@action})'
defaults:
'@package': 'MyPackage'
'@controller': 'Standard'
'@action': 'index'
'@format': 'html'
Then I create the initialize action into controller:
public function initializeAction(){
$arguments = $this->request->getArguments();
if(isset($arguments['@locale'])){
$localeDetector= $this->objectManager->get('TYPO3\FLOW3\I18n\Detector');
$locale = $localeDetector->detectLocaleFromLocaleTag($arguments['@locale']);
$i18nService = $this->objectManager->get('TYPO3\FLOW3\I18n\Service');
if ($i18nService->getConfiguration()->getCurrentLocale() !== $locale) {
$i18nService->getConfiguration()->setCurrentLocale($locale);
}
}
}
Then I would like use fluid link.action to create an action to my controller. I tried to use arguments parameter: <f:link.action action="myaction" arguments="{@locale:it}">Go to myaction</f:link.action> but it doesn't work because my argument has @ (I supposed). With locale without @ it works but I would like to use the route written before.
Can you help me?
Thanks
Federico
More information about the FLOW3-general
mailing list