Add "alias" wrappers for gettext functions
[gitphp.git] / include / Resource.class.php
blob:a/include/Resource.class.php -> blob:b/include/Resource.class.php
--- a/include/Resource.class.php
+++ b/include/Resource.class.php
@@ -242,3 +242,24 @@
 
 }
 
+
+/**
+ * Wrappers... because PHP doesn't support aliases
+ */
+function __($str)
+{
+	if (GitPHP_Resource::Instantiated())
+		return GitPHP_Resource::GetInstance()->translate($str);
+	return $str;
+}
+
+function __n($singular, $plural, $count)
+{
+	if (GitPHP_Resource::Instantiated())
+		return GitPHP_Resource::GetInstance()->ngettext($singular, $plural, $count);
+	if ($count > 1)
+		return $plural;
+	return $singular;
+}
+
+

comments