语言路径修复

This commit is contained in:
tianmo committed 2026-09-11 22:48:12 +08:00
1 parent 2beb78e255
commit f0f292d2d8
4 files changed
+14 -4

No files matched your search

@@ -323,7 +323,9 @@
function readLocaleFile(code) {
try {
const file = path.join(__dirname, '..', '_locales', code + '.json');
// Eagle 页面中的 __dirname 不一定等于 viewer 目录,使用实际模块路径定位。
const pluginRoot = path.dirname(path.dirname(require.resolve('../js/spine-utils.js')));
const file = path.join(pluginRoot, '_locales', code + '.json');
const data = JSON.parse(fs.readFileSync(file, 'utf8'));
return (data && typeof data === 'object') ? data : {};
} catch (e) {
@@ -323,7 +323,9 @@
function readLocaleFile(code) {
try {
const file = path.join(__dirname, '..', '_locales', code + '.json');
// Eagle 页面中的 __dirname 不一定等于 viewer 目录,使用实际模块路径定位。
const pluginRoot = path.dirname(path.dirname(require.resolve('../js/spine-utils.js')));
const file = path.join(pluginRoot, '_locales', code + '.json');
const data = JSON.parse(fs.readFileSync(file, 'utf8'));
return (data && typeof data === 'object') ? data : {};
} catch (e) {