From e8ff11191ab18f67f97d72d600da790ef4406b3f Mon Sep 17 00:00:00 2001 From: Filip Komar Date: Sun, 29 Dec 2013 22:06:03 +0000 Subject: function expanded to focus on chosen language + arrays simplified --- en/doc/index.php | 75 +++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 47 insertions(+), 28 deletions(-) (limited to 'en/doc/index.php') diff --git a/en/doc/index.php b/en/doc/index.php index f8cefbcdf..a36032396 100644 --- a/en/doc/index.php +++ b/en/doc/index.php @@ -3,11 +3,31 @@ define('HLANG', true); require '../../langs.php'; _lang_load($locale, 'documentation'); -function doc_list($languages, $link) +function doc_list($languages, $link, $locale) { - foreach ($languages as $lng) { - echo sprintf($link, $lng[0], $lng[1]); + $your_language = ''; + $others = ''; + $text_others = ''; + $your_language_present = FALSE; + $other_languages_present = FALSE; + foreach ($languages as $lng => $lng_name) { + 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; } ?> @@ -34,29 +54,29 @@ function doc_list($languages, $link)

'Deutsch', + 'el' => 'Ελληνικά', + 'en' => 'English', + 'es' => 'Español', + 'et' => 'Eesti', + 'fr' => 'Français', + 'nl' => 'Nederlands', + 'pt_br' => 'Português do Brasil', + 'ru' => 'Pусский', + 'uk' => 'Українська', ); - doc_list($mga3_installer, '%s
'); + doc_list($mga3_installer, '%s', $locale); ?>

'English', + 'et' => 'Eesti', + 'fr' => 'Français', ); - doc_list($mga3_control_center, '%s
'); + doc_list($mga3_control_center, '%s', $locale); ?>


@@ -65,17 +85,16 @@ function doc_list($languages, $link)

'Deutsch', + 'el' => 'Ελληνικά', + 'en' => 'English', + 'eo' => 'Esperanto', + 'fr' => 'Français', + 'nl' => 'Nederlands', + 'pt_br' => 'Português do Brasil', + 'uk' => 'Українська', ); - doc_list($mga2_installer, '%s
'); + doc_list($mga2_installer, '%s', $locale); ?>

-- cgit v1.2.1