diff options
author | Robin Appelman <icewind@owncloud.com> | 2012-04-14 16:44:15 +0200 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2012-04-14 16:44:15 +0200 |
commit | b1bcc60d83866627b1b28a0eda336e0f246dbe8e (patch) | |
tree | a7100fbd8425e90c8b90888bc16a15349519038a /lib/l10n.php | |
parent | 721311c9099780ecc22b6b186ed79dc5c9c92271 (diff) | |
download | nextcloud-server-b1bcc60d83866627b1b28a0eda336e0f246dbe8e.tar.gz nextcloud-server-b1bcc60d83866627b1b28a0eda336e0f246dbe8e.zip |
reuse OC_L10N objects
Diffstat (limited to 'lib/l10n.php')
-rw-r--r-- | lib/l10n.php | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/l10n.php b/lib/l10n.php index 00bff08bf7f..c0ecdbd1b70 100644 --- a/lib/l10n.php +++ b/lib/l10n.php @@ -25,6 +25,11 @@ */ class OC_L10N{ /** + * cached instances + */ + protected static $instances=array(); + + /** * cache */ protected static $cache = array(); @@ -46,6 +51,21 @@ class OC_L10N{ 'date' => 'd.m.Y', 'datetime' => 'd.m.Y H:i:s', 'time' => 'H:i:s'); + + /** + * get an L10N instance + * @return OC_L10N + */ + public static function get($app,$lang=null){ + if(is_null($lang)){ + if(!isset(self::$instances[$app])){ + self::$instances[$app]=new OC_L10N($app); + } + return self::$instances[$app]; + }else{ + return new OC_L10N($app,$lang); + } + } /** * @brief The constructor |