feat: add i18n utils

This commit is contained in:
pomelo-nwu
2025-11-17 20:23:07 +08:00
parent 0eeffc6875
commit da2be8045f
8 changed files with 1264 additions and 3 deletions

View File

@@ -41,8 +41,16 @@ function copyFilesRecursive(source, target) {
if (item.isDirectory()) {
copyFilesRecursive(sourcePath, targetPath);
} else if (extensionsToCopy.includes(path.extname(item.name))) {
fs.copyFileSync(sourcePath, targetPath);
} else {
const ext = path.extname(item.name);
// Copy standard extensions, or .js files in i18n/locales directory
const isLocaleJs =
ext === '.js' &&
(sourcePath.includes('i18n/locales') ||
sourcePath.includes(path.join('i18n', 'locales')));
if (extensionsToCopy.includes(ext) || isLocaleJs) {
fs.copyFileSync(sourcePath, targetPath);
}
}
}
}