Add error message on the three supported languages

Ff the script fails to load due to the lack of `msgcat`, warn in the same language as the one set on $::cmgmt::locale
This commit is contained in:
Teh PeGaSuS
2026-03-03 19:25:57 +01:00
parent 25ec4db93f
commit 2fa7be4b91
+14 -4
View File
@@ -8,7 +8,7 @@ namespace eval cmgmt {
# Configuration
# ----------
# Language to be use on this script
# Available languages: en (English)
# Available languages: en (English), it (Italian), pt (Portuguese European)
variable locale "en"
# Directory where the language files are located
@@ -23,7 +23,7 @@ namespace eval cmgmt {
# Command to upload the file
# The ban list file is piped into the command via stdin (with `cat $filename |`)
# so your command must read from stdin
variable upCommand "curl -s -F file=@- https://x0.at/"
variable upCommand "curl -s -F file=@- https://hotpaste.0bin.xyz/"
# Set the banmask type to use in banning the user
# Available types are:
@@ -101,8 +101,18 @@ namespace eval cmgmt {
# If you touch the code below and then complain the script "suddenly stopped working" I'll touch you at night.
# ----------
if { [catch { package require msgcat }] } {
putloglev o * "\[Channel Management\] This script needs msgcat package to work. The script cannot be loaded."
return
if {$cmgmt::locale eq "en"} {
putloglev o * "\[Channel Management\] This script needs msgcat package to work. The script cannot be loaded."
return
}
if {$::cmgmt::locale eq "it"} {
putloglev o * "\[Channel Management\] Questo script richiede il pacchetto msgcat per funzionare. Lo script non può essere caricato."
return
}
if {$::cmgmt::locale eq "pt"} {
putloglev o * "\[Channel Management\] Este script necessita do pacote msgcat para funcionar. O script não pode ser carregado."
return
}
}
::msgcat::mclocale $::cmgmt::locale
::msgcat::mcload [file join $cmgmt::lang_dir]