【问题标题】:How to override language files in Typo3 version 7.6?如何覆盖 Typo3 7.6 版中的语言文件?
【发布时间】:2018-10-10 11:45:41
【问题描述】:

我真的需要知道如何从扩展中覆盖语言文件。例如,我安装了 powermail,并且我需要覆盖该扩展名中的一个语言文件。

所以我有一个名为 website_head 的扩展,并在其中创建了文件:

typo3conf\ext\website_head\Resources\Private\Language\Overrides\powermail\Resources\Private\Language\locallang.xlf

我要覆盖的文件是:

typo3conf\ext\powermail\Resources\Private\Language\locallang.xlf

当我清除缓存时它不会改变(但是当我改变原始文件时它确实会改变文本,它只是没有覆盖)

这也是覆盖 locallang.xlf 文件中的内容:

<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<xliff version="1.0">
    <file source-language="en" datatype="plaintext" original="messages" date="2014-05-02T12:00:00Z" product-name="powermail">
        <header/>
        <body>
            <trans-unit id="validationerror_mandatory">
                <source>Custom text</source>
            </trans-unit>
        </body>
    </file>
</xliff>

【问题讨论】:

    标签: typo3 typo3-7.6.x


    【解决方案1】:

    看看https://docs.typo3.org/typo3cms/CoreApiReference/7.6/Internationalization/Translation/Index.html:

    您可能需要:

    1) 声明您的 XLF:

    $GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride']['EXT:powermail/Resources/Private/Language/locallang.xlf'][] = 'EXT:website_head/Resources/Private/Language/Overrides/powermail/Resources/Private/Language/custom.xlf';
    

    2) 覆盖标签:

    <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
    <xliff version="1.0">
         <file source-language="en" datatype="plaintext" original="messages" date="2013-03-09T18:44:59Z" product-name="website_head">
                 <header/>
                 <body>
                         <trans-unit id="validationerror_mandatory" xml:space="preserve">
                                 <source>Custom text</source>
                         </trans-unit>
                 </body>
         </file>
    </xliff>
    

    【讨论】:

    • 第 2 步只是在您的示例中的“custom.xlf”文件中添加该代码,对吗?无论如何,我已经让它工作了。您显示的第一行代码解决了问题!非常感谢,今天学到了一些东西。
    猜你喜欢
    • 2016-12-06
    • 1970-01-01
    • 2016-05-26
    • 2019-05-12
    • 1970-01-01
    • 1970-01-01
    • 2017-05-07
    • 2018-03-31
    • 1970-01-01
    相关资源
    最近更新 更多