Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"test": "pnpm run test:patch",
"test:patch": "git apply -v --check --directory origin ./tools/adev-patches/*.patch",
"update-origin": "tsx tools/update-origin.ts",
"list-untranslated": "tsx tools/list-untranslated.ts",
"translate": "tsx --env-file=.env tools/translator/main.ts"
},
"packageManager": "pnpm@10.15.0",
Expand Down
40 changes: 40 additions & 0 deletions tools/list-untranslated.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/usr/bin/env tsx

/**
* @fileoverview Lists files in adev-ja that don't have corresponding .en.* backup files,
* indicating they haven't been translated yet.
*/

import { consola } from 'consola';
import { extname, resolve } from 'node:path';
import { exists, getEnFilePath, glob } from './lib/fsutils';
import { adevJaDir } from './lib/workspace';

async function main() {
const files = await glob(['**/*.{md,ts,html,json}', '!**/license.md'], {
cwd: adevJaDir,
});
const untranslated = [];

for (const file of files) {
const ext = extname(file);
if (file.includes(`.en${ext}`)) continue;
if (!(await exists(resolve(adevJaDir, getEnFilePath(file))))) {
untranslated.push(file);
}
}

untranslated.length
? consola.info(
`Found ${untranslated.length} untranslated files:\n${untranslated
.sort()
.map((f) => ` ${f}`)
.join('\n')}`
)
: consola.success('All files translated! 🎉');
}

main().catch((error) => {
consola.error(error);
process.exit(1);
});