From e03ec73233b4907b83fea0998a2b7dc38e6027d3 Mon Sep 17 00:00:00 2001 From: fisharebest Date: Sun, 17 Oct 2010 14:06:21 +0000 Subject: Allow translation of country names into multiple languages --- includes/classes/class_stats.php | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'includes/classes') diff --git a/includes/classes/class_stats.php b/includes/classes/class_stats.php index f810952d96..abcc92bc4b 100644 --- a/includes/classes/class_stats.php +++ b/includes/classes/class_stats.php @@ -1049,18 +1049,23 @@ class stats { } function chartDistribution($chart_shows='world', $chart_type='', $surname='') { - global $iso3166, $countries; - global $WT_STATS_CHART_COLOR1, $WT_STATS_CHART_COLOR2, $WT_STATS_CHART_COLOR3, $WT_STATS_MAP_X, $WT_STATS_MAP_Y; + global $iso3166, $WT_STATS_CHART_COLOR1, $WT_STATS_CHART_COLOR2, $WT_STATS_CHART_COLOR3, $WT_STATS_MAP_X, $WT_STATS_MAP_Y; - if ($this->totalPlaces()==0) return ''; + if ($this->totalPlaces()==0) { + return ''; + } - // TODO: add translations from *ALL* languages, not just the current one. - // TODO (longer term): use a proper geographic database! + // Get the country names for each language $country_to_iso3166=array(); - foreach ($iso3166 as $three=>$two) { - $country_to_iso3166[$three]=$two; - $country_to_iso3166[$countries[$three]]=$two; + foreach (i18n::installed_languages() as $code=>$lang) { + i18n::init($code); + $countries=get_all_countries(); + foreach ($iso3166 as $three=>$two) { + $country_to_iso3166[$three]=$two; + $country_to_iso3166[$countries[$three]]=$two; + } } + i18n::init(WT_LOCALE); switch ($chart_type) { case 'surname_distribution_chart': if ($surname=="") $surname = $this->getCommonSurname(); -- cgit v1.3