How can i have different translations for action controller in TYPO3?

故事扮演 提交于 2019-12-22 01:18:46

问题


Is it possible to have a localization based on RealURL's valueMap static table ?

For example, in Deutsch language, I have www.example.com/de/account/produktinfos/

  1. de/ is language
  2. account/ page
  3. produktinfos/ controller action

And what I need is to translate the produktinfos/part to English, i.e., www.example.com/en/account/productinfo/.

Is there a way to translate the controller action in RealURL?


回答1:


I don't know if this help for you. You can use some realurl post/pre Procs.

for example:

// realurl Hook for replacing some path
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl'] = array(
  'encodeSpURL_postProc' => array('user_encodeSpURL_postProc'),
  'decodeSpURL_preProc' => array('user_decodeSpURL_preProc')
);

and replace controller action in URL

function user_encodeSpURL_postProc(&$params, &$ref) {
  $params['URL'] = str_replace('job/job/Job/show/', 'job/', $params['URL']);
}

function user_decodeSpURL_preProc(&$params, &$ref) {
  $params['URL'] = str_replace('job/', 'job/job/Job/show/', $params['URL']);
}

the blog post https://www.kartolo.de/2014/11/21/extbase-and-realurl/

An other solution can be like that?

// news pagebrowser
    'my-action' => array(
        array(
            'GETvar' => 'tx_myext[action]',
            'valueMap' => array(
                  preg_match('%/de/%',$_SERVER['REQUEST_URI'])==1?'anzeigen':'show' => 'show', 
            )
        ),
    ),


来源:https://stackoverflow.com/questions/37457500/how-can-i-have-different-translations-for-action-controller-in-typo3

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!