bugfix and random linter bs
This commit is contained in:
parent
dae5918000
commit
e22dbd15b0
@ -35,7 +35,7 @@ class LocaleLoader {
|
||||
const directory = path.join(process.cwd(), `language/languages/${language}`);
|
||||
const files = Util.readdirRecursive(directory);
|
||||
|
||||
let combined = {};
|
||||
const combined = {};
|
||||
for(let file of files) {
|
||||
file = fs.readFileSync(file, {
|
||||
encoding: 'utf8'
|
||||
@ -57,27 +57,25 @@ class LocaleLoader {
|
||||
let text = '';
|
||||
for(const line of lines) {
|
||||
if(line.startsWith('//')) continue;
|
||||
const matches = line.match(/\[([_A-Z0-9]{1,})]/, 'gi');
|
||||
const matches = line.match(/\[([_A-Z0-9]{1,})\]/giu);
|
||||
if(matches) {
|
||||
if (matched) {
|
||||
parsed[matched] = text;
|
||||
matched = matches[1];
|
||||
[, matched] = matches;
|
||||
text = '';
|
||||
} else {
|
||||
matched = matches[1];
|
||||
[, matched] = matches;
|
||||
}
|
||||
} else {
|
||||
if(matched) {
|
||||
} else if(matched) {
|
||||
text += line;
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
parsed[matched] = text;
|
||||
|
||||
for(const [ key, value ] of Object.entries(parsed)) {
|
||||
parsed[key] = value.replace(/^(\r)|(\r){1,}$/g, '');
|
||||
parsed[key] = value.replace(/^(\r)|(\r){1,}$/gu, '').replace(/\r/gu, '\n');
|
||||
}
|
||||
|
||||
return parsed;
|
||||
|
Loading…
Reference in New Issue
Block a user