0

I have created plugin and I have used locallang for labels. I am working on TYPO3 10 and I have used many locallang values in my template file for labels.

\TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('your_label_key','your_extensionName');

I tried this code it works fine, but it is only for one key or label.

I want all the translation in json formant (json file), is there any way to do that ?

Thanks in advance.

1 Answers1

0

I found an answer in another way.

It look like below,

    $fileContents= file_get_contents($url);
    $fileContents = str_replace(array("\n", "\r", "\t"), '', $fileContents);
    $fileContents = trim(str_replace('"', "'", $fileContents));
    $simpleXml = simplexml_load_string($fileContents);
    $json = json_encode($simpleXml);

First i store my locallang file into variable with file_get_contents($url);

Then with json_encode($xml), All locallang values converted into json format.