mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-11-26 03:16:19 +03:00
Merge pull request #2812 from louislam/remove-translate-keys
Remove untranslatable keys and notification list optimization
This commit is contained in:
commit
81a829bda7
4 changed files with 94 additions and 38 deletions
|
@ -13,7 +13,10 @@
|
|||
<div class="mb-3">
|
||||
<label for="notification-type" class="form-label">{{ $t("Notification Type") }}</label>
|
||||
<select id="notification-type" v-model="notification.type" class="form-select">
|
||||
<option v-for="type in notificationTypes" :key="type" :value="type">{{ $t(type) }}</option>
|
||||
<option v-for="(name, type) in notificationNameList.regularList" :key="type" :value="type">{{ name }}</option>
|
||||
<optgroup :label="$t('notificationRegional')">
|
||||
<option v-for="(name, type) in notificationNameList.regionalList" :key="type" :value="type">{{ name }}</option>
|
||||
</optgroup>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
|
@ -67,7 +70,7 @@
|
|||
</Confirm>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
<script>
|
||||
import { Modal } from "bootstrap";
|
||||
|
||||
import Confirm from "./Confirm.vue";
|
||||
|
@ -103,7 +106,91 @@ export default {
|
|||
return null;
|
||||
}
|
||||
return NotificationFormList[this.notification.type];
|
||||
}
|
||||
},
|
||||
|
||||
notificationNameList() {
|
||||
let regularList = {
|
||||
"alerta": "Alerta",
|
||||
"AlertNow": "AlertNow",
|
||||
"apprise": this.$t("apprise"),
|
||||
"Bark": "Bark",
|
||||
"clicksendsms": "ClickSend SMS",
|
||||
"discord": "Discord",
|
||||
"GoogleChat": "Google Chat (Google Workspace)",
|
||||
"gorush": "Gorush",
|
||||
"gotify": "Gotify",
|
||||
"HomeAssistant": "Home Assistant",
|
||||
"Kook": "Kook",
|
||||
"line": "LINE Messenger",
|
||||
"LineNotify": "LINE Notify",
|
||||
"lunasea": "LunaSea",
|
||||
"matrix": "Matrix",
|
||||
"mattermost": "Mattermost",
|
||||
"ntfy": "Ntfy",
|
||||
"octopush": "Octopush",
|
||||
"OneBot": "OneBot",
|
||||
"PagerDuty": "PagerDuty",
|
||||
"pushbullet": "Pushbullet",
|
||||
"PushByTechulus": "Push by Techulus",
|
||||
"pushover": "Pushover",
|
||||
"pushy": "Pushy",
|
||||
"rocket.chat": "Rocket.Chat",
|
||||
"signal": "Signal",
|
||||
"slack": "Slack",
|
||||
"squadcast": "SquadCast",
|
||||
"SMSEagle": "SMSEagle",
|
||||
"smtp": this.$t("smtp"),
|
||||
"stackfield": "Stackfield",
|
||||
"teams": "Microsoft Teams",
|
||||
"telegram": "Telegram",
|
||||
"Splunk": "Splunk",
|
||||
"webhook": "Webhook",
|
||||
"GoAlert": "GoAlert",
|
||||
"ZohoCliq": "ZohoCliq"
|
||||
};
|
||||
|
||||
// Put notifications here if it's not supported in most regions or its documentation is not in English
|
||||
let regionalList = {
|
||||
"AliyunSMS": "AliyunSMS (阿里云短信服务)",
|
||||
"DingDing": "DingDing (钉钉自定义机器人)",
|
||||
"Feishu": "Feishu (飞书)",
|
||||
"FreeMobile": "FreeMobile (mobile.free.fr)",
|
||||
"PushDeer": "PushDeer",
|
||||
"promosms": "PromoSMS",
|
||||
"serwersms": "SerwerSMS.pl",
|
||||
"SMSManager": "SmsManager (smsmanager.cz)",
|
||||
"WeCom": "WeCom (企业微信群机器人)",
|
||||
"ServerChan": "ServerChan (Server酱)",
|
||||
};
|
||||
|
||||
// Sort by notification name
|
||||
// No idea how, but it works
|
||||
// https://stackoverflow.com/questions/1069666/sorting-object-property-by-values
|
||||
let sort = (list2) => {
|
||||
return Object.entries(list2)
|
||||
.sort(([ , a ], [ , b ]) => a.localeCompare(b))
|
||||
.reduce((r, [ k, v ]) => ({
|
||||
...r,
|
||||
[k]: v
|
||||
}), {});
|
||||
};
|
||||
|
||||
return {
|
||||
regularList: sort(regularList),
|
||||
regionalList: sort(regionalList),
|
||||
};
|
||||
},
|
||||
|
||||
notificationFullNameList() {
|
||||
let list = {};
|
||||
for (let [ key, value ] of Object.entries(this.notificationNameList.regularList)) {
|
||||
list[key] = value;
|
||||
}
|
||||
for (let [ key, value ] of Object.entries(this.notificationNameList.regionalList)) {
|
||||
list[key] = value;
|
||||
}
|
||||
return list;
|
||||
},
|
||||
},
|
||||
|
||||
watch: {
|
||||
|
@ -203,11 +290,12 @@ export default {
|
|||
* @return {string}
|
||||
*/
|
||||
getUniqueDefaultName(notificationKey) {
|
||||
|
||||
let index = 1;
|
||||
let name = "";
|
||||
do {
|
||||
name = this.$t("defaultNotificationName", {
|
||||
notification: this.$t(notificationKey).replace(/\(.+\)/, "").trim(),
|
||||
notification: this.notificationFullNameList[notificationKey].replace(/\(.+\)/, "").trim(),
|
||||
number: index++
|
||||
});
|
||||
} while (this.$root.notificationList.find(it => it.name === name));
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
<div class="mb-3">
|
||||
<label for="gorush-platform" class="form-label">{{ $t("Platform") }}</label><span style="color: red;"><sup>*</sup></span>
|
||||
<select id="gorush-platform" v-model="$parent.notification.gorushPlatform" class="form-select">
|
||||
<option value="ios">{{ $t("iOS") }}</option>
|
||||
<option value="ios">iOS</option>
|
||||
<option value="android">{{ $t("Android") }}</option>
|
||||
<option value="huawei">{{ $t("Huawei") }}</option>
|
||||
</select>
|
||||
|
|
|
@ -186,7 +186,6 @@
|
|||
"defaultNotificationName": "My {notification} Alert ({number})",
|
||||
"here": "here",
|
||||
"Required": "Required",
|
||||
"webhook": "Webhook",
|
||||
"Post URL": "Post URL",
|
||||
"Content Type": "Content Type",
|
||||
"webhookJsonDesc": "{0} is good for any modern HTTP servers such as Express.js",
|
||||
|
@ -359,8 +358,6 @@
|
|||
"Domain": "Domain",
|
||||
"Workstation": "Workstation",
|
||||
"Packet Size": "Packet Size",
|
||||
"telegram": "Telegram",
|
||||
"ZohoCliq": "ZohoCliq",
|
||||
"Bot Token": "Bot Token",
|
||||
"wayToGetTelegramToken": "You can get a token from {0}.",
|
||||
"Chat ID": "Chat ID",
|
||||
|
@ -388,7 +385,6 @@
|
|||
"backupOutdatedWarning": "Deprecated: Since a lot of features were added and this backup feature is a bit unmaintained, it cannot generate or restore a complete backup.",
|
||||
"backupRecommend": "Please backup the volume or the data folder (./data/) directly instead.",
|
||||
"Optional": "Optional",
|
||||
"squadcast": "Squadcast",
|
||||
"or": "or",
|
||||
"recurringInterval": "Interval",
|
||||
"Recurring": "Recurring",
|
||||
|
@ -436,6 +432,7 @@
|
|||
"uninstall": "Uninstall",
|
||||
"uninstalling": "Uninstalling",
|
||||
"confirmUninstallPlugin": "Are you sure want to uninstall this plugin?",
|
||||
"notificationRegional": "Regional",
|
||||
"smtp": "Email (SMTP)",
|
||||
"secureOptionNone": "None / STARTTLS (25, 587)",
|
||||
"secureOptionTLS": "TLS (465)",
|
||||
|
@ -530,28 +527,11 @@
|
|||
"pushoversounds none": "None (silent)",
|
||||
"pushyAPIKey": "Secret API Key",
|
||||
"pushyToken": "Device token",
|
||||
"discord": "Discord",
|
||||
"teams": "Microsoft Teams",
|
||||
"signal": "Signal",
|
||||
"gotify": "Gotify",
|
||||
"slack": "Slack",
|
||||
"rocket.chat": "Rocket.Chat",
|
||||
"pushover": "Pushover",
|
||||
"pushy": "Pushy",
|
||||
"PushByTechulus": "Push by Techulus",
|
||||
"octopush": "Octopush",
|
||||
"promosms": "PromoSMS",
|
||||
"clicksendsms": "ClickSend SMS",
|
||||
"lunasea": "LunaSea",
|
||||
"apprise": "Apprise (Support 50+ Notification services)",
|
||||
"GoogleChat": "Google Chat (Google Workspace only)",
|
||||
"pushbullet": "Pushbullet",
|
||||
"Kook": "Kook",
|
||||
"wayToGetKookBotToken": "Create application and get your bot token at {0}",
|
||||
"wayToGetKookGuildID": "Switch on 'Developer Mode' in Kook setting, and right click the guild to get its ID",
|
||||
"Guild ID": "Guild ID",
|
||||
"line": "Line Messenger",
|
||||
"mattermost": "Mattermost",
|
||||
"User Key": "User Key",
|
||||
"Device": "Device",
|
||||
"Message Title": "Message Title",
|
||||
|
@ -586,12 +566,10 @@
|
|||
"SendKey": "SendKey",
|
||||
"SMSManager API Docs": "SMSManager API Docs ",
|
||||
"Gateway Type": "Gateway Type",
|
||||
"SMSManager": "SMSManager",
|
||||
"You can divide numbers with": "You can divide numbers with",
|
||||
"Base URL": "Base URL",
|
||||
"goAlertInfo": "GoAlert is a An open source application for on-call scheduling, automated escalations and notifications (like SMS or voice calls). Automatically engage the right person, the right way, and at the right time! {0}",
|
||||
"goAlertIntegrationKeyInfo": "Get generic API integration key for the service in this format \"aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee\" usually the value of token parameter of copied URL.",
|
||||
"goAlert": "GoAlert",
|
||||
"AccessKeyId": "AccessKey ID",
|
||||
"SecretAccessKey": "AccessKey Secret",
|
||||
"PhoneNumbers": "PhoneNumbers",
|
||||
|
@ -606,7 +584,6 @@
|
|||
"For safety, must use secret key": "For safety, must use secret key",
|
||||
"Device Token": "Device Token",
|
||||
"Platform": "Platform",
|
||||
"iOS": "iOS",
|
||||
"Android": "Android",
|
||||
"Huawei": "Huawei",
|
||||
"High": "High",
|
||||
|
@ -617,7 +594,6 @@
|
|||
"Proxy Protocol": "Proxy Protocol",
|
||||
"Proxy Server": "Proxy Server",
|
||||
"Proxy server has authentication": "Proxy server has authentication",
|
||||
"matrix": "Matrix",
|
||||
"promosmsTypeEco": "SMS ECO - cheap but slow and often overloaded. Limited only to Polish recipients.",
|
||||
"promosmsTypeFlash": "SMS FLASH - Message will automatically show on recipient device. Limited only to Polish recipients.",
|
||||
"promosmsTypeFull": "SMS FULL - Premium tier of SMS, You can use your Sender Name (You need to register name first). Reliable for alerts.",
|
||||
|
@ -653,19 +629,15 @@
|
|||
"do nothing": "do nothing",
|
||||
"auto acknowledged": "auto acknowledged",
|
||||
"auto resolve": "auto resolve",
|
||||
"gorush": "Gorush",
|
||||
"alerta": "Alerta",
|
||||
"alertaApiEndpoint": "API Endpoint",
|
||||
"alertaEnvironment": "Environment",
|
||||
"alertaApiKey": "API Key",
|
||||
"alertaAlertState": "Alert State",
|
||||
"alertaRecoverState": "Recover State",
|
||||
"serwersms": "SerwerSMS.pl",
|
||||
"serwersmsAPIUser": "API Username (incl. webapi_ prefix)",
|
||||
"serwersmsAPIPassword": "API Password",
|
||||
"serwersmsPhoneNumber": "Phone number",
|
||||
"serwersmsSenderName": "SMS Sender Name (registered via customer portal)",
|
||||
"smseagle": "SMSEagle",
|
||||
"smseagleTo": "Phone number(s)",
|
||||
"smseagleGroup": "Phonebook group name(s)",
|
||||
"smseagleContact": "Phonebook contact name(s)",
|
||||
|
@ -675,14 +647,12 @@
|
|||
"smseagleUrl": "Your SMSEagle device URL",
|
||||
"smseagleEncoding": "Send as Unicode",
|
||||
"smseaglePriority": "Message priority (0-9, default = 0)",
|
||||
"stackfield": "Stackfield",
|
||||
"Recipient Number": "Recipient Number",
|
||||
"From Name/Number": "From Name/Number",
|
||||
"Leave blank to use a shared sender number.": "Leave blank to use a shared sender number.",
|
||||
"Octopush API Version": "Octopush API Version",
|
||||
"Legacy Octopush-DM": "Legacy Octopush-DM",
|
||||
"ntfy Topic": "ntfy Topic",
|
||||
"HomeAssistant": "Home Assistant",
|
||||
"onebotHttpAddress": "OneBot HTTP Address",
|
||||
"onebotMessageType": "OneBot Message Type",
|
||||
"onebotGroupMessage": "Group",
|
||||
|
|
|
@ -272,7 +272,6 @@
|
|||
"apprise": "Apprise (支持 50+ 种通知服务)",
|
||||
"GoogleChat": "Google Chat(仅 Google Workspace)",
|
||||
"pushbullet": "Pushbullet",
|
||||
"AliyunSMS": "阿里云短信服务",
|
||||
"Kook": "Kook",
|
||||
"wayToGetKookBotToken": "在 {0} 创建应用并获取机器人 Token",
|
||||
"wayToGetKookGuildID": "在 Kook 设置中打开“开发者模式”,然后右键点击频道可获取其 ID",
|
||||
|
@ -448,7 +447,6 @@
|
|||
"Bark Endpoint": "Bark 接入点",
|
||||
"Bark Group": "Bark 群组",
|
||||
"Bark Sound": "Bark 铃声",
|
||||
"DingDing": "钉钉自定义机器人",
|
||||
"WebHookUrl": "钉钉自定义机器人 Webhook 地址",
|
||||
"SecretKey": "钉钉自定义机器人加签密钥",
|
||||
"For safety, must use secret key": "出于安全考虑,必须使用加签密钥",
|
||||
|
|
Loading…
Reference in a new issue