diff options
author | Evan Prodromou <evan@status.net> | 2009-12-08 15:33:12 -0500 |
---|---|---|
committer | Evan Prodromou <evan@status.net> | 2009-12-08 15:33:12 -0500 |
commit | 28c367815fa9647ff9c369ddaf5e89b543e5b048 (patch) | |
tree | 9da401b68cd68de235724544bc33336b28eda728 /lib/plugin.php | |
parent | dfba47bdf4d3a8eda1778007e274c57de4c3451c (diff) | |
parent | 4b5e977a7b1c390555d880d3dc7f8b8c6744646c (diff) |
Merge branch '0.9.x' of git@gitorious.org:statusnet/mainline into 0.9.x
Diffstat (limited to 'lib/plugin.php')
-rw-r--r-- | lib/plugin.php | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/plugin.php b/lib/plugin.php index 2c77c3e12..de7313e59 100644 --- a/lib/plugin.php +++ b/lib/plugin.php @@ -65,6 +65,8 @@ class Plugin Event::addHandler(mb_substr($method, 2), array($this, $method)); } } + + $this->setupGettext(); } function initialize() @@ -77,6 +79,22 @@ class Plugin return true; } + /** + * Checks if this plugin has localization that needs to be set up. + * Gettext localizations can be called via the _m() helper function. + */ + protected function setupGettext() + { + $class = get_class($this); + if (substr($class, -6) == 'Plugin') { + $name = substr($class, 0, -6); + $path = INSTALLDIR . "/plugins/$name/locale"; + if (file_exists($path) && is_dir($path)) { + bindtextdomain($name, $path); + } + } + } + protected function log($level, $msg) { common_log($level, get_class($this) . ': '.$msg); @@ -87,3 +105,4 @@ class Plugin $this->log(LOG_DEBUG, $msg); } } + |