aboutsummaryrefslogtreecommitdiffstats
path: root/_nav
diff options
context:
space:
mode:
authorRomain d'Alverny <rda@mageia.org>2012-05-14 15:44:20 +0000
committerRomain d'Alverny <rda@mageia.org>2012-05-14 15:44:20 +0000
commit088378baf123d354b11923e9048f63f9cff28aae (patch)
tree1c3b416f3cd97d8469e8750f6734fec4627e4de9 /_nav
parentf815f214aac2b881679193c824fffa6812577b07 (diff)
downloadwww-088378baf123d354b11923e9048f63f9cff28aae.tar
www-088378baf123d354b11923e9048f63f9cff28aae.tar.gz
www-088378baf123d354b11923e9048f63f9cff28aae.tar.bz2
www-088378baf123d354b11923e9048f63f9cff28aae.tar.xz
www-088378baf123d354b11923e9048f63f9cff28aae.zip
now use .lang files for _nav
Diffstat (limited to '_nav')
-rw-r--r--_nav/langs/de.lang17
-rw-r--r--_nav/langs/el.lang18
-rw-r--r--_nav/langs/es.lang17
-rw-r--r--_nav/langs/fr.lang37
-rw-r--r--_nav/langs/it.lang16
-rw-r--r--_nav/langs/pt.lang15
-rw-r--r--_nav/langs/ro.lang11
-rw-r--r--_nav/langs/ru.lang2
-rw-r--r--_nav/langs/tr.lang14
-rw-r--r--_nav/lib.php151
10 files changed, 199 insertions, 99 deletions
diff --git a/_nav/langs/de.lang b/_nav/langs/de.lang
new file mode 100644
index 000000000..601cf45bb
--- /dev/null
+++ b/_nav/langs/de.lang
@@ -0,0 +1,17 @@
+;About&nbsp;us
+Über
+
+;Downloads
+Herunterladen
+
+;Support
+Unterstützung
+
+;Community
+Gemeinshaft
+
+;Contribute
+Mitwirken
+
+;You
+You
diff --git a/_nav/langs/el.lang b/_nav/langs/el.lang
new file mode 100644
index 000000000..a7d4acf52
--- /dev/null
+++ b/_nav/langs/el.lang
@@ -0,0 +1,18 @@
+;About&nbsp;us
+Σχετικά
+
+;Downloads
+Λήψεις
+
+;Support
+Υποστήριξη
+
+;Community
+Community
+
+;Contribute
+Συνεισφέρετε
+
+;You
+You
+
diff --git a/_nav/langs/es.lang b/_nav/langs/es.lang
new file mode 100644
index 000000000..72621b775
--- /dev/null
+++ b/_nav/langs/es.lang
@@ -0,0 +1,17 @@
+;About&nbsp;us
+Acerca&nbsp;de
+
+;Downloads
+Descargas
+
+;Support
+Soporte
+
+;Community
+Comunidad
+
+;Contribute
+Contribuir
+
+;You
+Yo
diff --git a/_nav/langs/fr.lang b/_nav/langs/fr.lang
new file mode 100644
index 000000000..d9cee5204
--- /dev/null
+++ b/_nav/langs/fr.lang
@@ -0,0 +1,37 @@
+;About&nbsp;us
+À&nbsp;propos
+
+;Downloads
+Téléchargements
+
+;Support
+Aide
+
+;Community
+Communauté
+
+;Contribute
+Contribuer
+
+;You
+Vous
+
+;Go to mageia.org site map.
+Voir la carte du site.
+
+;Learn more about Mageia.
+En savoir plus sur Mageia.
+
+;Download Mageia ISO and updates.
+Téléchager Mageia, ISO et mises à jour.
+
+;Get support from Mageia community.
+Obtenir de l&rsquo;aide de la communauté.
+
+;
+
+;You too can build Mageia with us!
+Vous aussi pouvez faire grandir Mageia.
+
+;Your Mageia online account.
+Votre compte Mageia.
diff --git a/_nav/langs/it.lang b/_nav/langs/it.lang
new file mode 100644
index 000000000..0f0174f28
--- /dev/null
+++ b/_nav/langs/it.lang
@@ -0,0 +1,16 @@
+
+;About&nbsp;us
+A&nbsp;proposito&nbsp;di
+
+;Downloads
+Scarica
+
+;Support
+Supporto
+
+;Community
+Comunità
+
+;Contribute
+Contribuire
+
diff --git a/_nav/langs/pt.lang b/_nav/langs/pt.lang
new file mode 100644
index 000000000..cd9b0e71e
--- /dev/null
+++ b/_nav/langs/pt.lang
@@ -0,0 +1,15 @@
+
+;About&nbsp;us
+Acerca
+
+;Downloads
+Transferências
+
+;Support
+Suporte
+
+;Community
+Comunidade
+
+;Contribute
+Contribuir
diff --git a/_nav/langs/ro.lang b/_nav/langs/ro.lang
new file mode 100644
index 000000000..d3dad5672
--- /dev/null
+++ b/_nav/langs/ro.lang
@@ -0,0 +1,11 @@
+;About&nbsp;us
+Despre&nbsp;noi
+
+;Downloads
+Descărcați
+
+;Support
+Suport
+
+;Contribute
+Contribuiți \ No newline at end of file
diff --git a/_nav/langs/ru.lang b/_nav/langs/ru.lang
new file mode 100644
index 000000000..12abc2be9
--- /dev/null
+++ b/_nav/langs/ru.lang
@@ -0,0 +1,2 @@
+;Downloads
+Загрузить \ No newline at end of file
diff --git a/_nav/langs/tr.lang b/_nav/langs/tr.lang
new file mode 100644
index 000000000..06c8d6d9e
--- /dev/null
+++ b/_nav/langs/tr.lang
@@ -0,0 +1,14 @@
+;About&nbsp;us
+Hakkında
+
+;Downloads
+İndirmeler
+
+;Support
+Destek
+
+;Community
+Community
+
+;Contribute
+Katkıda Bulunun \ No newline at end of file
diff --git a/_nav/lib.php b/_nav/lib.php
index 7b7240ed9..b04484995 100644
--- a/_nav/lib.php
+++ b/_nav/lib.php
@@ -1,6 +1,47 @@
<?php
// definition
+class l10n
+{
+ public static $t;
+
+ /**
+ * Load langs/$lang.lang into global $_t array.
+ *
+ * @param string $lang
+ *
+ * @return void
+ */
+ function load($lang) {
+ $lang_file = __DIR__ . '/langs/' . $lang . '.lang';
+ if (file_exists($lang_file)) {
+ global $_t;
+ $f = file($lang_file);
+ foreach ($f as $k => $v) {
+ if (substr($v, 0, 1) == ';' && !empty($f[$k+1])) {
+ $_t[trim(substr($v, 1))] = trim($f[$k+1]);
+ }
+ }
+ }
+ }
+
+ /**
+ * Get value for key $s in global array $_t.
+ *
+ * @param string $s
+ *
+ * @return string
+ */
+ function _t($s) {
+ if (trim($s) == '')
+ return '';
+
+ global $_t;
+
+ return array_key_exists($s, $_t) ? $_t[$s] : $s;
+ }
+}
+
/**
* Produce navigation HTML code.
*
@@ -13,117 +54,29 @@
*/
function _mgnav_html($wrap = false, $lang = 'en', $inject = null, $vhost = '//www.mageia.org')
{
- if (!function_exists('_t')) {
- function _t($s = null, $opt = null) {
- if (!is_null($opt))
- $_t = $opt;
- else {
- global $_t;
- }
- return ($s == '' ? '-EMPTY-STRING-' : (array_key_exists($s, $_t) ? $_t[$s] : $s));
- }
- }
- $_t = array(
- 'en' => array(),
- 'fr' => array(
- 'About&nbsp;us' => 'À&nbsp;propos',
- 'Downloads' => 'Téléchargements',
- 'Support' => 'Aide',
- 'Community' => 'Communauté',
- 'Contribute' => 'Contribuer',
- 'You' => 'Vous'
- ),
- 'de' => array(
- 'About&nbsp;us' => 'Über',
- 'Downloads' => 'Herunterladen',
- 'Support' => 'Unterstützung',
- 'Community' => 'Gemeinshaft',
- 'Contribute' => 'Mitwirken',
- 'You' => 'You'
- ),
- 'el' => array(
- 'About&nbsp;us' => 'Σχετικά',
- 'Downloads' => 'Λήψεις',
- 'Support' => 'Υποστήριξη',
- 'Community' => 'Communauté',
- 'Contribute' => 'Συνεισφέρετε',
- 'You' => 'You'
- ),
- 'es' => array(
- 'About&nbsp;us' => 'Acerca de',
- 'Downloads' => 'Descargas',
- 'Support' => 'Soporte',
- 'Community' => 'Comunidad',
- 'Contribute' => 'Contribuir',
- 'You' => 'Yo'
- ),
- 'et' => array(
- 'About&nbsp;us' => 'About',
- 'Downloads' => 'Allalaadimine',
- 'Support' => 'Support',
- 'Community' => 'Community',
- 'Contribute' => 'Contribuer',
- 'You' => 'You'
- ),
- 'it' => array(
- 'About&nbsp;us' => 'A proposito di',
- 'Downloads' => 'Scarica',
- 'Support' => 'Supporto',
- 'Community' => 'Comunità',
- 'Contribute' => 'Contribuire',
- 'You' => 'You'
- ),
- 'pt' => array(
- 'About&nbsp;us' => 'Acerca',
- 'Downloads' => 'Transferências',
- 'Support' => 'Suporte',
- 'Community' => 'Comunidade',
- 'Contribute' => 'Contribuir',
- 'You' => 'You'
- ),
- 'ro' => array(
- 'About&nbsp;us' => 'Despre noi',
- 'Downloads' => 'Descărcați',
- 'Support' => 'Suport',
- 'Community' => 'Community',
- 'Contribute' => 'Contribuiți',
- 'You' => 'You'
- ),
- 'tr' => array(
- 'About&nbsp;us' => 'Hakkında',
- 'Downloads' => 'İndirmeler',
- 'Support' => 'Destek',
- 'Community' => 'Community',
- 'Contribute' => 'Katkıda Bulunun',
- 'You' => 'You'
- ),
- 'ru' => array(
- 'Downloads' => 'Загрузить'
- )
- );
+ l10n::load($lang);
- $lang = array_key_exists($lang, $_t) ? $lang : 'en';
- $_t = $_t[$lang];
- $tn = array(
- array('mageia', '$S/$L/map/', 'Mageia'),
- array('about', '$S/$L/about/', _t('About&nbsp;us', $_t)),
- array('downloads', '$S/$L/downloads/', _t('Downloads', $_t)),
- array('support', '$S/$L/support/', _t('Support', $_t)),
- array('community', '$S/$L/community/', _t('Community', $_t)),
- array('contribute', '$S/$L/contribute/', _t('Contribute', $_t)),
- array('you', '//identity.mageia.org/', _t('You', $_t))
+ $tn = array(
+ array('mageia', '$S/$L/map/', 'Mageia', l10n::_t('Go to mageia.org site map.')),
+ array('about', '$S/$L/about/', l10n::_t('About&nbsp;us', $_t), l10n::_t('Learn more about Mageia.')),
+ array('downloads', '$S/$L/downloads/', l10n::_t('Downloads', $_t), l10n::_t('Download Mageia ISO and updates.')),
+ array('support', '$S/$L/support/', l10n::_t('Support', $_t), l10n::_t('Get support from Mageia community.')),
+ array('community', '$S/$L/community/', l10n::_t('Community', $_t), l10n::_t('')),
+ array('contribute', '$S/$L/contribute/', l10n::_t('Contribute', $_t), l10n::_t('You too can build Mageia with us!')),
+ array('you', '//identity.mageia.org/', l10n::_t('You', $_t), l10n::_t('Your Mageia online account.'))
// <search>
);
$s = array();
foreach ($tn as $i) {
- $s[] = sprintf('<li><a href="%s" class="%s">%s</a></li>',
+ $s[] = sprintf('<li><a href="%s" class="%s" title="%s">%s</a></li>',
str_replace(
array('$L', '$S'),
array($lang, $vhost),
$i[1]
),
$i[0],
+ $i[3],
$i[2]
);
}