aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2018-10-15 07:59:17 +0000
committerMario <mario@mariovavti.com>2018-10-15 09:59:25 +0200
commiteb133ef9a7f208a8a21894c4f2bc32f3377221bb (patch)
tree32950bfaf29e10c0ac31fc1c9263d858f4a45529
parent337e25ad43dd0cbcee2385577c96315557245881 (diff)
downloadvolse-hubzilla-eb133ef9a7f208a8a21894c4f2bc32f3377221bb.tar.gz
volse-hubzilla-eb133ef9a7f208a8a21894c4f2bc32f3377221bb.tar.bz2
volse-hubzilla-eb133ef9a7f208a8a21894c4f2bc32f3377221bb.zip
Merge branch 'patch-16' into 'dev'
JS plurals displaying code cleanup See merge request hubzilla/core!1338 (cherry picked from commit 721461dd3e8cb6990ace54688ace953374506daf) b7280a44 JS plurals displaying code cleanup ab0e2f52 Update language.php f9c3b807 Update main.js ce52c27a Update main.js
-rw-r--r--include/language.php2
-rw-r--r--util/po2php.php2
-rw-r--r--view/js/main.js13
3 files changed, 9 insertions, 8 deletions
diff --git a/include/language.php b/include/language.php
index 18b942bce..e9d62e434 100644
--- a/include/language.php
+++ b/include/language.php
@@ -277,7 +277,7 @@ function ta($k){
function tf() {
$s = "plural_function_code";
- return (x(App::$strings, $s) ? App::$strings[$s] : "return 0;");
+ return (x(App::$strings, $s) ? App::$strings[$s] : "0");
}
/**
diff --git a/util/po2php.php b/util/po2php.php
index 4aea1c943..9ffcb64c4 100644
--- a/util/po2php.php
+++ b/util/po2php.php
@@ -60,7 +60,7 @@ function po2php_run($argc,$argv) {
$out .= '}}'."\n";
$out .= 'App::$rtl = ' . intval($rtl) . ";\n" ;
- $out .= 'App::$strings["plural_function_code"] = "return ' . str_replace("$", "", $cond) . ';"';
+ $out .= 'App::$strings["plural_function_code"] = "' . str_replace("$", "", $cond) . '"';
}
if ($k!="" && substr($l,0,7)=="msgstr "){
diff --git a/view/js/main.js b/view/js/main.js
index 0c16d0560..085bc8d0d 100644
--- a/view/js/main.js
+++ b/view/js/main.js
@@ -44,7 +44,7 @@ $(document).ready(function() {
$(document).on('click', '.conversation-settings-link', getConversationSettings);
$(document).on('click', '#settings_module_ajax_submit', postConversationSettings);
- var tf = new Function('n', aStr['plural_func']);
+ var tf = new Function('n', 's', 'var k = s.split("/")['+aStr['plural_func']+']; return (k ? k : s);');
jQuery.timeago.settings.strings = {
prefixAgo : aStr['t01'],
@@ -53,19 +53,20 @@ $(document).ready(function() {
suffixFromNow : aStr['t04'],
seconds : aStr['t05'],
minute : aStr['t06'],
- minutes : function(value){var str=aStr['t07'].split("/")[tf(value)]; return (str ? str : aStr['t07']);},
+ minutes : function(value){return tf(value, aStr['t07']);},
hour : aStr['t08'],
- hours : function(value){var str=aStr['t09'].split("/")[tf(value)]; return (str ? str : aStr['t09']);},
+ hours : function(value){return tf(value, aStr['t09']);},
day : aStr['t10'],
- days : function(value){var str=aStr['t11'].split("/")[tf(value)]; return (str ? str : aStr['t11']);},
+ days : function(value){return tf(value, aStr['t11']);},
month : aStr['t12'],
- months : function(value){var str=aStr['t13'].split("/")[tf(value)]; return (str ? str : aStr['t13']);},
+ months : function(value){return tf(value, aStr['t13']);},
year : aStr['t14'],
- years : function(value){var str=aStr['t15'].split("/")[tf(value)]; return (str ? str : aStr['t15']);},
+ years : function(value){return tf(value, aStr['t15']);},
wordSeparator : aStr['t16'],
numbers : aStr['t17'],
};
+
//mod_mail only
$(".mail-conv-detail .autotime").timeago();