From 9140914a241836f25d5e605317d4d724a30816b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakobus=20Sch=C3=BCrz?= Date: Sat, 11 Mar 2023 17:26:00 +0100 Subject: [PATCH] make erromessages translateable --- src/App/Page.php | 6 ++++++ view/theme/frio/js/theme.js | 4 ++-- view/theme/frio/templates/js_strings.tpl | 10 ++++++++++ 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/App/Page.php b/src/App/Page.php index e22625212..c2a77b325 100644 --- a/src/App/Page.php +++ b/src/App/Page.php @@ -253,6 +253,12 @@ class Page implements ArrayAccess '$touch_icon' => $touch_icon, '$block_public' => intval($config->get('system', 'block_public')), '$stylesheets' => $this->stylesheets, + '$likeNetError' => $l10n->t('Like not successfull (Network error)'), + '$dislikeNetError' => $l10n->t('Dislike not successfull (Network error)'), + '$annonNetError' => $l10n->t('Sharing not successfull (Network error)'), + '$likeSrvError' => $l10n->t('Like not successfull (Backend error)'), + '$dislikeSrvError' => $l10n->t('Dislike not successfull (Backend error)'), + '$annonSrvError' => $l10n->t('Sharing not successfull (Backend error)'), ]) . $this->page['htmlhead']; } diff --git a/view/theme/frio/js/theme.js b/view/theme/frio/js/theme.js index 4d14df572..f6d681203 100644 --- a/view/theme/frio/js/theme.js +++ b/view/theme/frio/js/theme.js @@ -851,7 +851,7 @@ function doActivityItemAction(ident, verb, un) { $('button[id^=shareMenuOptions-' + ident.toString() + '] i:first-child').addClass('fa-share'); $('button[id^=' + verb + '-' + ident.toString() + '] i:first-child').addClass(thumbsClass); $('a[id^=' + verb + '-' + ident.toString() + '] i:first-child').addClass(thumbsClass); - $.jGrowl(verb + ' not successful (server error)', {sticky: false, theme: 'info', life: 5000}); + $.jGrowl(aActSrvErr[verb], {sticky: false, theme: 'info', life: 5000}); } }) .error(function(data){ @@ -860,7 +860,7 @@ function doActivityItemAction(ident, verb, un) { $('button[id^=shareMenuOptions-' + ident.toString() + '] i:first-child').addClass('fa-share'); $('button[id^=' + verb + '-' + ident.toString() + '] i:first-child').addClass(thumbsClass); $('a[id^=' + verb + '-' + ident.toString() + '] i:first-child').addClass(thumbsClass); - $.jGrowl(verb + ' not successful (network error)', {sticky: false, theme: 'info', life: 5000}); + $.jGrowl(aActNetErr[verb], {sticky: false, theme: 'info', life: 5000}); }); } diff --git a/view/theme/frio/templates/js_strings.tpl b/view/theme/frio/templates/js_strings.tpl index c27921afd..540009c82 100644 --- a/view/theme/frio/templates/js_strings.tpl +++ b/view/theme/frio/templates/js_strings.tpl @@ -10,4 +10,14 @@ They are loaded into the html so that js functions can use them *}} 'blockAuthor' : "{{$blockAuthor|escape:'javascript' nofilter}}", 'ignoreAuthor' : "{{$ignoreAuthor|escape:'javascript' nofilter}}", }; + var aActNetErr = { + 'like' : "{{$likeNetError}}", + 'dislike' : "{{$dislikeNetError}}", + 'announce' : "{{$annonNetError}}", + }; + var aActSrvErr = { + 'like' : "{{$likeSrvError}}", + 'dislike' : "{{$dislikeSrvError}}", + 'announce' : "{{$annonSrvError}}", + };