Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrobocoder <anthon.pang@gmail.com>2009-08-22 18:02:52 +0400
committerrobocoder <anthon.pang@gmail.com>2009-08-22 18:02:52 +0400
commit85ec7dccd57e79d645d4ab93a3b4e9d96b2786d4 (patch)
tree1dac8949941eb6acc6eba532bff389f83cf1602f /core/Translate.php
parent57c0c88ca4b34ce81b80da710c281a7f28c0a9e8 (diff)
revert
git-svn-id: http://dev.piwik.org/svn/trunk@1423 59fd770c-687e-43c8-a1e3-f5a4ff64c105
Diffstat (limited to 'core/Translate.php')
-rw-r--r--core/Translate.php80
1 files changed, 35 insertions, 45 deletions
diff --git a/core/Translate.php b/core/Translate.php
index 7a5d0df5d2..40b4b96969 100644
--- a/core/Translate.php
+++ b/core/Translate.php
@@ -133,58 +133,48 @@ class Piwik_Translate
{
setlocale(LC_ALL, $GLOBALS['Piwik_translations']['General_Locale']);
}
+}
- /**
- * Returns translated string or given message if translation is not found.
- *
- * @param string Translation string index
- * @param array $args sprintf arguments
- * @return string
- */
- static public function translate($string, $args = array())
+/**
+ * Returns translated string or given message if translation is not found.
+ *
+ * @param string Translation string index
+ * @param array $args sprintf arguments
+ * @return string
+ */
+function Piwik_Translate($string, $args = array())
+{
+ if(!is_array($args))
{
- if(!is_array($args))
- {
- $args = array($args);
- }
- if(isset($GLOBALS['Piwik_translations'][$string]))
- {
- $string = $GLOBALS['Piwik_translations'][$string];
- }
- if(count($args) == 0)
- {
- return $string;
- }
- return vsprintf($string, $args);
+ $args = array($args);
}
-
- /**
- * Returns translated string or given message if translation is not found.
- * This function does not throw any exception. Use it to translate exceptions.
- *
- * @param string $message Translation string index
- * @param array $args sprintf arguments
- * @return string
- */
- static public function translateException($message, $args = array())
+ if(isset($GLOBALS['Piwik_translations'][$string]))
{
- try
- {
- return self::translate($message, $args);
- }
- catch(Exception $e)
- {
- return $message;
- }
+ $string = $GLOBALS['Piwik_translations'][$string];
}
+ if(count($args) == 0)
+ {
+ return $string;
+ }
+ return vsprintf($string, $args);
}
-function Piwik_Translate($string, $args = array())
-{
- return Piwik_Translate::translate($string, $args);
-}
-
+/**
+ * Returns translated string or given message if translation is not found.
+ * This function does not throw any exception. Use it to translate exceptions.
+ *
+ * @param string $message Translation string index
+ * @param array $args sprintf arguments
+ * @return string
+ */
function Piwik_TranslateException($message, $args = array())
{
- return Piwik_Translate::translateException($message, $args);
+ try
+ {
+ return Piwik_Translate($message, $args);
+ }
+ catch(Exception $e)
+ {
+ return $message;
+ }
}