// Load the localization file $labels = t3lib_div::readLLfile('EXT:my_extension/Resources/Private/Language/locallang.xml', 'en'); // Output a specific label echo $labels['my_label_key'];
// Load the localization file for the current page $labels = t3lib_div::readLLfile($this->getPageRenderer()->getLLLPath('EXT:my_extension/Resources/Private/Language/locallang.xml')); // Output all labels as a JSON object echo json_encode($labels);
// Load the localization files for different extensions $labels1 = t3lib_div::readLLfile('EXT:my_extension/Resources/Private/Language/locallang.xml', 'en'); $labels2 = t3lib_div::readLLfile('EXT:my_other_extension/Resources/Private/Language/locallang.xml', 'en'); // Merge the arrays $mergedLabels = array_merge($labels1, $labels2); // Output a specific label echo $mergedLabels['my_label_key'];In this example, we're loading two different localization files and then merging their arrays together. We can then access labels from both files using the merged array. Based on these examples, it's clear that t3lib_div is a package library for use in TYPO3 applications.