mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-04-13 10:56:05 +00:00
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 <github@erik.michelson.eu>
This commit is contained in:
parent
da35e73346
commit
c9442c3859
2 changed files with 9 additions and 5 deletions
|
@ -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())
|
||||
|
|
|
@ -7,8 +7,9 @@
|
|||
<small>
|
||||
<span>
|
||||
<span class="ui-lastchangeuser" style="display: none;"> <i class="ui-user-icon small" data-toggle="tooltip" data-placement="right"></i></span>
|
||||
<span class="ui-no-lastchangeuser"> <i class="fa fa-clock-o fa-fw" style="width: 18px;"></i></span>
|
||||
<span class="text-uppercase ui-status-lastchange"></span>
|
||||
<span class="ui-no-lastchangeuser"> <i class="fa fa-clock-o fa-fw" style="width: 18px;"></i></span>
|
||||
<span class="text-uppercase ui-status-lastchange changed"><%= __('changed') %></span>
|
||||
<span class="text-uppercase ui-status-lastchange created"><%= __('created') %></span>
|
||||
<span class="ui-lastchange text-uppercase"></span>
|
||||
</span>
|
||||
<span class="ui-permission dropdown pull-right">
|
||||
|
|
Loading…
Add table
Reference in a new issue