Skip to content

Commit

Permalink
make backwards compatible to old MBINC
Browse files Browse the repository at this point in the history
  • Loading branch information
Lenni009 committed Jun 1, 2024
1 parent 2636388 commit d1db352
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,18 @@ interface Xml {
"@encoding": string;
}

interface LangObj {
// newer MBINCompiler versions (> 4.70) do not have the additional "Property"
interface LocEntry {
"@name": string;
"@value": string;
Property?: {
"@name": string;
"@value": string;
};
}

interface TkLocalisationEntry {
Property: Array<LangObj>;
Property: Array<LocEntry>;
"@value": string;
}

Expand Down Expand Up @@ -89,7 +94,9 @@ for (let i = 0; i < files.length; i++) {
const language = entry["@name"];
if (languageArgs.length && !languageArgs.includes(language.toLowerCase()))
continue;
const langValue = entry["@value"];
const langValue = entry.Property
? entry.Property["@value"]
: entry["@value"];
if (!langValue) continue;
langData[langKey][language] = decode(langValue, { level: "xml" });
}
Expand Down

0 comments on commit d1db352

Please sign in to comment.