I use TYPO3 6.2.
In my extension, I need to get a l10n label in several languages at one time.
I know how to do that for the current front end language using:
TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate($key, $extName, $args)
How do I get the label in another language, other than the one used in front end?
As my project deadline is "yesterday", I've done it the following way. Maybe you can use it also, because I think asked feature is not supported by Typo3 LocalizationUtility...
Anyway, I added duplicated entries with a diferent key:
<trans-unit id="tx_auslastung_domain_model_therme.text.0">
<source>We are looking forward to your visit!</source>
</trans-unit>
<trans-unit id="tx_auslastung_domain_model_therme.text.0-en">
<source>We are looking forward to your visit!</source>
</trans-unit>
and in German xlf I have
<trans-unit id="tx_thermenauslastung_domain_model_therme.text.0">
<source>We are looking forward to your visit!</source>
<target>Wir freuen uns auf Ihren Besuch!</target>
</trans-unit>
So this way I can use Typo3 LocalizationUtility normaly, and if I need "en" text, then I read the same key with appended "-en".
Btw. my default Typo3 language is DE.
I know this is not a perfect solution. You should never use this, if there is better way.
In my defance, it works, and duplicated entries are in the .xlf file, that is a mess anyway. xD