From bf0716bfb6ef4128973d5dd211dac02490ab86a5 Mon Sep 17 00:00:00 2001 From: mattpiwik Date: Mon, 9 Jun 2008 00:44:10 +0000 Subject: - 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 --- modules/API/Proxy.php | 4 ++-- modules/LogStats/Db.php | 2 ++ modules/Translate.php | 31 +++++++++++++++++++---------- modules/ViewDataTable/GenerateGraphData.php | 2 +- 4 files changed, 25 insertions(+), 14 deletions(-) (limited to 'modules') diff --git a/modules/API/Proxy.php b/modules/API/Proxy.php index d143fb8e22..dba274eccc 100755 --- a/modules/API/Proxy.php +++ b/modules/API/Proxy.php @@ -263,14 +263,14 @@ class Piwik_API_Proxy XML of the last 10 days"; } $exampleUrl = $prefixUrls . $exampleUrl ; - $str .= " [ Example in + $str .= " [ Example in XML, PHP, Json, Csv, Basic html $lastNUrls - ]"; + ]"; } else { diff --git a/modules/LogStats/Db.php b/modules/LogStats/Db.php index c49fcd9151..7637b72fdf 100644 --- a/modules/LogStats/Db.php +++ b/modules/LogStats/Db.php @@ -83,6 +83,8 @@ class Piwik_LogStats_Db $this->connection = new PDO($this->dsn, $this->username, $this->password); $this->connection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); + // we may want to setAttribute(PDO::ATTR_TIMEOUT ) to a few seconds (default is 60) in case the DB is locked + // the piwik.php would stay waiting for the database... bad! // we delete the password from this object "just in case" it could be printed $this->password = ''; 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; } /** diff --git a/modules/ViewDataTable/GenerateGraphData.php b/modules/ViewDataTable/GenerateGraphData.php index 65c4b5304d..b8719bf923 100644 --- a/modules/ViewDataTable/GenerateGraphData.php +++ b/modules/ViewDataTable/GenerateGraphData.php @@ -89,7 +89,7 @@ abstract class Piwik_ViewDataTable_GenerateGraphData extends Piwik_ViewDataTable if(!$this->dataAvailable) { $this->view->customizeGraph(); - $this->view->title("No data for this graph", '{font-size: 25px;}'); + $this->view->title(Piwik_Translate('General_NoDataForGraph'), '{font-size: 25px;}'); } else { -- cgit v1.2.3