summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--classes/plugin.php19
-rwxr-xr-xclasses/pluginhost.php22
2 files changed, 18 insertions, 23 deletions
diff --git a/classes/plugin.php b/classes/plugin.php
index b90c603b7..5ac4a6a9a 100644
--- a/classes/plugin.php
+++ b/classes/plugin.php
@@ -40,4 +40,21 @@ abstract class Plugin {
function api_version() {
return Plugin::API_VERSION_COMPAT;
}
-} \ No newline at end of file
+
+ /* gettext-related helpers */
+
+ function __($msgid) {
+ return _dgettext(PluginHost::object_to_domain($this), $msgid);
+ }
+
+ function _ngettext($singular, $plural, $number) {
+ return _dngettext(PluginHost::object_to_domain($this), $singular, $plural, $number);
+ }
+
+ function T_sprintf() {
+ $args = func_get_args();
+ $msgid = array_shift($args);
+
+ return vsprintf($this->__($msgid), $args);
+ }
+}
diff --git a/classes/pluginhost.php b/classes/pluginhost.php
index ab2e3f979..f0dc0286c 100755
--- a/classes/pluginhost.php
+++ b/classes/pluginhost.php
@@ -1,26 +1,4 @@
<?php
-/* gettext helpers for plugins */
-
-function P__($plugin, $msgid) {
- return P_gettext($plugin, $msgid);
-}
-
-function P_gettext($plugin, $msgid) {
- return _dgettext(PLuginHost::object_to_domain($plugin), $msgid);
-}
-
-function P_ngettext($plugin, $singular, $plural, $number) {
- return _dngettext(PLuginHost::object_to_domain($plugin), $singular, $plural, $number);
-}
-
-function P_sprintf() {
- $args = func_get_args();
- $plugin = array_shift($args);
- $msgid = array_shift($args);
-
- return vsprintf(P__($plugin, $msgid), $args);
-}
-
class PluginHost {
private $pdo;
private $hooks = array();