Make EN language load first (fixes file reset)

This commit is contained in:
Govindas 2020-05-17 17:11:15 +03:00
parent fa7a8b28dd
commit 4bf717237c

View File

@ -10,25 +10,23 @@ on script load:
loop {_languages::*}: loop {_languages::*}:
set {languageslist::%loop-value%} to loop-value set {languageslist::%loop-value%} to loop-value
load yaml "plugins/Skript/scripts/languages/LanguageEN.yml" as "langEN"
loop {languageslist::*}: loop {languageslist::*}:
loop-value is not "EN"
#load it in memory so we can always have it loaded #load it in memory so we can always have it loaded
load yaml "plugins/Skript/scripts/languages/Language%loop-value%.yml" as "lang%loop-value%" load yaml "plugins/Skript/scripts/languages/Language%loop-value%.yml" as "lang%loop-value%"
#clear non-existent messages that have been removed from original EN file, but still exist in other languages #clear non-existent messages that have been removed from original EN file, but still exist in other languages
loop yaml nodes from "lang%loop-value%":
loop-value is not "EN": yaml value loop-value-2 from "langEN" is not set:
loop yaml nodes from "lang%loop-value%":
yaml value loop-value-2 from "langEN" is not set: send "Removed Non-existent message: %loop-value-2% from %loop-value-1%" to console and ops
delete yaml value loop-value-2 from "lang%loop-value-1%"
set {_deleted} to true
send "Removed Non-existent message: %loop-value-2% from %loop-value-1%" to console and ops {_deleted} is set:
delete yaml value loop-value-2 from "lang%loop-value-1%" save yaml "lang%loop-value%"
set {_deleted} to true delete {_deleted}
{_deleted} is set:
save yaml "lang%loop-value%"
delete {_deleted}
send "FINISHED LOADING GLOBAL LANGUAGE FILES" to console send "FINISHED LOADING GLOBAL LANGUAGE FILES" to console
function translate(message: text, receivers: objects, returntype: integer = 1, variables: strings = "null") :: text: function translate(message: text, receivers: objects, returntype: integer = 1, variables: strings = "null") :: text: