From 1579e289972d200578cd9f528ee7a7ba30acce49 Mon Sep 17 00:00:00 2001 From: Filip Komar Date: Mon, 20 Jan 2014 23:00:37 +0000 Subject: moved function and languages out of layout pages --- en/doc/archive.php | 37 +------------------------------- en/doc/doc.php | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ en/doc/index.php | 58 ++----------------------------------------------- 3 files changed, 66 insertions(+), 92 deletions(-) create mode 100644 en/doc/doc.php (limited to 'en/doc') diff --git a/en/doc/archive.php b/en/doc/archive.php index 3e1f111a3..f0c66e2ec 100644 --- a/en/doc/archive.php +++ b/en/doc/archive.php @@ -3,41 +3,7 @@ define('HLANG', true); require '../../langs.php'; _lang_load($locale, 'documentation'); -function doc_list($languages, $link) -{ - global $locale; - global $langs; - $your_language = ''; - $others = ''; - $text_others = ''; - $your_language_present = FALSE; - $other_languages_present = FALSE; - foreach ($languages 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 - if ($lng == 'pt_br') { - $lng_name = $langs['pt-br']; - } else { - $lng_name = $langs[$lng]; - } - - if ($locale == $lng) { - $your_language_present = TRUE; - $your_language = sprintf($link . '

', $lng, $lng_name); - } else { - $other_languages_present = TRUE; - $others .= sprintf($link . '
', $lng, $lng_name); - } - } - if ($your_language_present) { - $text_your_language = _t('Documentation in your language:'); - if ($other_languages_present) { - $text_others = _t('There are also:') . '
'; - } - } else { - $text_your_language = _t('Please help us translate it in your language.') . '
'; - } - echo $text_your_language . $your_language . $text_others . $others; -} +require 'doc.php'; ?> @@ -63,7 +29,6 @@ function doc_list($languages, $link)

%s'); ?>

diff --git a/en/doc/doc.php b/en/doc/doc.php new file mode 100644 index 000000000..31481288d --- /dev/null +++ b/en/doc/doc.php @@ -0,0 +1,63 @@ + ' . $link . '

', $lng, $lng_name); + } else { + $your_language = sprintf($lng_name . ' ~> ' . $link . + ' ( available downloads: ' . + $epub_link . ', ' . $pdf_link . ')

', + $lng, $lng, $lng); + } + } else { + $other_languages_present = TRUE; + if (is_null($epub_link) or is_null($pdf_link)) { + $others .= sprintf($lng_name . ' ~> ' . $link . '
', $lng, $lng_name); + } else { + $others .= sprintf($lng_name . ' ~> ' . $link . + ' ( ' . $epub_link . + ', ' . $pdf_link . ')
', $lng, $lng, $lng); + } + } + } + if ($your_language_present) { + $text_your_language = _t('Documentation in your language:') . '
'; + if ($other_languages_present) { + $text_others = _t('There are also:') . '
'; + } + } else { + $text_your_language = _t('Please help us translate it in your language.') . '
'; + } + echo $text_your_language . $your_language . $text_others . $others; +} diff --git a/en/doc/index.php b/en/doc/index.php index fb90d5358..25ffbfaf7 100644 --- a/en/doc/index.php +++ b/en/doc/index.php @@ -3,59 +3,9 @@ define('HLANG', true); require '../../langs.php'; _lang_load($locale, 'documentation'); -function doc_list($languages, $link, $epub_link = null, $pdf_link = null) -{ - global $locale; - global $langs; - $your_language = ''; - $others = ''; - $text_others = ''; - $your_language_present = FALSE; - $other_languages_present = FALSE; - foreach ($languages as $lng) { - // hopefully temporary exception for pt-br and sv as convention for lang-abbrev in /langs.inc.php is different as link in doc.mageia.org - if ($lng == 'pt_br') { - $lng_name = $langs['pt-br']; - } else { - // hopefully temporary exception for sv which does not exist yet in www.mageia.org - if ($lng == 'sv') { - $lng_name = 'Swedish'; - } else { - $lng_name = $langs[$lng]; - } - } - if ($locale == $lng) { - $your_language_present = TRUE; - if (is_null($epub_link) or is_null($pdf_link)) { - $your_language = sprintf($lng_name . ' ~> ' . $link . '

', $lng, $lng_name); - } else { - $your_language = sprintf($lng_name . ' ~> ' . $link . - ' ( available downloads: ' . - $epub_link . ', ' . $pdf_link . ')

', - $lng, $lng, $lng); - } - } else { - $other_languages_present = TRUE; - if (is_null($epub_link) or is_null($pdf_link)) { - $others .= sprintf($lng_name . ' ~> ' . $link . '
', $lng, $lng_name); - } else { - $others .= sprintf($lng_name . ' ~> ' . $link . - ' ( ' . $epub_link . - ', ' . $pdf_link . ')
', $lng, $lng, $lng); - } - } - } - if ($your_language_present) { - $text_your_language = _t('Documentation in your language:') . '
'; - if ($other_languages_present) { - $text_others = _t('There are also:') . '
'; - } - } else { - $text_your_language = _t('Please help us translate it in your language.') . '
'; - } - echo $text_your_language . $your_language . $text_others . $others; -} +require 'doc.php'; + ?> @@ -83,7 +33,6 @@ function doc_list($languages, $link, $epub_link = null, $pdf_link = null)

HTML', 'EPUB', 'PDF'); @@ -92,7 +41,6 @@ function doc_list($languages, $link, $epub_link = null, $pdf_link = null)

HTML', 'EPUB', 'PDF'); @@ -103,14 +51,12 @@ function doc_list($languages, $link, $epub_link = null, $pdf_link = null)

HTML'); ?>

HTML'); ?>

-- cgit v1.2.1