summaryrefslogtreecommitdiff
path: root/framework/I18N
diff options
context:
space:
mode:
authorchristophe.boulain <>2008-12-03 14:22:03 +0000
committerchristophe.boulain <>2008-12-03 14:22:03 +0000
commit6228873cf9d6471463d2413e7dfd7447f759baf2 (patch)
tree496a0e658330c39d4caa35602ba9f783b6f24f9c /framework/I18N
parente8f239fea7351b248302a593a8e5eaa2a88c3e80 (diff)
Merge from trunk
Diffstat (limited to 'framework/I18N')
-rw-r--r--framework/I18N/TDateFormat.php41
-rw-r--r--framework/I18N/TGlobalizationAutoDetect.php1
-rw-r--r--framework/I18N/TI18NControl.php1
-rw-r--r--framework/I18N/TNumberFormat.php29
-rw-r--r--framework/I18N/TTranslate.php1
-rw-r--r--framework/I18N/TTranslateParameter.php1
-rw-r--r--framework/I18N/Translation.php1
-rw-r--r--framework/I18N/core/CultureInfo.php1
-rw-r--r--framework/I18N/core/DateTimeFormatInfo.php1
-rw-r--r--framework/I18N/core/Gettext/MO.php1
-rw-r--r--framework/I18N/core/Gettext/PO.php1
-rw-r--r--framework/I18N/core/Gettext/TGettext.php1
-rw-r--r--framework/I18N/core/HTTPNegotiator.php1
-rw-r--r--framework/I18N/core/IMessageSource.php1
-rw-r--r--framework/I18N/core/MessageFormat.php1
-rw-r--r--framework/I18N/core/MessageSource_XLIFF.php2
-rw-r--r--framework/I18N/core/NumberFormat.php1
-rw-r--r--framework/I18N/core/NumberFormatInfo.php1
18 files changed, 63 insertions, 24 deletions
diff --git a/framework/I18N/TDateFormat.php b/framework/I18N/TDateFormat.php
index 2343011e..914131bd 100644
--- a/framework/I18N/TDateFormat.php
+++ b/framework/I18N/TDateFormat.php
@@ -4,7 +4,7 @@
*
* @author Wei Zhuo <weizhuo[at]gmail[dot]com>
* @link http://www.pradosoft.com/
- * @copyright Copyright &copy; 2005-2008 PradoSoft
+ * @copyright Copyright &copy; 2005-2008 PradoSoft
* @license http://www.pradosoft.com/license/
* @version $Id$
* @package System.I18N
@@ -51,6 +51,9 @@ Prado::using('System.I18N.TI18NControl');
* 'fulldate', 'longdate', 'mediumdate', 'shortdate', 'fulltime',
* 'longtime', 'mediumtime', and 'shorttime'. Custom patterns can specified
* when the Pattern property does not match the predefined patterns.
+ * - <b>DefaultText</b>, string,
+ * <br>Gets or sets the default text. If Value is not set, DefaultText will be
+ * shown instead of todays date and time.
*
* @author Xiang Wei Zhuo <weizhuo[at]gmail[dot]com>
* @version v1.0, last update on Sat Dec 11 15:25:11 EST 2004
@@ -146,7 +149,11 @@ class TDateFormat extends TI18NControl implements IDataRenderer
{
$value = $this->getViewState('Value','');
if(empty($value))
- return time();
+ {
+ $defaultText = $this->getDefaultText();
+ if(empty($defaultText))
+ return time();
+ }
return $value;
}
@@ -158,6 +165,24 @@ class TDateFormat extends TI18NControl implements IDataRenderer
{
$this->setViewState('Value',$value,'');
}
+
+ /**
+ * Get the default text value for this control.
+ * @return string default text value
+ */
+ public function getDefaultText()
+ {
+ return $this->getViewState('DefaultText','');
+ }
+
+ /**
+ * Set the default text value for this control.
+ * @param string default text value
+ */
+ public function setDefaultText($value)
+ {
+ $this->setViewState('DefaultText',$value,'');
+ }
/**
* Get the date-time value for this control.
@@ -193,6 +218,11 @@ class TDateFormat extends TI18NControl implements IDataRenderer
*/
protected function getFormattedDate()
{
+ $value = $this->getValue();
+ $defaultText = $this->getDefaultText();
+ if(empty($value) && !empty($defaultText))
+ return $this->getDefaultText();
+
$app = $this->getApplication()->getGlobalization();
//initialized the default class wide formatter
@@ -205,12 +235,12 @@ class TDateFormat extends TI18NControl implements IDataRenderer
if(strlen($culture) && $app->getCulture() !== $culture)
{
$formatter = new DateFormat($culture);
- return $formatter->format($this->getValue(),
+ return $formatter->format($value,
$this->getPattern(),
$this->getCharset());
}
//return the application wide culture formatted date time.
- $result = self::$formatter->format($this->getValue(),
+ $result = self::$formatter->format($value,
$this->getPattern(),
$this->getCharset());
return $result;
@@ -221,5 +251,4 @@ class TDateFormat extends TI18NControl implements IDataRenderer
$writer->write($this->getFormattedDate());
}
-}
-?>
+} \ No newline at end of file
diff --git a/framework/I18N/TGlobalizationAutoDetect.php b/framework/I18N/TGlobalizationAutoDetect.php
index b4611910..a77ea861 100644
--- a/framework/I18N/TGlobalizationAutoDetect.php
+++ b/framework/I18N/TGlobalizationAutoDetect.php
@@ -47,4 +47,3 @@ class TGlobalizationAutoDetect extends TGlobalization
}
}
-?>
diff --git a/framework/I18N/TI18NControl.php b/framework/I18N/TI18NControl.php
index 9060ee77..ac3246fe 100644
--- a/framework/I18N/TI18NControl.php
+++ b/framework/I18N/TI18NControl.php
@@ -88,4 +88,3 @@ class TI18NControl extends TControl
}
}
-?>
diff --git a/framework/I18N/TNumberFormat.php b/framework/I18N/TNumberFormat.php
index 12422521..62b43243 100644
--- a/framework/I18N/TNumberFormat.php
+++ b/framework/I18N/TNumberFormat.php
@@ -4,7 +4,7 @@
*
* @author Wei Zhuo <weizhuo[at]gmail[dot]com>
* @link http://www.pradosoft.com/
- * @copyright Copyright &copy; 2005-2008 PradoSoft
+ * @copyright Copyright &copy; 2005-2008 PradoSoft
* @license http://www.pradosoft.com/license/
* @version $Id$
* @package System.I18N
@@ -56,6 +56,9 @@ Prado::using('System.I18N.TI18NControl');
* The default is 'USD' if the Currency property is not specified.
* - <b>Pattern</b>, string,
* <br>Gets or sets the custom number formatting pattern.
+ * - <b>DefaultText</b>, string,
+ * <br>Gets or sets the default text. If Value is not set, DefaultText will be
+ * shown instead of the default currency Value/Pattern.
*
* @author Xiang Wei Zhuo <weizhuo[at]gmail[dot]com>
* @version v1.0, last update on Sat Dec 11 17:49:56 EST 2004
@@ -105,6 +108,23 @@ class TNumberFormat extends TI18NControl implements IDataRenderer
$this->setViewState('Value',$value,'');
}
+ /**
+ * Get the default text value for this control.
+ * @return string default text value
+ */
+ public function getDefaultText()
+ {
+ return $this->getViewState('DefaultText','');
+ }
+
+ /**
+ * Set the default text value for this control.
+ * @param string default text value
+ */
+ public function setDefaultText($value)
+ {
+ $this->setViewState('DefaultText',$value,'');
+ }
/**
* Get the numberic value for this control.
@@ -193,6 +213,11 @@ class TNumberFormat extends TI18NControl implements IDataRenderer
*/
protected function getFormattedValue()
{
+ $value = $this->getValue();
+ $defaultText = $this->getDefaultText();
+ if(empty($value) && !empty($defaultText))
+ return $this->getDefaultText();
+
$app = $this->getApplication()->getGlobalization();
//initialized the default class wide formatter
if(is_null(self::$formatter))
@@ -223,4 +248,4 @@ class TNumberFormat extends TI18NControl implements IDataRenderer
}
}
-?>
+?>
diff --git a/framework/I18N/TTranslate.php b/framework/I18N/TTranslate.php
index c3b28c79..2f1e0633 100644
--- a/framework/I18N/TTranslate.php
+++ b/framework/I18N/TTranslate.php
@@ -254,4 +254,3 @@ class TTranslate extends TI18NControl
}
}
-?>
diff --git a/framework/I18N/TTranslateParameter.php b/framework/I18N/TTranslateParameter.php
index 2b32b27b..37443133 100644
--- a/framework/I18N/TTranslateParameter.php
+++ b/framework/I18N/TTranslateParameter.php
@@ -117,4 +117,3 @@ class TTranslateParameter extends TControl
}
}
-?>
diff --git a/framework/I18N/Translation.php b/framework/I18N/Translation.php
index cb90577f..a0fa504d 100644
--- a/framework/I18N/Translation.php
+++ b/framework/I18N/Translation.php
@@ -106,4 +106,3 @@ class Translation extends TComponent
}
}
-?>
diff --git a/framework/I18N/core/CultureInfo.php b/framework/I18N/core/CultureInfo.php
index 46b833b7..7ee50bba 100644
--- a/framework/I18N/core/CultureInfo.php
+++ b/framework/I18N/core/CultureInfo.php
@@ -630,4 +630,3 @@ class CultureInfo
}
}
-?>
diff --git a/framework/I18N/core/DateTimeFormatInfo.php b/framework/I18N/core/DateTimeFormatInfo.php
index 0a99082d..aebd094a 100644
--- a/framework/I18N/core/DateTimeFormatInfo.php
+++ b/framework/I18N/core/DateTimeFormatInfo.php
@@ -514,4 +514,3 @@ class DateTimeFormatInfo
}
}
-?>
diff --git a/framework/I18N/core/Gettext/MO.php b/framework/I18N/core/Gettext/MO.php
index 2a85598a..2a97aee7 100644
--- a/framework/I18N/core/Gettext/MO.php
+++ b/framework/I18N/core/Gettext/MO.php
@@ -353,4 +353,3 @@ class TGettext_MO extends TGettext
return true;
}
}
-?>
diff --git a/framework/I18N/core/Gettext/PO.php b/framework/I18N/core/Gettext/PO.php
index edadbf9a..54fe10e3 100644
--- a/framework/I18N/core/Gettext/PO.php
+++ b/framework/I18N/core/Gettext/PO.php
@@ -158,4 +158,3 @@ class TGettext_PO extends TGettext
return true;
}
}
-?>
diff --git a/framework/I18N/core/Gettext/TGettext.php b/framework/I18N/core/Gettext/TGettext.php
index ea35154b..39e5d07e 100644
--- a/framework/I18N/core/Gettext/TGettext.php
+++ b/framework/I18N/core/Gettext/TGettext.php
@@ -284,4 +284,3 @@ class TGettext
return $PO;
}
}
-?>
diff --git a/framework/I18N/core/HTTPNegotiator.php b/framework/I18N/core/HTTPNegotiator.php
index f76efbe2..9199ba15 100644
--- a/framework/I18N/core/HTTPNegotiator.php
+++ b/framework/I18N/core/HTTPNegotiator.php
@@ -127,4 +127,3 @@ class HTTPNegotiator
}
}
-?>
diff --git a/framework/I18N/core/IMessageSource.php b/framework/I18N/core/IMessageSource.php
index eb0e5a1a..1d40bd73 100644
--- a/framework/I18N/core/IMessageSource.php
+++ b/framework/I18N/core/IMessageSource.php
@@ -120,4 +120,3 @@ interface IMessageSource
}
-?>
diff --git a/framework/I18N/core/MessageFormat.php b/framework/I18N/core/MessageFormat.php
index 21cf5f23..7af6deb1 100644
--- a/framework/I18N/core/MessageFormat.php
+++ b/framework/I18N/core/MessageFormat.php
@@ -253,4 +253,3 @@ class MessageFormat
}
}
-?>
diff --git a/framework/I18N/core/MessageSource_XLIFF.php b/framework/I18N/core/MessageSource_XLIFF.php
index f962e9a1..4c101bf0 100644
--- a/framework/I18N/core/MessageSource_XLIFF.php
+++ b/framework/I18N/core/MessageSource_XLIFF.php
@@ -502,7 +502,7 @@ class MessageSource_XLIFF extends MessageSource
{
$date = @date('c');
$xml = <<<EOD
-<?xml version="1.0"?>
+<?xml version="1.0" encoding="UTF-8"?>
<xliff version="1.0">
<file
source-language="EN"
diff --git a/framework/I18N/core/NumberFormat.php b/framework/I18N/core/NumberFormat.php
index 3edc6482..3b683c6c 100644
--- a/framework/I18N/core/NumberFormat.php
+++ b/framework/I18N/core/NumberFormat.php
@@ -304,4 +304,3 @@ class NumberFormat
}
}
-?>
diff --git a/framework/I18N/core/NumberFormatInfo.php b/framework/I18N/core/NumberFormatInfo.php
index 136a20eb..17149317 100644
--- a/framework/I18N/core/NumberFormatInfo.php
+++ b/framework/I18N/core/NumberFormatInfo.php
@@ -648,4 +648,3 @@ class NumberFormatInfo
}
}
-?>