2

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

Falk
  • 621
  • 2
  • 9
  • 23
  • Did you try to remove the second line? Form my experience it is not needed. Once you define a an override like this: `$GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride']['EXT:news/Resources/Private/Language/locallang.xlf'][] = 'fileadmin/template/html/news/Private/Language/locallang.xlf';` it should work for all translations as well, as soon as they are located under same folder as main override file. – Viktor Livakivskyi Dec 07 '16 at 12:41

3 Answers3

3

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>
Norman
  • 785
  • 7
  • 27
1

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.

Daniel
  • 6,916
  • 2
  • 36
  • 47
0

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'
gautamsinh mori
  • 314
  • 2
  • 8
  • What does one have to do with that code? Put it in the new file? You can [edit] your answer to clarify that. – Baum mit Augen May 05 '17 at 20:28
  • As I know that Typo3 will load AdditionalConfiguration.php file every-time and if you put above code in em_localconf.php then it will load when extension loaded or just one time when extension is installed Thank you!! – gautamsinh mori May 08 '17 at 09:50