diff options
Diffstat (limited to 'framework/I18N')
-rw-r--r-- | framework/I18N/core/CultureInfo.php | 12 | ||||
-rw-r--r-- | framework/I18N/core/DateTimeFormatInfo.php | 2 |
2 files changed, 13 insertions, 1 deletions
diff --git a/framework/I18N/core/CultureInfo.php b/framework/I18N/core/CultureInfo.php index 404c81fe..15370ebe 100644 --- a/framework/I18N/core/CultureInfo.php +++ b/framework/I18N/core/CultureInfo.php @@ -201,6 +201,18 @@ class CultureInfo }
/**
+ * Gets the CultureInfo that for this culture string
+ * @return CultureInfo invariant culture info is "en".
+ */
+ public static function getInstance($culture)
+ {
+ static $instances = array();
+ if(!isset($instances[$culture]))
+ $instances[$culture] = new CultureInfo($culture);
+ return $instances[$culture];
+ }
+
+ /**
* Determine if a given culture is valid. Simply checks that the
* culture data exists.
* @param string a culture
diff --git a/framework/I18N/core/DateTimeFormatInfo.php b/framework/I18N/core/DateTimeFormatInfo.php index 685a95c1..04ed0e73 100644 --- a/framework/I18N/core/DateTimeFormatInfo.php +++ b/framework/I18N/core/DateTimeFormatInfo.php @@ -173,7 +173,7 @@ class DateTimeFormatInfo return $culture->getDateTimeFormat();
else if(is_string($culture))
{
- $cultureInfo = new CultureInfo($culture);
+ $cultureInfo = CultureInfo::getInstance($culture);
return $cultureInfo->getDateTimeFormat();
}
else
|