How can i have different translations for action c

2020-08-04 04:24发布

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条回答
看我几分像从前
2楼-- · 2020-08-04 05:16

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', 
            )
        ),
    ),
查看更多
登录 后发表回答