Translated code strings using language manager

This commit is contained in:
DJj123dj
2025-11-09 12:50:57 +01:00
parent f7fa0998b6
commit f835850b3f
16 changed files with 293 additions and 179 deletions
+11 -20
View File
@@ -1,6 +1,8 @@
import {opendiscord, api, utilities} from "../../index"
import * as discord from "discord.js"
const lang = opendiscord.languages
export const loadAllPanels = async () => {
const panelConfig = opendiscord.configs.get("opendiscord:panels")
if (!panelConfig) return
@@ -75,8 +77,7 @@ export function describePanelOptions(mode:"fields"|"text", panel:api.ODPanel): {
}
})
//TODO TRANSLATION!!!
const autotitle = (hasTicket && ticketOnly) ? "Select your ticket:" : ((hasRole && roleOnly) ? "Select your role:" : "Select your option:")
const autotitle = (hasTicket && ticketOnly) ? lang.getTranslation("panel.selectTicket")+":" : ((hasRole && roleOnly) ? lang.getTranslation("panel.selectRole")+":" : lang.getTranslation("panel.selectOption")+":")
const title = (panel.get("opendiscord:describe-options-custom-title").value.length < 1) ? "__"+autotitle+"__\n" : "__"+panel.get("opendiscord:describe-options-custom-title").value+"__\n"
if (mode == "fields") return options.map((opt) => {
@@ -87,10 +88,8 @@ export function describePanelOptions(mode:"fields"|"text", panel:api.ODPanel): {
let description = opt.exists("opendiscord:description") ? opt.get("opendiscord:description").value : "`<no-description>`"
if (layout == "normal" || layout == "detailed"){
//TODO TRANSLATION!!!
if (opt.exists("opendiscord:cooldown-enabled") && opt.get("opendiscord:cooldown-enabled").value) description = description + "\nCooldown: `"+opt.get("opendiscord:cooldown-minutes").value+" min`"
//TODO TRANSLATION!!!
if (opt.exists("opendiscord:limits-enabled") && opt.get("opendiscord:limits-enabled").value) description = description + "\nMax Tickets: `"+opt.get("opendiscord:limits-maximum-user").value+"`"
if (opt.exists("opendiscord:cooldown-enabled") && opt.get("opendiscord:cooldown-enabled").value) description = description + "\n"+lang.getTranslation("params.uppercase.cooldown")+": `"+opt.get("opendiscord:cooldown-minutes").value+" min`"
if (opt.exists("opendiscord:limits-enabled") && opt.get("opendiscord:limits-enabled").value) description = description + "\n"+lang.getTranslation("params.uppercase.maxTickets")+": `"+opt.get("opendiscord:limits-maximum-user").value+"`"
}
if (layout == "detailed"){
const optionAdmins = [...opt.get("opendiscord:admins").value]
@@ -99,9 +98,7 @@ export function describePanelOptions(mode:"fields"|"text", panel:api.ODPanel): {
if (!optionAdmins.includes(admin)) optionAdmins.push(admin)
}
}
//TODO TRANSLATION!!!
if (opt.exists("opendiscord:admins")) description = description + "\nAdmins: "+optionAdmins.map((admin) => discord.roleMention(admin)).join(", ")
if (opt.exists("opendiscord:admins")) description = description + "\n"+lang.getTranslation("params.uppercase.admins")+": "+optionAdmins.map((admin) => discord.roleMention(admin)).join(", ")
}
if (description == "") description = "`<no-description>`"
@@ -123,8 +120,7 @@ export function describePanelOptions(mode:"fields"|"text", panel:api.ODPanel): {
let description = opt.exists("opendiscord:description") ? opt.get("opendiscord:description").value : "`<no-description>`"
if (layout == "normal" || layout == "detailed"){
//TODO TRANSLATION!!!
if (opt.exists("opendiscord:roles")) description = description + "\nRoles: "+opt.get("opendiscord:roles").value.map((admin) => discord.roleMention(admin)).join(", ")
if (opt.exists("opendiscord:roles")) description = description + "\n"+lang.getTranslation("params.uppercase.roles")+": "+opt.get("opendiscord:roles").value.map((admin) => discord.roleMention(admin)).join(", ")
}
if (description == "") description = "`<no-description>`"
@@ -146,10 +142,8 @@ export function describePanelOptions(mode:"fields"|"text", panel:api.ODPanel): {
let description = opt.exists("opendiscord:description") ? opt.get("opendiscord:description").value : "`<no-description>`"
if (layout == "normal" || layout == "detailed"){
//TODO TRANSLATION!!!
if (opt.exists("opendiscord:cooldown-enabled") && opt.get("opendiscord:cooldown-enabled").value) description = description + "\nCooldown: `"+opt.get("opendiscord:cooldown-minutes").value+" min`"
//TODO TRANSLATION!!!
if (opt.exists("opendiscord:limits-enabled") && opt.get("opendiscord:limits-enabled").value) description = description + "\nMax Tickets: `"+opt.get("opendiscord:limits-maximum-user").value+"`"
if (opt.exists("opendiscord:cooldown-enabled") && opt.get("opendiscord:cooldown-enabled").value) description = description + "\n"+lang.getTranslation("params.uppercase.cooldown")+": `"+opt.get("opendiscord:cooldown-minutes").value+" min`"
if (opt.exists("opendiscord:limits-enabled") && opt.get("opendiscord:limits-enabled").value) description = description + "\n"+lang.getTranslation("params.uppercase.maxTickets")+": `"+opt.get("opendiscord:limits-maximum-user").value+"`"
}
if (layout == "detailed"){
const optionAdmins = [...opt.get("opendiscord:admins").value]
@@ -158,9 +152,7 @@ export function describePanelOptions(mode:"fields"|"text", panel:api.ODPanel): {
if (!optionAdmins.includes(admin)) optionAdmins.push(admin)
}
}
//TODO TRANSLATION!!!
if (opt.exists("opendiscord:admins")) description = description + "\nAdmins: "+optionAdmins.map((admin) => discord.roleMention(admin)).join(", ")
if (opt.exists("opendiscord:admins")) description = description + "\n"+lang.getTranslation("params.uppercase.admins")+": "+optionAdmins.map((admin) => discord.roleMention(admin)).join(", ")
}
if (layout == "simple") return "**"+utilities.emojiTitle(emoji,name)+":** "+description
@@ -182,8 +174,7 @@ export function describePanelOptions(mode:"fields"|"text", panel:api.ODPanel): {
let description = opt.exists("opendiscord:description") ? opt.get("opendiscord:description").value : "`<no-description>`"
if (layout == "normal" || layout == "detailed"){
//TODO TRANSLATION!!!
if (opt.exists("opendiscord:roles")) description = description + "\nRoles: "+opt.get("opendiscord:roles").value.map((admin) => discord.roleMention(admin)).join(", ")
if (opt.exists("opendiscord:roles")) description = description + "\n"+lang.getTranslation("params.uppercase.roles")+": "+opt.get("opendiscord:roles").value.map((admin) => discord.roleMention(admin)).join(", ")
}
if (layout == "simple") return "**"+utilities.emojiTitle(emoji,name)+":** "+description