语言路径修复
This commit is contained in:
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) {
|
||||
|
||||
Reference in new issue
Block a user