aboutsummaryrefslogtreecommitdiffstats
path: root/include/language.php
diff options
context:
space:
mode:
Diffstat (limited to 'include/language.php')
-rw-r--r--include/language.php28
1 files changed, 28 insertions, 0 deletions
diff --git a/include/language.php b/include/language.php
index 69a7e3004..c56d5acda 100644
--- a/include/language.php
+++ b/include/language.php
@@ -255,6 +255,34 @@ function tt($singular, $plural, $count, $ctx = ''){
}
/**
+ * @brief Return slash separated string of plurals translation forms
+ *
+ * @param string $k key in translations array
+ * @return string
+ */
+function ta($k){
+
+ $t = App::$strings[$k];
+ if (is_array($t))
+ $t = implode("/", $t);
+ return ($t == "" ? $k : $t);
+}
+
+/**
+ * @brief Return string_plural_select_xx function code
+ *
+ * @return string
+ */
+function tf() {
+
+ $r = "";
+ $lang = str_replace('-', '_', App::$language);
+ if(function_exists("string_plural_select_".$lang))
+ $r = trim(shell_exec("sed -n '5p' view/".$lang."/hstrings.php | grep 'return' | tr -d '$'"));
+ return ($r != "" ? $r : "return 0;");
+}
+
+/**
* @brief Provide a fallback which will not collide with a function defined in
* any language file.
*