Falk
Falk

Reputation: 633

locallangXMLOverride is not working

I'm trying via ext_localconf.php of my own extension to override the locallang files for the news extension. So I placed in my own extension following lines:

$GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride']['EXT:news/Resources/Private/Language/locallang.xlf'][] = 'fileadmin/template/html/news/Private/Language/locallang.xlf';
$GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride']['sw']['EXT:news/Resources/Private/Language/locallang.xlf'][] = 'fileadmin/template/html/news/Private/Language/sw.locallang.xlf';

That just works for the default file.

When I'm writing

$GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride']['EXT:news/Resources/Private/Language/locallang.xlf'][] = 'fileadmin/template/html/news/Private/Language/locallang.xlf';
$GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride']['EXT:news/Resources/Private/Language/locallang.xlf']['sw'] = 'fileadmin/template/html/news/Private/Language/sw.locallang.xlf';

then its using the second file for everything. Trying to override EXT:news/Resources/Private/Language/sw.locallang.xlf doesn't work either.

When I switch the both lines above its using the default file in every language. I also created a file sw.locallang.xlf in news extension so that this exists. But ofcourse I dont want to need this file there because of the update issue.

I tried a lot of other codes too I could found, but nothing worked for me.

Somebody knows the correct way to use this translation files? Its TYPO3 7.6

Upvotes: 2

Views: 2075

Answers (3)

Michael Drauer
Michael Drauer

Reputation: 41

Only implement the default path in your ext_localconf

 $GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride']['EXT:news/Resources/Private/Language/locallang.xlf'][] = 'EXT:yourExtension/Resources/Private/Language/News/locallang.xlf';

then create one locallang.xlf in the directory and a sw.locallang.xlf

locallang.xlf

<xliff version="1.0">
    <file source-language="en" product-name="your_extension_news">
        <header/>
        <body>
            <trans-unit id="optin_seeMail">
                <source>thank you</source>
            </trans-unit>
        </body>
    </file>
</xliff>

sw.locallang.xlf

<?xml version="1.0" encoding="UTF-8"?>
<xliff version="1.0">
    <file source-language="en" target-language="sw" product-name="your_extension_news">
        <header/>
        <body>
            <trans-unit id="optin_seeMail">
                <target>Danke schön</target>
            </trans-unit>
        </body>
    </file>
</xliff>

Upvotes: 4

gautamsinh mori
gautamsinh mori

Reputation: 323

I have also fetch this issue while override language files of core extensions I have found one solution and its working for me First, make new file /typo3conf/AdditionalConfiguration.php. This file will be loaded every-time by typo3.

Then put code this code in it

$GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride']['EXT:indexed_search/Resources/Private/Language/locallang.xlf'][] = 'fileadmin/templates/indexed_search/Language/de.locallang.xlf';

$GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride']['fr']['EXT:indexed_search/Resources/Private/Language/locallang.xlf'][] = 'fileadmin/templates/indexed_search/Language/fr.locallang.xlf'

Upvotes: 0

Daniel
Daniel

Reputation: 7036

The language key has to be specified before the language file like this:

$GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride']['sw']['EXT:news/Resources/Private/Language/locallang.xlf'][] =
   'fileadmin/template/html/news/Private/Language/sw.locallang.xlf';

I'd recommend to put language files in an extension. Note: the extension with the language file must be installed.

Upvotes: 2

Related Questions