* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
*/
global $ID;
global $TPL;
global $conf;
$show_translation = false;
$translation_items = [];
$translation_label = '';
$translation = $TPL->getPlugin('translation');
$conf['plugin']['translation']['dropdown'] = 0;
if ($translation->istranslatable($ID)) {
$show_translation = true;
list($lc, $idpart) = $translation->getTransParts($ID);
$translation_label = $translation->getLang('translations');
foreach ($translation->translations as $t) {
// Old version of Translation plugin
if (method_exists($translation, 'getTransItem')) {
$translation_items[] = str_replace(array('
', '
'), '', $translation->getTransItem($t, $idpart));
} else {
list($target, $language) = $translation->buildTransID($t, $idpart);
$target = cleanID($target);
$exists = page_exists($target, '', false);
$link = wl($target);
$text = '';
$title = hsc($translation->getLocalName($language));
if (isset($translation->opts['flag'])) {
$text .= '' . inlineSVG(DOKU_PLUGIN . 'translation/flags/' . $language . '.svg', 1024 * 12) . '';
}
if (isset($translation->opts['name'])) {
$text .= hsc($translation->getLocalName($language));
if (isset($translation->opts['langcode'])) {
$text .= ' (' . hsc($language) . ')';
}
} elseif (isset($translation->opts['langcode'])) {
$text .= hsc($language);
}
$translation_items[] = '';
}
}
}
if ($show_translation):
?>