From 919bbda416c2add0463b2ae2fcf5b802f4efd59a Mon Sep 17 00:00:00 2001 From: filip Date: Tue, 28 Jun 2016 18:33:45 +0200 Subject: start with the common footer on some pages + separate function for it + separate css for it + expanding i18n function for that purpose (to accept more than one gettext file) --- en/5/download_index.php | 6 ++++-- en/about/index.php | 6 ++++-- en/doc/archive.php | 9 +++------ en/doc/index.php | 9 +++------ en/index.php | 29 +++------------------------- en/map/index.php | 4 +++- en/support/index.php | 6 ++++-- g/style/common_footer.css | 48 +++++++++++++++++++++++++++++++++++++++++++++++ langs.inc.php | 24 ++++++++++++++++-------- langs.php | 42 +++++++++++++++++++++++++++++++++++++++-- langs/.tx/config | 6 ++++++ tools/web_projects.dat | 6 ++++++ 12 files changed, 140 insertions(+), 55 deletions(-) create mode 100644 g/style/common_footer.css diff --git a/en/5/download_index.php b/en/5/download_index.php index 058653ddd..1b01b5e98 100755 --- a/en/5/download_index.php +++ b/en/5/download_index.php @@ -13,7 +13,7 @@ define('HLANG', true); define('ALIGNMENT', 'Center'); require '../../langs.php'; -$dictionary = read_translation_file($locale, "5"); +$dictionary = read_translation_file($locale, array('5', 'common_footer')); function get_mageia($name, $version, $release) { @@ -133,6 +133,7 @@ input[type="radio"], input[type="submit"] { border-radius: 6px; } + @@ -140,7 +141,7 @@ input[type="radio"], input[type="submit"] {

%s %s %s',$name, $version, $release)?>

-
+
@@ -626,5 +627,6 @@ $('img.lazy').each(function(){ }); + diff --git a/en/about/index.php b/en/about/index.php index 62043c885..4eadd7490 100644 --- a/en/about/index.php +++ b/en/about/index.php @@ -3,7 +3,7 @@ define('HLANG', true); define('ALIGNMENT', 'Center'); require '../../langs.php'; -$dictionary = read_translation_file($locale, "about"); +$dictionary = read_translation_file($locale, array('about', 'common_footer')); ?> @@ -22,11 +22,12 @@ $dictionary = read_translation_file($locale, "about"); width: 500px; } +

-
+
Mageia @@ -92,5 +93,6 @@ $dictionary = read_translation_file($locale, "about");
+ diff --git a/en/doc/archive.php b/en/doc/archive.php index f67c870eb..a873f946c 100644 --- a/en/doc/archive.php +++ b/en/doc/archive.php @@ -2,7 +2,7 @@ define('HLANG', true); define('ALIGNMENT', 'Center'); require '../../langs.php'; -$dictionary = read_translation_file($locale, 'documentation'); +$dictionary = read_translation_file($locale, array('documentation', 'common_footer')); require 'doc.php'; ?> @@ -13,6 +13,7 @@ require 'doc.php'; + @@ -58,10 +59,6 @@ require 'doc.php';
-
-
-

- |

-
+ diff --git a/en/doc/index.php b/en/doc/index.php index 880b2549d..12027bfb5 100644 --- a/en/doc/index.php +++ b/en/doc/index.php @@ -2,7 +2,7 @@ define('HLANG', true); define('ALIGNMENT', 'Center'); require '../../langs.php'; -$dictionary = read_translation_file($locale, 'documentation'); +$dictionary = read_translation_file($locale, array('documentation', 'common_footer')); require 'doc.php'; @@ -15,6 +15,7 @@ require 'doc.php'; + @@ -41,10 +42,6 @@ require 'doc.php';
-
-
-

- |

-
+ diff --git a/en/index.php b/en/index.php index 7ee7499eb..a72dd5339 100644 --- a/en/index.php +++ b/en/index.php @@ -4,15 +4,7 @@ define('HLANG', true); define('ALIGNMENT', 'Center'); require '../langs.php'; -$dictionary_1 = read_translation_file($locale, 'index'); -$dictionary_2 = read_translation_file($locale, 'news'); -$dictionary = array_merge($dictionary_1, $dictionary_2); - -$nav = array( - 'nav-support' => array('support/', _r('Support')), - 'nav-community' => array('community/', _r('Community')), - 'nav-about' => array('about/', _r('About Mageia.Org')) -); +$dictionary = read_translation_file($locale, array('index', 'news', 'common_footer')); ?> @@ -141,7 +133,7 @@ $nav = array( font: 60%/1.2 Verdana,Arial,sans-serif; color: #f0f0f0; } - #fnotes a { color: #ccc; text-decoration: none; } + #fnotes a { color: #aaa; text-decoration: none; } .free-dl { color: green; font-weight: bold; } /* Landscape phones and down */ @@ -285,22 +277,7 @@ $nav = array( -
-
-
- -
-

- - | -

-
-
+ diff --git a/en/map/index.php b/en/map/index.php index af3c263af..3fe54c3a9 100644 --- a/en/map/index.php +++ b/en/map/index.php @@ -2,7 +2,7 @@ define('HLANG', true); define('ALIGNMENT', 'Center'); require '../../langs.php'; -$dictionary = read_translation_file($locale, 'map'); +$dictionary = read_translation_file($locale, array('map', 'common_footer')); $map = array( 'about' => array( @@ -126,6 +126,7 @@ $sMap .= ''; + @@ -141,5 +142,6 @@ $sMap .= '';

--> + diff --git a/en/support/index.php b/en/support/index.php index 9d41238cb..fd298062c 100644 --- a/en/support/index.php +++ b/en/support/index.php @@ -2,7 +2,7 @@ define('HLANG', true); define('ALIGNMENT', 'Center'); require '../../langs.php'; -$dictionary = read_translation_file($locale, 'support'); +$dictionary = read_translation_file($locale, array('support', 'common_footer')); ?> @@ -13,6 +13,7 @@ $dictionary = read_translation_file($locale, 'support'); + @@ -29,7 +30,7 @@ $dictionary = read_translation_file($locale, 'support');
  • -
    +
    + diff --git a/g/style/common_footer.css b/g/style/common_footer.css new file mode 100644 index 000000000..dfa4eb297 --- /dev/null +++ b/g/style/common_footer.css @@ -0,0 +1,48 @@ +hr.divider { display: none; } + +.container { + margin: 0 auto; + max-width: 1024px; + padding-bottom: 40px; +} + +#navb { line-height: 1.4; } + +#navb { +padding: 0; +margin: 0 auto; +display: table; +border-radius: 4px; +font-size: 80%; +margin-bottom: 20px; +} + +#navb li { +display: table-cell; +padding: 0; +border-right: 1px solid #f0f0f0; +} + +#navb li:last-child { border: none; } + +#navb a { +font: 12.8px Verdana,Arial,sans-serif; +text-decoration: none; +padding: 20px 1em 20px 1em; +display: block; +min-width: 80px; +text-align: center; +color: #444; +} +#navb a:hover { +color: #2383C2; +} + + +#fnotes { +text-align: center; +font: 80%/1.2 Verdana,Arial,sans-serif; +color: #f0f0f0; +} + +#fnotes a { color: #aaa; text-decoration: none; } diff --git a/langs.inc.php b/langs.inc.php index 3a67aa463..c578dd2ee 100644 --- a/langs.inc.php +++ b/langs.inc.php @@ -438,21 +438,29 @@ function _lang_load($locale, $domain) { return i18n::_lang_load($locale, $domain * Do not exit the process. * * @param string $locale from which we want to create dictionary - * @param string $name_of_translation gettext filename + * @param mixed $name_of_translation string for one gettext filename or array for more * * @return array */ function read_translation_file($locale, $name_of_translation) { - if($name_of_translation == '../_nav/langs/en') { - $path_filename = '/_nav/langs/' . $locale . '.po'; + if(is_array($name_of_translation)) { + $dictionary = array(); + foreach($name_of_translation as $single_filename) { + $dictionary = array_merge($dictionary, read_translation_file($locale, $single_filename)); + } + return $dictionary; } else { - $path_filename = '/langs/' . $locale . '/' . $name_of_translation . '.po'; - } - if($locale == 'en') { - $path_filename .= 't'; + if ($name_of_translation == '../_nav/langs/en') { + $path_filename = '/_nav/langs/' . $locale . '.po'; + } else { + $path_filename = '/langs/' . $locale . '/' . $name_of_translation . '.po'; + } + if ($locale == 'en') { + $path_filename .= 't'; + } + return phpmo_parse_po_file(G_APP_ROOT . $path_filename); } - return phpmo_parse_po_file(G_APP_ROOT . $path_filename); } /** diff --git a/langs.php b/langs.php index 6849d781a..b3abe2d39 100644 --- a/langs.php +++ b/langs.php @@ -23,8 +23,8 @@ if ($_SERVER['HTTP_HOST'] == 'www-test.mageia.org') { //$g_app_root = realpath(dirname(__FILE__)); //define('G_APP_ROOT', $g_app_root); -$g_donate_amount = '--'; -$g_amount_remain = 'EUR 10,244.46'; +// $g_donate_amount = '--'; +// $g_amount_remain = 'EUR 10,244.46'; $G_coord_assos = << array('support/', _r('Support')), + 'nav-community' => array('community/', _r('Community')), + 'nav-about' => array('about/', _r('About Mageia.Org')) + ); + + $common_footer = '
    ' . PHP_EOL; + $common_footer .= '
    ' . PHP_EOL; + $common_footer .= '
    ' . PHP_EOL; + $common_footer .= ' ' . PHP_EOL; + $common_footer .= '
    ' . PHP_EOL; + $common_footer .= '

    ' . PHP_EOL; + $common_footer .= " " . _r('Sitemap') . '' . PHP_EOL; + $common_footer .= " | "; + $common_footer .= _r('Privacy policy') . '' . PHP_EOL; + $common_footer .= '

    ' . PHP_EOL; + $common_footer .= '
    ' . PHP_EOL; + $common_footer .= '
    ' . PHP_EOL; + + return $common_footer; +} diff --git a/langs/.tx/config b/langs/.tx/config index 611f60406..6c2372193 100644 --- a/langs/.tx/config +++ b/langs/.tx/config @@ -49,6 +49,12 @@ source_file = en/cauldron.pot source_lang = en type = PO +[mageia.page-common_footer] +file_filter = /common_footer.po +source_file = en/common_footer.pot +source_lang = en +type = PO + [mageia.page-community] file_filter = /community.po source_file = en/community.pot diff --git a/tools/web_projects.dat b/tools/web_projects.dat index a50754a9c..5614638aa 100644 --- a/tools/web_projects.dat +++ b/tools/web_projects.dat @@ -1,3 +1,5 @@ +# database of l10n resources for rebuild_gettext_catalogs.sh script + resources[about/code-of-conduct]="en/about/code-of-conduct/index.php" resources[about/constitution]="en/about/constitution/index.php" resources[about/license]="en/about/license/index.php" @@ -6,11 +8,14 @@ resources[about/policies/privacy]="en/about/policies/privacy/index.php" resources[about/reports]="en/about/reports/index.php" resources[about/values]="en/about/values/index.php" resources[downloads/get]="en/downloads/get/index.php" + resources[2]="en/2/download_index.php en/2/for-pc/index.php en/2/for-server/index.php en/2/index.php en/2/nav.php" resources[3]="en/3/download_index.php en/3/for-pc/index.php en/3/for-server/index.php en/3/index.php en/3/nav.php" resources[4]="en/4/download_index.php en/4/nav.php en/4/index.php" resources[5]="en/5/download_index.php en/5/nav.php en/5/index.php" + resources[cauldron]="en/6/download_index.php en/6/nav.php en/6/index.php" + resources[404]="404.php" resources[about]="en/about/index.php" resources[calendar]="en/calendar/index.php" @@ -26,3 +31,4 @@ resources[support]="en/support/index.php" resources[thank-you]="en/thank-you/index.php" resources[timeline]="en/timeline/index.php" resources[mognase]="_nav/lib.php" +resources[common_footer]="langs.php" -- cgit v1.2.1