aboutsummaryrefslogtreecommitdiffstats
path: root/en
diff options
context:
space:
mode:
authorfilip <filip.komar@gmail.com>2020-05-06 19:14:42 +0200
committerfilip <filip.komar@gmail.com>2020-05-06 19:14:42 +0200
commitdc9e76731b08732fd110fb80b874907704a984b6 (patch)
tree835f60c48a635a5f4ccb62e5d4d6671827d7e9df /en
parentbaa9325189ff28b4508068c4ac0db10712b0c58b (diff)
downloadwww-dc9e76731b08732fd110fb80b874907704a984b6.tar
www-dc9e76731b08732fd110fb80b874907704a984b6.tar.gz
www-dc9e76731b08732fd110fb80b874907704a984b6.tar.bz2
www-dc9e76731b08732fd110fb80b874907704a984b6.tar.xz
www-dc9e76731b08732fd110fb80b874907704a984b6.zip
finally i18n countries and cities in DL page + update infrastructure for that
Diffstat (limited to 'en')
-rw-r--r--en/downloads/get/index.php24
-rw-r--r--en/downloads/get/lib.php136
2 files changed, 101 insertions, 59 deletions
diff --git a/en/downloads/get/index.php b/en/downloads/get/index.php
index 3ec90ebd2..add253c0f 100644
--- a/en/downloads/get/index.php
+++ b/en/downloads/get/index.php
@@ -33,9 +33,14 @@
*
*/
-require 'lib.php';
require_once '../../../lib/mga_geoip.php';
+define('HLANG', true);
+define('ALIGNMENT', 'Center');
+require '../../../langs.php';
+$dictionary = read_translation_file($locale, array('downloads/get', 'common_footer'));
+require 'lib.php';
+
// request
$product = get('q');
$doc = get('doc');
@@ -44,17 +49,11 @@ if (isset($_GET['torrent'])) {
$torrent = strip_tags(trim($_GET['torrent']));
}
$torrent = isset($torrent) ? true : false;
-
if (is_null($product)) {
header('Location: /downloads/');
die;
}
-define('HLANG', true);
-define('ALIGNMENT', 'Center');
-require '../../../langs.php';
-$dictionary = read_translation_file($locale, array('downloads/get', 'common_footer'));
-
session_start();
$download = null;
@@ -126,7 +125,12 @@ try {
$alt_dl_link, strtoupper($pm['scheme']), $pm['host']
);
}
- $s[] = sprintf('<td>%s</td><td>%s</td>', rewrite_city($city), implode(', ', $mirs));
+ if ("-" == $city) {
+ $city = _r("City not set");
+ }
+ $s[] = sprintf('<td>%s</td><td>%s</td>',
+ (isset($cities_i18n[$city])) ? $cities_i18n[$city] : $city,
+ implode(', ', $mirs));
}
$alternative_mirrors .= sprintf('<tr><td rowspan="%d">%s</td>%s</tr>' . PHP_EOL, count($cities), $country, implode('</tr><tr>', $s));
}
@@ -143,8 +147,8 @@ try {
_r('This <a href="%s">%s</a> download mirror is located in %s (%s).', ' '),
$one_mirror['mirror_url'],
$one_mirror['mirror_host'],
- rewrite_city($one_mirror['city']),
- $mirrors_country_name
+ ("-" == $one_mirror['city']) ? $mirrors_country_name : $one_mirror['city'],
+ ("-" == $one_mirror['city']) ? _r("City not set") : $mirrors_country_name
);
$dl2_mirror_alt .= _r('If it does not work well for you, <a href="#om" id="other_mirrors_btn">check out these other mirrors</a>.', ' ');
if (array_key_exists($_SESSION['country'], $countries)) {
diff --git a/en/downloads/get/lib.php b/en/downloads/get/lib.php
index 7f720cb08..a479a1f91 100644
--- a/en/downloads/get/lib.php
+++ b/en/downloads/get/lib.php
@@ -9,46 +9,93 @@
* @link http://www.mageia.org/
*
*/
-// _r('');
// note, we use geographical country names
-$countries = array(
- 'AR' => 'Argentina',
- 'AU' => 'Australia',
- 'BE' => 'Belgique',
- 'BG' => 'България - Bulgaria',
- 'BR' => 'Brasil',
- 'BY' => 'Беларусь - Belarus',
- 'CA' => 'Canada',
- 'CH' => 'Switzerland',
- 'CN' => '中国 - China',
- 'CZ' => 'Česko', // Czechia
- 'DE' => 'Deutschland',
- 'DK' => 'Danmark',
- 'EC' => 'Ecuador',
- 'ES' => 'España',
- 'FR' => 'France',
- 'GB' => 'Great Britain',
- 'GR' => 'Ελλάδα - Greece',
- 'GT' => 'Guatemala',
- 'ID' => 'Indonesia',
- 'IL' => 'Israel',
- 'IT' => 'Italia',
- 'JP' => '日本国 - Japan',
- 'NC' => 'Nouvelle-Calédonie',
- 'NL' => 'Nederlands',
- 'PH' => 'Philipines',
- 'PL' => 'Polska',
- 'RU' => 'Россия - Russia',
- 'SE' => 'Sverige',
- 'TR' => 'Türkiye',
- 'TW' => '臺灣 - Taiwan',
- 'UA' => 'Ukraine',
- 'UK' => 'the UK',
- 'US' => 'the USA',
- 'VN' => 'Vietnam',
- 'ZA' => 'South Africa'
+$countries = array (
+ 'AR' => _r("Argentina"),
+ 'AU' => _r("Australia"),
+ 'BE' => _r("Belgique"),
+ 'BG' => _r("България - Bulgaria"),
+ 'BR' => _r("Brasil"),
+ 'BY' => _r("Беларусь - Belarus"),
+ 'CA' => _r("Canada"),
+ 'CH' => _r("Switzerland"),
+ 'CN' => _r("中国 - China"),
+ 'CZ' => _r("Česko"),
+ 'DE' => _r("Deutschland"),
+ 'DK' => _r("Danmark"),
+ 'EC' => _r("Ecuador"),
+ 'ES' => _r("España"),
+ 'FR' => _r("France"),
+ 'GB' => _r("Great Britain"),
+ 'GR' => _r("Ελλάδα - Greece"),
+ 'GT' => _r("Guatemala"),
+ 'HU' => _r("Hungary"),
+ 'ID' => _r("Indonesia"),
+ 'IL' => _r("Israel"),
+ 'IT' => _r("Italia"),
+ 'JP' => _r("日本国 - Japan"),
+ 'NC' => _r("Nouvelle-Calédonie"),
+ 'NL' => _r("Nederlands"),
+ 'PH' => _r("Philipines"),
+ 'PL' => _r("Polska"),
+ 'RU' => _r("Россия - Russia"),
+ 'SE' => _r("Sverige"),
+ 'TR' => _r("Türkiye"),
+ 'TW' => _r("臺灣 - Taiwan"),
+ 'UA' => _r("Ukraine"),
+ 'UK' => _r("the UK"),
+ 'US' => _r("the USA"),
+ 'VN' => _r("Vietnam"),
+ 'ZA' => _r("South Africa"),
);
+$cities_i18n = array (
+ 'Adelaide' => _r("Adelaide"),
+ 'Amsterdam' => _r("Amsterdam"),
+ 'Ankara' => _r("Ankara"),
+ 'Beauharnois' => _r("Beauharnois"),
+ 'Beijing' => _r("Beijing"), // '北京', // .cn
+ 'Brasilia' => _r("Brasilia"),
+ 'Brisbane' => _r("Brisbane"),
+ 'Brno' => _r("Brno"),
+ 'Brussels' => _r("Brussels"),
+ 'Canterbury' => _r("Canterbury"),
+ 'Cebu' => _r("Cebu"),
+ 'Chungli' => _r("Chungli"),
+ 'Cuenca' => _r("Cuenca"),
+ 'DTU' => _r("DTU"),
+ 'Durham' => _r("Durham"),
+ 'Düsseldorf' => _r("Düsseldorf"),
+ 'Enschede' => _r("Enschede"),
+ 'Erlangen' => _r("Erlangen"),
+ 'Falkenstein/Vogtl.' => _r("Falkenstein/Vogtl."),
+ 'Göttingen' => _r("Göttingen"),
+ 'Heraklion' => _r("Heraklion"), // 'Ηράκλειο', // .gr
+ 'HsinChu' => _r("HsinChu"), // '新竹市', // .tw
+ 'Lenoir' => _r("Lenoir"),
+ 'Lyon' => _r("Lyon"),
+ 'Milan' => _r("Milan"),
+ 'Minsk' => _r("Minsk"), // 'Мінск', // .by
+ 'Miskolc' => _r("Miskolc"),
+ 'Moscow' => _r("Moscow"), // 'Москва', // .ru
+ 'Paris' => _r("Paris"),
+ 'Prague' => _r("Prague"), // 'Praha', // .cz
+ 'Princeton' => _r("Princeton"),
+ 'Schneverdingen' => _r("Schneverdingen"),
+ 'Shanghai' => _r("Shanghai"),
+ 'Sofia' => _r("Sofia"),
+ 'Stellenbosch' => _r("Stellenbosch"),
+ 'Taipei' => _r("Taipei"),
+ 'Tsukuba' => _r("Tsukuba"),
+ 'Umeå' => _r("Umeå"),
+ 'Vinnytsia' => _r("Vinnytsia"),
+ 'Warszawa' => _r("Warszawa"),
+ 'Yonezawa' => _r("Yonezawa"), // '米沢市', // .jp
+ 'ruchmond' => _r("ruchmond"),
+ 'Краснодар' => _r("Краснодар"),
+);
+
+
/**
* Rewrite city name in the local official language.
*
@@ -56,19 +103,10 @@ $countries = array(
*
* @return string
*/
-function rewrite_city($name)
+function rewrite_city($name, $cities_for_rewrite)
{
- $cities = array(
- 'HsinChu' => '新竹市', // .tw
- 'Yonezawa' => '米沢市', // .jp
- 'Beijing' => '北京', // .cn
- 'Moscow' => 'Москва', // .ru
- 'Minsk' => 'Мінск', // .by
- 'Heraklion' => 'Ηράκλειο', // .gr
- 'Prague' => 'Praha', // .cz
- );
- if (array_key_exists($name, $cities)) {
- return $cities[$name];
+ if (array_key_exists($name, $cities_for_rewrite)) {
+ return $cities_for_rewrite[$name];
}
return $name;