I have a own template and in this template I overwrite the templates of the tx_news:
plugin.tx_news.view {
templateRootPaths.1 = EXT:my_template/Resources/Private/News/Templates/
partialRootPaths.1 = EXT:my_template/Resources/Private/News/Partials/
layoutRootPaths.1 = EXT:my_template/Resources/Private/News/Layouts/
}
Now I would like to access the locallang.xlf from my_template. I tried this in the ext_table.php of my_template:
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addLLrefForTCAdescr(
'tt_content.pi_flexform.news_pi1.list', 'EXT:my_template/Resources/Private/Language/locallang.xlf');
And in this locallang.xlf I have:
<trans-unit id="tx_mytemplate.news">
<source>NEWSTEST</source>
</trans-unit>
And then in the tx_news List.html I have:
<f:translate key="tx_mytemplate.news" />
But I do not get any output.
There are two ways of accomplishing the task you are trying to do.
f:translate
ViewHelper like so: <f:translate key="tx_mytemplate.news" extensionName="MyTemplate" />
<f:translate key="LLL:EXT:my_template/Resources/Private/Language/locallang.xlf:tx_mytemplate.news" />
I would prefer the first way, because it is shorter and you can let extbase/fluid decide where to search for the file.