]> git.immae.eu Git - github/shaarli/Shaarli.git/blobdiff - application/Languages.php
Initialize a translation function
[github/shaarli/Shaarli.git] / application / Languages.php
diff --git a/application/Languages.php b/application/Languages.php
new file mode 100644 (file)
index 0000000..c8b0a25
--- /dev/null
@@ -0,0 +1,21 @@
+<?php
+
+/**
+ * Wrapper function for translation which match the API
+ * of gettext()/_() and ngettext().
+ *
+ * Not doing translation for now.
+ *
+ * @param string $text  Text to translate.
+ * @param string $nText The plural message ID.
+ * @param int    $nb    The number of items for plural forms.
+ *
+ * @return String Text translated.
+ */
+function t($text, $nText = '', $nb = 0) {
+    if (empty($nText)) {
+        return $text;
+    }
+    $actualForm = $nb > 1 ? $nText : $text;
+    return sprintf($actualForm, $nb);
+}