mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: fix contentNodes import
This commit is contained in:
1 parent
91a7ebb23d
commit
eff13ac4f5
2 files changed
+7
-2
No files matched your search
@@ -18,7 +18,12 @@ function findOverrideContent(dir: string) {
|
||||
if (!files.length) return null;
|
||||
for (const file of files) {
|
||||
const lang = file.slice(8, -3);
|
||||
languages[lang] = fs.readFileSync(path.join(dir, file), 'utf8');
|
||||
let content: string | any[] = fs.readFileSync(path.join(dir, file), 'utf8');
|
||||
try {
|
||||
content = JSON.parse(content);
|
||||
if (!(content instanceof Array)) content = JSON.stringify(content);
|
||||
} catch (e) { }
|
||||
languages[lang] = content;
|
||||
}
|
||||
return JSON.stringify(languages);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user