%s', $dir, $version, '%s', '%s');
$pdf_link = sprintf('PDF', $version, $name, '%s', $title);
$epub_link = sprintf('EPUB', $version, $name, '%s', $title);
$link_locale = locale_hyphen_underscore($locale); // create pt_br.po from pt-br and alike
$your_language = '';
$others = array();
$text_others = '';
$your_language_present = FALSE;
$other_languages_present = FALSE;
$note_printed = FALSE;
$table = PHP_EOL . '
' . PHP_EOL;
foreach ($documentation[$type][$version] as $lng) {
// hopefully temporary exception for pt-br as convention for lang-abbrev in /langs.inc.php is different as link in doc.mageia.org
$lng_name = $langs[locale_underscore_to_hyphen($lng)];
$pdf_present = pdf_epub_present_in_locale(sprintf('Mageia%s_%s', $version, $name), $lng, 'pdf');
$epub_present = pdf_epub_present_in_locale(sprintf('Mageia%s_%s', $version, $name), $lng, 'epub');
$pdf_epub_links = array();
if ($pdf_present) {
$pdf_epub_links[] = sprintf($pdf_link, $lng);
}
if ($epub_present) {
$pdf_epub_links[] = sprintf($epub_link, $lng);
}
$pdf_epub_links = implode(', ', $pdf_epub_links);
$lang_doc_link = sprintf($doc_link, $lng, $lng_name);
if ($link_locale == $lng) {
$your_language_present = TRUE;
if (!$pdf_present && !$epub_present) {
$your_language = sprintf(_r('Online manual for %s available in %s') . '
',
'' . $documentation_name . '', $lang_doc_link);
} else {
$your_language = sprintf(_r('Online manual for %s available in %s') . '
('.
_r('also as file:') . ' %s)',
'' . $documentation_name . '',
$lang_doc_link, $pdf_epub_links);
}
} else {
$other_languages_present = TRUE;
if (!$pdf_present && !$epub_present) {
$others[] = $lang_doc_link;
} else {
if(!$note_printed) {
$note = _r('also as file:', ' ');
$note_printed = TRUE;
} else {
$note = '';
}
$others[] = sprintf('%s (%s%s)',
$lang_doc_link, $note, $pdf_epub_links, $lang_doc_link);
}
}
}
if ($your_language_present) {
$text_your_language = '' . _r('Documentation in your language:') . '
';
if ($other_languages_present) {
$text_others = '' . _r('Other languages:') . ' ↘ ';
}
$table .= sprintf("\t%s" . PHP_EOL .
"\t%s |
" . PHP_EOL .
'' . PHP_EOL ,
$your_language, $text_others, $name, $version);
} else {
foreach($documentation[$type] as $single_version => $all_languages) {
if($single_version < $version && in_array($link_locale, $all_languages)) {
$language_present_before = "\t\t" .
sprintf(_r('Translation was present in %s before. Maybe you can check documentation for %s in Mageia %s.'),
$langs[locale_underscore_to_hyphen($locale)], $documentation_name, $single_version) . " |
" . PHP_EOL;
break;
} else {
$language_present_before = '';
}
}
$text_your_language = _r('Please help us translate it in your language.') . '
';
$table .= sprintf("\t%s
" . PHP_EOL .
"\t%s ↘ " . PHP_EOL . '%s' .
"\t" . PHP_EOL ,
'' . $documentation_name . '', $text_your_language, $language_present_before, $name, $version);
}
foreach ($others as $other_languages) {
$table .= sprintf("\t\t%s |
" . PHP_EOL, $other_languages);
}
$table .= "\t" . PHP_EOL;
$table .= "
" . PHP_EOL;
echo $table;
}