diff options
author | mattpiwik <matthieu.aubry@gmail.com> | 2008-06-09 04:44:10 +0400 |
---|---|---|
committer | mattpiwik <matthieu.aubry@gmail.com> | 2008-06-09 04:44:10 +0400 |
commit | bf0716bfb6ef4128973d5dd211dac02490ab86a5 (patch) | |
tree | 8993f7ee5ff9a0dc7cb59a963ab85f93c23d7014 /modules/Translate.php | |
parent | 07b25eca5f81d6d08c768949931c387855ae3e08 (diff) |
- adding 7 new translations: german, spanish, italian, russian, ukranian, catalan, dutch
- translations fallback to english by default (customizable in config file)
- adding a few strings that weren't translatable before
- 'translationAvailable' plugin information entry is now optional (defaults to false)
refs #251
git-svn-id: http://dev.piwik.org/svn/trunk@518 59fd770c-687e-43c8-a1e3-f5a4ff64c105
Diffstat (limited to 'modules/Translate.php')
-rw-r--r-- | modules/Translate.php | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/modules/Translate.php b/modules/Translate.php index ec10daddff..63e99810ce 100644 --- a/modules/Translate.php +++ b/modules/Translate.php @@ -10,7 +10,6 @@ */
/**
- *
* @package Piwik
*/
class Piwik_Translate
@@ -33,26 +32,31 @@ class Piwik_Translate }
private function __construct()
- {
- $GLOBALS['Piwik_translations'] = array();
-
+ { + $translations = array(); + + $language = $this->getFallbackLanguageToLoad(); + require_once "lang/" . $language .".php"; + $this->addTranslationArray($translations); + $language = $this->getLanguageToLoad();
-
- $translations = array();
require_once "lang/" . $language .".php";
-
- $this->addTranslationArray($translations);
+ $this->addTranslationArray($translations); + + setlocale(LC_ALL, $GLOBALS['Piwik_translations']['General_Locale']);
}
public function addTranslationArray($translation)
- {
+ { + if(!isset($GLOBALS['Piwik_translations'])) + { + $GLOBALS['Piwik_translations'] = array(); + }
// we could check that no string overlap here
$GLOBALS['Piwik_translations'] = array_merge($GLOBALS['Piwik_translations'], $translation);
}
/**
- * Enter description here...
- *
* @return string the language filename prefix, eg "en" for english
* @throws exception if the language set in the config file is not a valid filename
*/
@@ -68,6 +72,11 @@ class Piwik_Translate {
throw new Exception("The language selected ('$language') is not a valid language file ");
}
+ } + + protected function getFallbackLanguageToLoad() + { + return Zend_Registry::get('config')->Language->fallback; }
/**
|