aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/js_strings.php19
-rw-r--r--include/language.php26
-rwxr-xr-xinclude/plugin.php5
3 files changed, 43 insertions, 7 deletions
diff --git a/include/js_strings.php b/include/js_strings.php
index d9038e838..c053e5666 100644
--- a/include/js_strings.php
+++ b/include/js_strings.php
@@ -38,6 +38,15 @@ function js_strings() {
// using the defaults set below if left untranslated, empty strings if
// translated to "NONE" and the corresponding language strings
// if translated to anything else
+ 'minutes' => tt('%d minutes', '%d minutes', '%d'),
+ 'hours' => tt('about %d hours', 'about %d hours', '%d'),
+ 'days' => tt('%d days', '%d days', '%d'),
+ 'months' => tt('%d months', '%d months', '%d'),
+ 'years' => tt('%d years', '%d years', '%d'),
+
+ // get plural function code
+ 'plural_func' => tf(),
+
'$t01' => ((t('timeago.prefixAgo') == 'timeago.prefixAgo') ? '' : ((t('timeago.prefixAgo') == 'NONE') ? '' : t('timeago.prefixAgo'))),
'$t02' => ((t('timeago.prefixFromNow') == 'timeago.prefixFromNow') ? '' : ((t('timeago.prefixFromNow') == 'NONE') ? '' : t('timeago.prefixFromNow'))),
'$t03' => ((t('timeago.suffixAgo') == 'timeago.suffixAgo') ? 'ago' : ((t('timeago.suffixAgo') == 'NONE') ? '' : t('timeago.suffixAgo'))),
@@ -46,15 +55,15 @@ function js_strings() {
// translatable main strings for jquery.timeago
'$t05' => t('less than a minute'),
'$t06' => t('about a minute'),
- '$t07' => t('%d minutes'),
+ '$t07' => ta('%d minutes'),
'$t08' => t('about an hour'),
- '$t09' => t('about %d hours'),
+ '$t09' => ta('about %d hours'),
'$t10' => t('a day'),
- '$t11' => t('%d days'),
+ '$t11' => ta('%d days'),
'$t12' => t('about a month'),
- '$t13' => t('%d months'),
+ '$t13' => ta('%d months'),
'$t14' => t('about a year'),
- '$t15' => t('%d years'),
+ '$t15' => ta('%d years'),
'$t16' => t(' '), // wordSeparator
'$t17' => ((t('timeago.numbers') != 'timeago.numbers') ? t('timeago.numbers') : '[]'),
diff --git a/include/language.php b/include/language.php
index 69a7e3004..e9d62e434 100644
--- a/include/language.php
+++ b/include/language.php
@@ -255,6 +255,32 @@ 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() {
+
+ $s = "plural_function_code";
+ return (x(App::$strings, $s) ? App::$strings[$s] : "0");
+}
+
+/**
* @brief Provide a fallback which will not collide with a function defined in
* any language file.
*
diff --git a/include/plugin.php b/include/plugin.php
index ce081401d..7a63cbfc1 100755
--- a/include/plugin.php
+++ b/include/plugin.php
@@ -1067,10 +1067,11 @@ function get_markup_template($s, $root = '') {
} else {
if (isset(\App::$override_markup_templates[$testroot][$s]["root"]) &&
isset(\App::$override_markup_templates[$testroot][$s]["file"])) {
- $s = \App::$override_markup_templates[$testroot][$s]["file"];
$root = \App::$override_markup_templates[$testroot][$s]["root"];
+ $s = \App::$override_markup_templates[$testroot][$s]["file"];
+ $template = $t->get_markup_template($s, $root);
} elseif (\App::$override_templateroot) {
- $newroot = \App::$override_templateroot.$root;
+ $newroot = \App::$override_templateroot . $root;
if ($newroot != '' && substr($newroot,-1) != '/' ) {
$newroot .= '/';
}