aboutsummaryrefslogtreecommitdiffstats
path: root/view
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2018-10-13 14:00:12 +0200
committerMario <mario@mariovavti.com>2018-10-13 14:00:12 +0200
commite5184458530bb0394e12026c82ee89257115f690 (patch)
tree9a4ee70d556fa355d527e679469725f9ec0b140d /view
parent8ce240b95c62f4b702b60977f63b0223a8ec0849 (diff)
parent6ae9ef571ea02aa5b80c575de70ecec1289c21db (diff)
downloadvolse-hubzilla-e5184458530bb0394e12026c82ee89257115f690.tar.gz
volse-hubzilla-e5184458530bb0394e12026c82ee89257115f690.tar.bz2
volse-hubzilla-e5184458530bb0394e12026c82ee89257115f690.zip
Merge branch 'patch-11' into 'dev'
Add date/time plurals translation in JavaScript See merge request hubzilla/core!1331
Diffstat (limited to 'view')
-rw-r--r--view/js/main.js41
-rwxr-xr-xview/tpl/js_strings.tpl2
2 files changed, 23 insertions, 20 deletions
diff --git a/view/js/main.js b/view/js/main.js
index 48277f5cc..3e81ba0e4 100644
--- a/view/js/main.js
+++ b/view/js/main.js
@@ -44,25 +44,28 @@ $(document).ready(function() {
$(document).on('click', '.conversation-settings-link', getConversationSettings);
$(document).on('click', '#settings_module_ajax_submit', postConversationSettings);
- jQuery.timeago.settings.strings = {
- prefixAgo : aStr['t01'],
- prefixFromNow : aStr['t02'],
- suffixAgo : aStr['t03'],
- suffixFromNow : aStr['t04'],
- seconds : aStr['t05'],
- minute : aStr['t06'],
- minutes : aStr['t07'],
- hour : aStr['t08'],
- hours : aStr['t09'],
- day : aStr['t10'],
- days : aStr['t11'],
- month : aStr['t12'],
- months : aStr['t13'],
- year : aStr['t14'],
- years : aStr['t15'],
- wordSeparator : aStr['t16'],
- numbers : aStr['t17'],
- };
+ var tf = new Function('n', aStr['plural_func']);
+
+ jQuery.timeago.settings.strings = {
+ prefixAgo : aStr['t01'],
+ prefixFromNow : aStr['t02'],
+ suffixAgo : aStr['t03'],
+ suffixFromNow : aStr['t04'],
+ seconds : aStr['t05'],
+ minute : aStr['t06'],
+ minutes : function(value){return aStr['t07'].split("/")[tf(value)];},
+ hour : aStr['t08'],
+ hours : function(value){return aStr['t09'].split("/")[tf(value)];},
+ day : aStr['t10'],
+ days : function(value){return aStr['t11'].split("/")[tf(value)];},
+ month : aStr['t12'],
+ months : function(value){return aStr['t13'].split("/")[tf(value)];},
+ year : aStr['t14'],
+ years : function(value){return aStr['t15'].split("/")[tf(value)];},
+ wordSeparator : aStr['t16'],
+ numbers : aStr['t17'],
+ };
+
//mod_mail only
$(".mail-conv-detail .autotime").timeago();
diff --git a/view/tpl/js_strings.tpl b/view/tpl/js_strings.tpl
index 01fc3f993..f7425ba98 100755
--- a/view/tpl/js_strings.tpl
+++ b/view/tpl/js_strings.tpl
@@ -34,7 +34,7 @@
'name_ok1' : "{{$name_ok1}}",
'name_ok2' : "{{$name_ok2}}",
-
+ 'plural_func' : "{{$plural_func}}",
't01' : "{{$t01}}",
't02' : "{{$t02}}",