aboutsummaryrefslogtreecommitdiffstats
path: root/en/doc/doc.php
diff options
context:
space:
mode:
Diffstat (limited to 'en/doc/doc.php')
-rw-r--r--en/doc/doc.php110
1 files changed, 110 insertions, 0 deletions
diff --git a/en/doc/doc.php b/en/doc/doc.php
new file mode 100644
index 000000000..b2b358a5b
--- /dev/null
+++ b/en/doc/doc.php
@@ -0,0 +1,110 @@
+<?php
+
+$documentation['installer' ][4] = array('ca','cs','de','el','en','eo','es','et','fr','id','nl','pl','pt_br','ro','ru','sv','tr','uk');
+$documentation['control_center'][4] = array('en','et','fr','ru','tr','uk');
+
+$documentation['installer' ][3] = array('de','el','en','es','et','fr','nl','pt_br','ru','uk');
+$documentation['control_center'][3] = array('en','et','fr');
+
+$documentation['installer' ][2] = array('de','el','en','eo','fr','nl','pt_br','uk');
+
+function doc_present_in_locale($documentation_name, $version)
+{
+ global $locale;
+ global $documentation;
+ $link_locale = locale_hyphen_underscore($locale); // create pt_br.po from pt-br and alike
+ if(in_array($link_locale, $documentation[$documentation_name][$version])) {
+ return $link_locale;
+ } else {
+ return 'en';
+ }
+}
+
+function doc_list($documentation_name, $type, $version, $link, $epub_link = null, $pdf_link = null)
+{
+ global $locale;
+ global $langs;
+ global $documentation;
+ $link_locale = locale_hyphen_underscore($locale); // create pt_br.po from pt-br and alike
+ $your_language = '';
+ $others = '';
+ $text_others = '';
+ $your_language_present = FALSE;
+ $other_languages_present = FALSE;
+ $note_printed = FALSE;
+ // temporary hidding of the EPUB and PDF links
+ $hide_epub_pdf = TRUE;
+ $table = PHP_EOL . '<table class="dlt2 dlinfo" style="font-size: 10pt;">' . PHP_EOL;
+// $table .= '<thead><tr><th></th></tr></thead>';
+ $table .= "\t<tbody>" . 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
+ if ($lng == 'pt_br') {
+ $lng_name = $langs['pt-br'];
+ } else if ($lng == 'sv') { // hopefully temporary exception for sv which does not exist yet in www.mageia.org
+ $lng_name = 'Svenska';
+ } else {
+ $lng_name = $langs[$lng];
+ }
+
+ if ($link_locale == $lng) {
+ $your_language_present = TRUE;
+ if (is_null($epub_link) or is_null($pdf_link) or $hide_epub_pdf) {
+ $your_language = sprintf(_r('%s available in %s') . '<br/>%s',
+ '<span style="font-weight:bold">' . $documentation_name . '</span>', $lng_name, sprintf($link, $lng));
+ } else {
+ $your_language = sprintf(_r('%s available in %s') . '<br/>%s <span style="font-size: 07pt;">('.
+ _r('also as') . '%s , %s)</span>',
+ '<span style="font-weight:bold">' . $documentation_name . '</span>',
+ $lng_name, sprintf($link, $lng), sprintf($epub_link, $lng), sprintf($pdf_link, $lng));
+ }
+ } else {
+ $other_languages_present = TRUE;
+ if (is_null($epub_link) or is_null($pdf_link) or $hide_epub_pdf) {
+ $others[] = sprintf('%s<br/>%s', $lng_name, sprintf($link, $lng));
+ } else {
+ if(!$note_printed) {
+ $note = _r('also as');
+ $note_printed = TRUE;
+ } else {
+ $note = '';
+ }
+ $others[] = sprintf('%s<br/>%s <span style="font-size: 07pt;">(%s%s , %s)</span>',
+ $lng_name, sprintf($link, $lng), $note, sprintf($epub_link, $lng), sprintf($pdf_link, $lng), sprintf($link, $lng));
+ }
+ }
+ }
+ if ($your_language_present) {
+ $text_your_language = '<span style="font-weight:bold">' . _r('Documentation in your language:') . '</span><br/>';
+ if ($other_languages_present) {
+ $text_others = '<span style="font-weight:bold">' . _r('Other languages:') . '</span>';
+ }
+ $table .= sprintf("\t\t<tr><td>%s</td></tr>" . PHP_EOL .
+ "\t\t<tr><td>&nbsp;</td></tr>" . PHP_EOL .
+ "\t\t<tr><td>%s</td></tr>" . PHP_EOL,
+ $your_language, $text_others);
+ } else {
+ foreach($documentation[$type] as $single_version => $all_languages) {
+ if($single_version < $version && in_array($link_locale, $all_languages)) {
+ $language_present_before = "\t\t<tr><td>" .
+ sprintf(_r('Translation was present in %s before.<br/>Maybe you can check documentation for %s in Mageia %s.'),
+ $langs[$locale], $documentation_name, $single_version) . "</td></tr>" . PHP_EOL;
+ break;
+ } else {
+ $language_present_before = '';
+ }
+ }
+ $text_your_language = _r('Please help <a href="../community/">us</a> translate it in your language.') . '<br/>';
+ $table .= sprintf("\t\t<tr><td>%s</td></tr>" . PHP_EOL .
+ "\t\t<tr><td>%s</td></tr>" . PHP_EOL . '%s' .
+ "\t\t<tr><td>&nbsp;</td></tr>" . PHP_EOL,
+ '<span style="font-weight:bold">' . $documentation_name . '</span>', $text_your_language, $language_present_before);
+ }
+ foreach ($others as $other_languages) {
+ $table .= sprintf("\t\t<tr><td>%s</td></tr>" . PHP_EOL, $other_languages);
+ }
+ $table .= "\t</tbody>" . PHP_EOL;
+ $table .= "</table>" . PHP_EOL;
+
+ echo $table;
+}