diff options
author | Erik Michelson | 2020-08-13 15:08:27 +0200 |
---|---|---|
committer | Erik Michelson | 2020-08-13 15:23:56 +0200 |
commit | ce469b1e2d66a5f598d316e0836ea361a4ccc61a (patch) | |
tree | d7e560f288c39b53e28a7bcc250189a9da339282 /public/js | |
parent | e79b7e962de36f1259eda39a9d1d0c2f6d8d77dc (diff) |
Fixed setting moment.js locale to user-defined language
Signed-off-by: Erik Michelson <github@erik.michelson.eu>
Diffstat (limited to 'public/js')
-rw-r--r-- | public/js/extra.js | 7 | ||||
-rw-r--r-- | public/js/locale.js | 1 |
2 files changed, 7 insertions, 1 deletions
diff --git a/public/js/extra.js b/public/js/extra.js index 6cda6171..10c3735b 100644 --- a/public/js/extra.js +++ b/public/js/extra.js @@ -1,6 +1,6 @@ /* eslint-env browser, jquery */ /* eslint no-console: ["error", { allow: ["warn", "error"] }] */ -/* global moment, serverurl */ +/* global moment, serverurl, Cookies */ import Prism from 'prismjs' import hljs from 'highlight.js' @@ -31,6 +31,11 @@ require('../vendor/md-toc') var Viz = require('viz.js') const ui = getUIElements() +if (Cookies.get('locale')) { + const lang = Cookies.get('locale') + moment.locale(lang) +} + // auto update last change window.createtime = null window.lastchangetime = null diff --git a/public/js/locale.js b/public/js/locale.js index 670370d4..05c7b3e3 100644 --- a/public/js/locale.js +++ b/public/js/locale.js @@ -21,6 +21,7 @@ if (Cookies.get('locale')) { } locale.val(lang) +window.moment.locale(lang) $('select.ui-locale option[value="' + lang + '"]').attr('selected', 'selected') locale.change(function () { |