/** * Returns the localized label of the LOCAL_LANG key, $key * Notice that for debugging purposes prefixes for the output values can be set with the internal vars ->LLtestPrefixAlt and ->LLtestPrefix * * @param string $key The key from the LOCAL_LANG array for which to return the value. * @param string $alternativeLabel Alternative string to return IF no value is found set for the key, neither for the local language nor the default. * @param bool $hsc If TRUE, the output label is passed through htmlspecialchars() * @return string The value from LOCAL_LANG. */ public function pi_getLL($key, $alternativeLabel = '', $hsc = FALSE) { $word = NULL; if (!empty($this->LOCAL_LANG[$this->LLkey][$key][0]['target']) || isset($this->LOCAL_LANG_UNSET[$this->LLkey][$key])) { // The "from" charset of csConv() is only set for strings from TypoScript via _LOCAL_LANG if (isset($this->LOCAL_LANG_charset[$this->LLkey][$key])) { $word = $this->frontendController->csConv($this->LOCAL_LANG[$this->LLkey][$key][0]['target'], $this->LOCAL_LANG_charset[$this->LLkey][$key]); } else { $word = $this->LOCAL_LANG[$this->LLkey][$key][0]['target']; } } elseif ($this->altLLkey) { $alternativeLanguageKeys = GeneralUtility::trimExplode(',', $this->altLLkey, TRUE); $alternativeLanguageKeys = array_reverse($alternativeLanguageKeys); foreach ($alternativeLanguageKeys as $languageKey) { if (!empty($this->LOCAL_LANG[$languageKey][$key][0]['target']) || isset($this->LOCAL_LANG_UNSET[$languageKey][$key])) { // Alternative language translation for key exists $word = $this->LOCAL_LANG[$languageKey][$key][0]['target']; // The "from" charset of csConv() is only set for strings from TypoScript via _LOCAL_LANG if (isset($this->LOCAL_LANG_charset[$languageKey][$key])) { $word = $this->frontendController->csConv($word, $this->LOCAL_LANG_charset[$this->altLLkey][$key]); } break; } } } if ($word === NULL) { if (!empty($this->LOCAL_LANG['default'][$key][0]['target']) || isset($this->LOCAL_LANG_UNSET['default'][$key])) { // Get default translation (without charset conversion, english) $word = $this->LOCAL_LANG['default'][$key][0]['target']; } else { // Return alternative string or empty $word = isset($this->LLtestPrefixAlt) ? $this->LLtestPrefixAlt . $alternativeLabel : $alternativeLabel; } } $output = isset($this->LLtestPrefix) ? $this->LLtestPrefix . $word : $word; if ($hsc) { $output = htmlspecialchars($output); } return $output; }