diff options
author | sgiehl <stefan@piwik.org> | 2015-06-06 01:12:03 +0300 |
---|---|---|
committer | sgiehl <stefan@piwik.org> | 2015-06-06 01:12:03 +0300 |
commit | cc57e579f58b016768c77d30a6506783ca98e42a (patch) | |
tree | 642b48a0471bde86925e5a515dbfffe28a5e0ab2 /plugins/UserCountry | |
parent | eb1abd5a120f15fb8fc11ee083a7def0ef61b37b (diff) |
use new translations from Intl plugin
Diffstat (limited to 'plugins/UserCountry')
-rwxr-xr-x | plugins/UserCountry/LocationProvider.php | 2 | ||||
-rw-r--r-- | plugins/UserCountry/functions.php | 20 |
2 files changed, 18 insertions, 4 deletions
diff --git a/plugins/UserCountry/LocationProvider.php b/plugins/UserCountry/LocationProvider.php index 381f9faa00..01eef0f977 100755 --- a/plugins/UserCountry/LocationProvider.php +++ b/plugins/UserCountry/LocationProvider.php @@ -352,7 +352,7 @@ abstract class LocationProvider && !empty($location[self::CONTINENT_CODE_KEY]) ) { $continentCode = strtolower($location[self::CONTINENT_CODE_KEY]); - $location[self::CONTINENT_NAME_KEY] = Piwik::translate('UserCountry_continent_' . $continentCode); + $location[self::CONTINENT_NAME_KEY] = continentTranslate($continentCode); } // fill in country name if country code is present diff --git a/plugins/UserCountry/functions.php b/plugins/UserCountry/functions.php index 8ef8e1c4b0..830f026eda 100644 --- a/plugins/UserCountry/functions.php +++ b/plugins/UserCountry/functions.php @@ -43,7 +43,7 @@ function continentTranslate($label) if ($label == 'unk' || $label == '') { return Piwik::translate('General_Unknown'); } - return Piwik::translate('UserCountry_continent_' . $label); + return Piwik::translate('Intl_Continent_' . $label); } /** @@ -58,9 +58,23 @@ function countryTranslate($label) return Piwik::translate('General_Unknown'); } - $country = StaticContainer::get('Piwik\Translation\Translator')->getTranslatedCountry($label); + // Try to get name from Intl plugin + $key = 'Intl_Country_' . strtoupper($label); + $country = Piwik::translate($key); - return $country ? $country : Piwik::translate('UserCountry_country_' . $label); + if ($country != $key) { + return $country; + } + + // Handle special country codes + $key = 'UserCountry_country_' . $label; + $country = Piwik::translate($key); + + if ($country != $key) { + return $country; + } + + return Piwik::translate('General_Unknown'); } /** |