From c9442c3859810d1ef4a6a23a0027629e5545de7d Mon Sep 17 00:00:00 2001 From: Erik Michelson Date: Thu, 13 Aug 2020 23:55:28 +0200 Subject: Made changed/created status translatable The current version of CodiMD/HedgeDoc does only support translations to be filled on server-side rendering. To allow the translation of the changed/created texts, I duplicated the container that holds the text, and pre-filed these containers with the translation server-side. The client just needs to hide the unneeded container and show the right one to show the translated status text. Signed-off-by: Erik Michelson --- public/js/extra.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'public/js/extra.js') diff --git a/public/js/extra.js b/public/js/extra.js index 0ba09388..a6b01a91 100644 --- a/public/js/extra.js +++ b/public/js/extra.js @@ -36,7 +36,8 @@ const ui = getUIElements() window.createtime = null window.lastchangetime = null window.lastchangeui = { - status: $('.ui-status-lastchange'), + statusChanged: $('.ui-status-lastchange.changed'), + statusCreated: $('.ui-status-lastchange.created'), time: $('.ui-lastchange'), user: $('.ui-lastchangeuser'), nouser: $('.ui-no-lastchangeuser') @@ -48,9 +49,11 @@ export function updateLastChange () { if (!window.lastchangeui) return if (window.createtime) { if (window.createtime && !window.lastchangetime) { - window.lastchangeui.status.text('created') + window.lastchangeui.statusChanged.hide() + window.lastchangeui.statusCreated.show() } else { - window.lastchangeui.status.text('changed') + window.lastchangeui.statusChanged.show() + window.lastchangeui.statusCreated.hide() } const time = window.lastchangetime || window.createtime window.lastchangeui.time.html(moment(time).fromNow()) -- cgit v1.2.3