aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFilip Komar <filip@mageia.org>2014-02-01 15:24:23 +0000
committerFilip Komar <filip@mageia.org>2014-02-01 15:24:23 +0000
commitbad35065a7db4589b08ed2f3b3fa109e552fb0d7 (patch)
tree63edf84308401f0e0e812dd2d574bf0e7f73d3e3
parent3ad03d2182d5cc4e5a3d4ea63a98ea138771d886 (diff)
downloadwww-bad35065a7db4589b08ed2f3b3fa109e552fb0d7.tar
www-bad35065a7db4589b08ed2f3b3fa109e552fb0d7.tar.gz
www-bad35065a7db4589b08ed2f3b3fa109e552fb0d7.tar.bz2
www-bad35065a7db4589b08ed2f3b3fa109e552fb0d7.tar.xz
www-bad35065a7db4589b08ed2f3b3fa109e552fb0d7.zip
create function locale_hyphen_underscore and make use of it
-rw-r--r--en/4/index.php23
-rw-r--r--en/about/license/license.php7
-rw-r--r--en/doc/doc.php19
-rw-r--r--langs.inc.php22
4 files changed, 48 insertions, 23 deletions
diff --git a/en/4/index.php b/en/4/index.php
index 8b02cf7b3..16ce50792 100644
--- a/en/4/index.php
+++ b/en/4/index.php
@@ -5,7 +5,7 @@ require '../../langs.php';
_lang_load($locale, '4');
?>
-<!doctype html>
+<!DOCTYPE html>
<html lang="<?php echo $locale; ?>">
<head>
<meta charset="utf-8">
@@ -18,7 +18,7 @@ _lang_load($locale, '4');
<script src="/g/js/jquery-1.10.1.min.js"></script>
<script src="/g/js/bjqs-1.3.min.js"></script>
</head>
-
+
<body class="downloads">
<?php echo $hsnav; ?>
<h1 id="mgnavtitle"><a href="../4/">Mageia 4</a></h1>
@@ -36,21 +36,22 @@ _lang_load($locale, '4');
<p><a href="../downloads/" style="background: #1272B1; color: white; padding: 0.9em; margin: 1em; display: inline-block; text-shadow: 0 1px 6px #000; border-radius: 3px;"><?php _e('Download it right away!');?></a></p>
<?php _h('Live ISO\'s let you try Mageia without installation. Use <a href="%s">these instructions</a> to put the Live ISO on a CD, DVD or USB device. Then you can run Mageia 4 directly from there, and try Mageia using one of the graphical user interfaces such as GNOME or KDE.', array('https://wiki.mageia.org/en/Installation_Media#Dump_Mageia_ISO_on_a_USB_flash_stick.3F'));
- _h('If you are happy with the Mageia experience, you can then install it onto your hard drive from the Live media.');
+ _h('If you are happy with the Mageia experience, you can then install it onto your hard drive from the Live media.');
- _h('The Classical ISO is the more traditional way to install Mageia directly. Take a look at the complete <a href="%s">documentation</a> for this installer.', array('../doc/'));
+ _h('The Classical ISO is the more traditional way to install Mageia directly. Take a look at the complete <a href="%s">documentation</a> for this installer.', array('../doc/'));
- _h('Mageia 4 includes several desktop managers including KDE, Gnome, XFCE, Mate, and Cinnamon.');
+ _h('Mageia 4 includes several desktop managers including KDE, Gnome, XFCE, Mate, and Cinnamon.');
- _h('There are lots of applications in the official repositories. You can have a look at the <a href="%s">Mageia Application Database</a> to get a complete list of packages inside Mageia.', array('http://mageia.madb.org'));
+ _h('There are lots of applications in the official repositories. You can have a look at the <a href="%s">Mageia Application Database</a> to get a complete list of packages inside Mageia.', array('http://mageia.madb.org'));
- _h('What\'s new?', null, 'h2');
+ _h('What\'s new?', null, 'h2');
_h('There\'s plenty of new goodness in Mageia 4, too much to include here - see the <a hreflang="en" href="%s">release notes</a> for an extensive exposé.',array('https://wiki.mageia.org/en/Mageia_4_Release_Notes'));
_h('To help users configure and use Mageia, and to provide some information about the community and the project, we\'ve added the new <a href="%s">MageiaWelcome</a>.It starts automatically when a session opens for the first time in any of the graphical environments.',array('https://wiki.mageia.org/en/Feature:MageiaWelcome'));
- _h('We\'ve added two new desktop environments: Mate and Cinnamon, both available from the classic installer DVD/ISO. To make it more friendly we re-factored the <a href="%s">custom desktop choice</a>.',array('//doc.mageia.org/installer/4/en/content/choosePackageGroups.html'));
+ require '../doc/doc.php';
+ _h('We\'ve added two new desktop environments: Mate and Cinnamon, both available from the classic installer DVD/ISO. To make it more friendly we re-factored the <a href="%s">custom desktop choice</a>.',array('//doc.mageia.org/installer/4/' . doc_present_in_locale('installer', 4) . '/content/choosePackageGroups.html'));
_h('There\'s been a lot of work done on Mageia software. Many packages were ported from Gtk2 to Gtk3, to use more modern components. We\'ve also ported all the tools from the deprecated usermode to polkit when privileges are needed.');
@@ -84,15 +85,15 @@ _lang_load($locale, '4');
_h('Mageia in context', null, 'h2');
_h('Mageia is both a Community and a Linux Distribution, with Mageia 4 being our fourth release.');
-
+
_h('Mageia 4 is supported by the <a href="%s">Mageia.org nonprofit organisation</a>, which is governed by a body of recognized and elected contributors.',array('../about/'));
-
+
_h('Mageia 4 has been made by more than <a href="%s">100 people from all around the world</a>.',array('//people.mageia.org/g/'));
_h('Our work adds to the excellent work of the wider Linux and Free Software community. We aim to blend all the excellent work done by the community, adding the special Mageia ingredients, to bring you the best, most stable, reliable and enjoyable experience we can make for regular users, developers and businesses.');
_h('We welcome new contributors to any of the many different teams that go to make up Mageia the Community, and we encourage you to <a href="%s">join us</a>.', array('../contribute'));
- ?>
+ ?>
</div>
</div>
diff --git a/en/about/license/license.php b/en/about/license/license.php
index 61431c067..a28c8adc2 100644
--- a/en/about/license/license.php
+++ b/en/about/license/license.php
@@ -22,12 +22,7 @@ function read_license_from_vcs($locale) {
if($locale == 'en') {
$po_locale = 'libDrakX.pot';
} else {
- preg_match("/(..)(-)(..)/", $locale, $parsed_locale);
- if(isset($parsed_locale[3])) { // create pt_BR.po from pt-br and alike
- $po_locale = $parsed_locale[1] . '_' . strtoupper($parsed_locale[3]) . '.po';
- } else {
- $po_locale = $locale . '.po';
- }
+ $po_locale = locale_hyphen_underscore($locale, true) . '.po'; // create pt_BR.po from pt-br and alike
}
// $po_files_path = "http://svnweb.mageia.org/soft/drakx/trunk/perl-install/share/po/";
// $po_files_end = "?view=co";
diff --git a/en/doc/doc.php b/en/doc/doc.php
index 0aa9e5884..8010876c8 100644
--- a/en/doc/doc.php
+++ b/en/doc/doc.php
@@ -8,17 +8,24 @@ $documentation['control_center'][3] = array('en','et','fr');
$documentation['installer' ][2] = array('de','el','en','eo','fr','nl','pt_br','uk');
-function doc_list($documentation_name, $type, $version, $link, $epub_link = null, $pdf_link = null)
+function doc_present_in_locale($documentation_name, $version)
{
global $locale;
- global $langs;
global $documentation;
- preg_match("/(..)(-)(..)/", $locale, $parsed_locale);
- if(isset($parsed_locale[3])) { // create pt_br.po from pt-br and alike
- $link_locale = $parsed_locale[1] . '_' . $parsed_locale[3];
+ $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 {
- $link_locale = $locale;
+ 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 = '';
diff --git a/langs.inc.php b/langs.inc.php
index c779efd9d..7180c9a1e 100644
--- a/langs.inc.php
+++ b/langs.inc.php
@@ -119,6 +119,28 @@ function relocate($langs, $page = '', $default_locale = 'en', $force_accept_lang
return $relocate;
}
+
+/**
+ * Create string pt_br from string pt-br and alike but leave the rest as is
+ * Return string.
+ * Do not exit the process.
+ *
+ * @param string $locale which we want to change
+ * @param boolean $version_of_locale_uppercase optional, true if we want second part in uppercase (pt_BR)
+ *
+ * @return string
+*/
+function locale_hyphen_underscore($locale, $version_of_locale_uppercase = false)
+{
+ preg_match("/(..)(-)(..)/", $locale, $parsed_locale);
+ if(isset($parsed_locale[3])) {
+ return $parsed_locale[1] . '_' . ($version_of_locale_uppercase ? strtoupper($parsed_locale[3]) : $parsed_locale[3]);
+ } else {
+ return $locale;
+ }
+}
+
+
/**
*/
function show_langs($langs)