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 | |
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')
-rwxr-xr-x | modules/API/Proxy.php | 4 | ||||
-rw-r--r-- | modules/LogStats/Db.php | 2 | ||||
-rw-r--r-- | modules/Translate.php | 31 | ||||
-rw-r--r-- | modules/ViewDataTable/GenerateGraphData.php | 2 |
4 files changed, 25 insertions, 14 deletions
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 <a target=_blank href='$exampleUrlRss1&format=xml'>last 10 days</a>"; } $exampleUrl = $prefixUrls . $exampleUrl ; - $str .= " [ Example in + $str .= " <span class=\"example\">[ Example in <a target=_blank href='$exampleUrl&format=xml'>XML</a>, <a target=_blank href='$exampleUrl&format=PHP&prettyDisplay=true'>PHP</a>, <a target=_blank href='$exampleUrl&format=JSON'>Json</a>, <a target=_blank href='$exampleUrl&format=Csv'>Csv</a>, <a target=_blank href='$exampleUrl&format=Html'>Basic html</a> $lastNUrls - ]"; + ]</span>"; } 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 { |