Fixed bugs & added/updated languages!

This commit is contained in:
DJj123dj
2024-08-23 23:19:44 +02:00
parent 177ab95dba
commit d5295a9480
9 changed files with 510 additions and 15 deletions
+1
View File
@@ -451,6 +451,7 @@ export interface ODLanguageManagerIds_Default {
"openticket:czech":ODLanguage,
"openticket:german":ODLanguage,
"openticket:catalan":ODLanguage,
"openticket:hungarian":ODLanguage,
//ADD NEW LANGUAGES HERE!!!
}
+1 -1
View File
@@ -1160,7 +1160,7 @@ export class ODCheckerCustomStructure_HexColor extends ODCheckerStringStructure
if (typeof value != "string") return false
else if (emptyAllowed && value.length == 0){
return true
}else if ((!allowShortForm && !/^#[a-f0-9]{6}$/.test(value)) || (allowShortForm && !/^#[a-f0-9]{6}$/.test(value) && !/^#[a-f0-9]{3}$/.test(value))){
}else if ((!allowShortForm && !/^#[a-fA-F0-9]{6}$/.test(value)) || (allowShortForm && !/^#[a-fA-F0-9]{6}$/.test(value) && !/^#[a-fA-F0-9]{3}$/.test(value))){
checker.createMessage("openticket:color-invalid","error","This is an invalid hex color!",lt,null,[],this.id,(this.options.docs ?? null))
return false
}else return true
+5 -2
View File
@@ -40,7 +40,7 @@ export interface ODDefaults {
languageSelection:boolean,
/**Set the backup language when the primary language is missing a property. */
backupLanguage:string,
/****[NOD FOR PLUGIN TRANSLATIONS]** The full list of available languages (used in the default config checker). */
/****[NOT FOR PLUGIN TRANSLATIONS]** The full list of available languages (used in the default config checker). */
languageList:string[],
/**Load the default open ticket config checker. */
@@ -160,6 +160,8 @@ export interface ODDefaults {
/**Render the default open ticket startscreen. */
startScreenRendering:boolean,
/**Load the emoji style from the open ticket general config. */
emojiTitleStyleLoading:boolean,
/**The emoji style to use in embed & message titles using `utilities.emoijTitle()` */
emojiTitleStyle:"disabled"|"before"|"after"|"double",
/**The emoji divider to use in embed & message titles using `utilities.emoijTitle()` */
@@ -234,7 +236,7 @@ export class ODDefaultsManager {
languageLoading:true,
languageSelection:true,
backupLanguage:"openticket:english",
languageList:["custom","english","dutch","portuguese","czech","german","catalan"],
languageList:[],
checkerLoading:true,
checkerFunctionLoading:true,
@@ -300,6 +302,7 @@ export class ODDefaultsManager {
startScreenLoading:true,
startScreenRendering:true,
emojiTitleStyleLoading:true,
emojiTitleStyle:"before",
emojiTitleDivider:" ",
autocloseCheckInterval:300000, //5 minutes
+11 -3
View File
@@ -1,6 +1,7 @@
import {openticket, api, utilities} from "../../index"
export const loadAllLanguages = async () => {
//register languages
openticket.languages.add(new api.ODLanguage("openticket:custom","custom.json"))
openticket.languages.add(new api.ODLanguage("openticket:english","english.json"))
openticket.languages.add(new api.ODLanguage("openticket:dutch","dutch.json"))
@@ -8,10 +9,17 @@ export const loadAllLanguages = async () => {
openticket.languages.add(new api.ODLanguage("openticket:czech","czech.json"))
openticket.languages.add(new api.ODLanguage("openticket:german","german.json"))
openticket.languages.add(new api.ODLanguage("openticket:catalan","catalan.json"))
openticket.languages.add(new api.ODLanguage("openticket:hungarian","hungarian.json"))
//list for config checker
const languageList = openticket.defaults.getDefault("languageList")
languageList.push("custom","english","dutch","portuguese","czech","german","catalan","hungarian")
openticket.defaults.setDefault("languageList",languageList)
/** How to add more languages?
* - Add the language to the list above
* - Add the language to the "languageList" in the "ODDefaultsManager" class
* - Add the language to the list in the "ODLanguageManagerIds_Default" interface
* - Register the language to the manager (see above)
* - Add the language to the list (see above)
* - Add the language to the list in the "ODLanguageManagerIds_Default" interface (./src/core/api/defaults/language.ts)
* - Add the language to the list in the README.md
*/
}
+5
View File
@@ -133,6 +133,11 @@ const main = async () => {
//UTILITY CONFIG
const generalConfig = openticket.configs.get("openticket:general")
if (openticket.defaults.getDefault("emojiTitleStyleLoading")){
//set emoji style based on config
openticket.defaults.setDefault("emojiTitleStyle",generalConfig.data.system.emojiStyle)
}
//load database
openticket.log("Loading databases...","system")
if (openticket.defaults.getDefault("databaseLoading")){