我在TYPO3中如何为动作控制器提供不同的翻译? [英] How can i have different translations for action controller in TYPO3?

查看:70
本文介绍了我在TYPO3中如何为动作控制器提供不同的翻译?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能基于 RealURL valueMap静态变量进行本地化桌子?

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

例如,在 Deutsch 语言中,我有www.example.com/de/account/produktinfos/

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

  1. de/是语言
  2. account/页面
  3. produktinfos/控制器动作
  1. de/ is language
  2. account/ page
  3. produktinfos/ controller action

我需要将produktinfos/部分翻译成英语,即www.example.com/en/account/productinfo/.

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

是否可以在RealURL中转换控制器动作?

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

推荐答案

我不知道这是否对您有帮助. 您可以使用一些realurl发布/发布过程.

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

例如:

// 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')
);

并替换URL中的控制器操作

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']);
}

博客文章 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', 
            )
        ),
    ),

这篇关于我在TYPO3中如何为动作控制器提供不同的翻译?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆