使用locallang.xlf翻译Extbase扩展,但没有任何反应?

时间:2014-11-12 21:22:02

标签: caching typo3 translate extbase

我使用的是TYPO3 CMS 6.2.6和一个名为" jobfair"的新奇妙的Extbase扩展程序。 我已经添加了我的新templateRootPaths:

plugin.tx_jobfair {

  view {
        templateRootPaths {
          100 = EXT:jobfair/Resources/Private/Templates/
          101 = fileadmin/templates/ext/jobfair/Resources/Private/Templates/
        }

        partialRootPaths {
          100 = EXT:jobfair/Resources/Private/Partials/
          101 = fileadmin/templates/ext/jobfair/Resources/Private/Partials/
       }

       layoutRootPaths {
          100 = EXT:jobfair/Resources/Private/Layouts/
          101 = fileadmin/templates/ext/jobfair/Resources/Private/Layouts/
       }
  }

}
...

因此,我可以编辑特定设计的模板和部分。其他模板将从/ typo3conf / ext / jobfair / Resources /...

加载

一切正常。我还将语言文件夹从扩展名(typo3conf)复制到我的fileadmn文件夹(fileadmin /.../ jobfair / Resources / Private / Language /)。

我编辑" locallang.xlf"和" de.locallang.xlf",例如:

partial:ContractType.html

<f:if condition="{job.contractType} == 0">
 <f:translate key="tx_jobfair_domain_model_job.contract_type.0" />
</f:if>

我将在de.locallang.xlf

更改目标
<trans-unit id="tx_jobfair_domain_model_job.contract_type">
<source>Contract Type</source>
<target>Here's my german translation!!!</target>
</trans-unit>

但它不起作用!?

如何为我的分机翻译或重命名后端(flexform)标签? de.locallang.xlf不是正确的文件吗?

感谢您的帮助。 附:我清除了TYPO3中的任何缓存..没有发生任何事情。

这是我的文件系统

ext-folder copied in fileadmin

我对FLUIDTEMPLATE使用它的方式相同

fluid and language typo3

2 个答案:

答案 0 :(得分:4)

模板和语言处理是TYPO3中的独立组件。因此,您覆盖原始文件的模板文件不能&#34;知道&#34;你在其他地方复制了语言文件。你有几个选择。

只是为了记录,使用TypoScript可以轻松地覆盖前端的标签:

plugin.tx_yourext._LOCAL_LANG.[languageKey] {
    labelKey = New label text
}

(默认语言有&#34;默认语言&#34; als languageKey。)

在后端,您可以使用Page TSConfig覆盖TCA和FlexForm标签:

# TCA
TCEFORM.tt_content.layout.label = New label

# FlexForm field
TCEFORM.tt_content.pi_flexform.[ext_key].[sheet_key].[field_key].label = New label

# Example for Powermail
TCEFORM.tt_content.pi_flexform.powermail_pi1 {
    main {
        settings\.flexform\.main\.optin.label = Require opt-in for mails
    }
}

请注意Powermail示例中的反斜杠。相关字段称为settings.flexform.main.optin。由于点通常是&#34;路径分隔符&#34;,因此必须对它们进行转义才能使其正常工作。

除了这种配置方式,还有一种完全不同的方法。您可以覆盖整个翻译文件:

# Override XLF for default language
$GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride']['path/to/originalTranslationFile.xlf'][]
    = 'path/to/otherTranslationFile.xlf';
# Override XLF for French language
$GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride']['fr']
    ['path/to/originalTranslationFile.xlf'][] = 'other/path/to/fr.otherTranslationFile.xlf';

有关此主题的更多信息,请参见here

答案 1 :(得分:0)

完美。洛伦兹,非常感谢您的详细解释。现在我明白了,'我会看到更大的图景'......

我只需要在该项目中进行后端翻译,例如:

TCEFORM.tx_jobfair_domain_model_job {
   ## disable flexform/tca fields
   salary.disabled = 1
   discipline.disabled = 1
   education.disabled = 1


   # rename or translate
   job_title.label = Stelle
   employer.label = Arbeitgeber
   employer_description.label = Arbeitgeberbeschreibung

}

但我也测试它的前端视图:

plugin.tx_jobfair._LOCAL_LANG.de {
    tx_jobfair_domain_model_job.contract_type = Vertragsart
}

完美的作品! 非常感谢你!

相关问题