mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-14 15:14:56 -04:00
Fixed setting moment.js locale to user-defined language
Signed-off-by: Erik Michelson <github@erik.michelson.eu>
This commit is contained in:
parent
e79b7e962d
commit
ce469b1e2d
2 changed files with 7 additions and 1 deletions
|
@ -1,6 +1,6 @@
|
||||||
/* eslint-env browser, jquery */
|
/* eslint-env browser, jquery */
|
||||||
/* eslint no-console: ["error", { allow: ["warn", "error"] }] */
|
/* eslint no-console: ["error", { allow: ["warn", "error"] }] */
|
||||||
/* global moment, serverurl */
|
/* global moment, serverurl, Cookies */
|
||||||
|
|
||||||
import Prism from 'prismjs'
|
import Prism from 'prismjs'
|
||||||
import hljs from 'highlight.js'
|
import hljs from 'highlight.js'
|
||||||
|
@ -31,6 +31,11 @@ require('../vendor/md-toc')
|
||||||
var Viz = require('viz.js')
|
var Viz = require('viz.js')
|
||||||
const ui = getUIElements()
|
const ui = getUIElements()
|
||||||
|
|
||||||
|
if (Cookies.get('locale')) {
|
||||||
|
const lang = Cookies.get('locale')
|
||||||
|
moment.locale(lang)
|
||||||
|
}
|
||||||
|
|
||||||
// auto update last change
|
// auto update last change
|
||||||
window.createtime = null
|
window.createtime = null
|
||||||
window.lastchangetime = null
|
window.lastchangetime = null
|
||||||
|
|
|
@ -21,6 +21,7 @@ if (Cookies.get('locale')) {
|
||||||
}
|
}
|
||||||
|
|
||||||
locale.val(lang)
|
locale.val(lang)
|
||||||
|
window.moment.locale(lang)
|
||||||
$('select.ui-locale option[value="' + lang + '"]').attr('selected', 'selected')
|
$('select.ui-locale option[value="' + lang + '"]').attr('selected', 'selected')
|
||||||
|
|
||||||
locale.change(function () {
|
locale.change(function () {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue