2024-05-10 15:56:25 -04:00
|
|
|
import fs from 'fs';
|
|
|
|
|
import path from 'path';
|
|
|
|
|
import main from './main';
|
|
|
|
|
|
|
|
|
|
async function scanDirectory(baseFilePath: string, languagesDir: string) {
|
|
|
|
|
const files = fs.readdirSync(languagesDir);
|
|
|
|
|
for (const file of files) {
|
|
|
|
|
const ext = path.extname(file);
|
2024-05-12 16:24:13 -04:00
|
|
|
if (ext !== '.ts' && ext !== '.tsx') {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
2024-05-10 15:56:25 -04:00
|
|
|
const compareFilePath = path.resolve(languagesDir, file);
|
2024-05-12 16:24:13 -04:00
|
|
|
if (compareFilePath === baseFilePath) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
2024-05-10 15:56:25 -04:00
|
|
|
await main(baseFilePath, compareFilePath);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const languagesDir = './client/src/localization/languages';
|
|
|
|
|
const baseFilePath = path.resolve(languagesDir, 'Eng.ts');
|
|
|
|
|
|
|
|
|
|
scanDirectory(baseFilePath, languagesDir).catch(console.error);
|