mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-07-18 23:34:04 +02:00
Merge branch 'master' into fix/maintenance_drift
This commit is contained in:
commit
7bcf7c54bf
2 changed files with 26 additions and 6 deletions
19
src/i18n.js
19
src/i18n.js
|
@ -75,11 +75,20 @@ export function currentLocale() {
|
||||||
if (locale in messages) {
|
if (locale in messages) {
|
||||||
return locale;
|
return locale;
|
||||||
}
|
}
|
||||||
// some locales are further specified such as "en-US".
|
// If the locale is a 2-letter code, we can try to find a regional variant
|
||||||
// If we only have a generic locale for this, we can use it too
|
// e.g. "fr" may not be in the messages, but "fr-FR" is
|
||||||
const genericLocale = locale.split("-")[0];
|
if (locale.length === 2) {
|
||||||
if (genericLocale in messages) {
|
const regionalLocale = `${locale}-${locale.toUpperCase()}`;
|
||||||
return genericLocale;
|
if (regionalLocale in messages) {
|
||||||
|
return regionalLocale;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Some locales are further specified such as "en-US".
|
||||||
|
// If we only have a generic locale for this, we can use it too
|
||||||
|
const genericLocale = locale.slice(0, 2);
|
||||||
|
if (genericLocale in messages) {
|
||||||
|
return genericLocale;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return "en";
|
return "en";
|
||||||
|
|
|
@ -9,7 +9,8 @@
|
||||||
<div>{{ monitor.id }}</div>
|
<div>{{ monitor.id }}</div>
|
||||||
</div>
|
</div>
|
||||||
</h1>
|
</h1>
|
||||||
<p v-if="monitor.description">{{ monitor.description }}</p>
|
<!-- eslint-disable-next-line vue/no-v-html-->
|
||||||
|
<p v-if="monitor.description" v-html="descriptionHTML"></p>
|
||||||
<div class="d-flex">
|
<div class="d-flex">
|
||||||
<div class="tags">
|
<div class="tags">
|
||||||
<Tag v-for="tag in monitor.tags" :key="tag.id" :item="tag" :size="'sm'" />
|
<Tag v-for="tag in monitor.tags" :key="tag.id" :item="tag" :size="'sm'" />
|
||||||
|
@ -285,6 +286,8 @@ import Tag from "../components/Tag.vue";
|
||||||
import CertificateInfo from "../components/CertificateInfo.vue";
|
import CertificateInfo from "../components/CertificateInfo.vue";
|
||||||
import { getMonitorRelativeURL } from "../util.ts";
|
import { getMonitorRelativeURL } from "../util.ts";
|
||||||
import { URL } from "whatwg-url";
|
import { URL } from "whatwg-url";
|
||||||
|
import DOMPurify from "dompurify";
|
||||||
|
import { marked } from "marked";
|
||||||
import { getResBaseURL } from "../util-frontend";
|
import { getResBaseURL } from "../util-frontend";
|
||||||
import { highlight, languages } from "prismjs/components/prism-core";
|
import { highlight, languages } from "prismjs/components/prism-core";
|
||||||
import "prismjs/components/prism-clike";
|
import "prismjs/components/prism-clike";
|
||||||
|
@ -399,6 +402,14 @@ export default {
|
||||||
|
|
||||||
screenshotURL() {
|
screenshotURL() {
|
||||||
return getResBaseURL() + this.monitor.screenshot + "?time=" + this.cacheTime;
|
return getResBaseURL() + this.monitor.screenshot + "?time=" + this.cacheTime;
|
||||||
|
},
|
||||||
|
|
||||||
|
descriptionHTML() {
|
||||||
|
if (this.monitor.description != null) {
|
||||||
|
return DOMPurify.sanitize(marked(this.monitor.description));
|
||||||
|
} else {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue