jshmrtn / vue3-gettext

Translate Vue 3 applications with gettext.
https://jshmrtn.github.io/vue3-gettext/
MIT License
66 stars 23 forks source link

gettext-extract not working on Windows #12

Closed shylesh-kurup closed 2 years ago

shylesh-kurup commented 2 years ago

While running the gettext-extract on windows, getting the following error:

Error: Command failed: find ./src -name '.js' -o -name '.ts' -o -name '*.vue' 2> /dev/null The system cannot find the path specified.

at ChildProcess.exithandler (child_process.js:308:12) at ChildProcess.emit (events.js:315:20) at maybeClose (internal/child_process.js:1048:16) at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5) { killed: false, code: 1, signal: null, cmd: "find ./src -name '*.js' -o -name '*.ts' -o -name '*.vue' 2> /dev/null" }

Obviously the find command is failing on Windows.

Possible Fix:

In gettext-extract.ts import "os" module

const os = require("os");

Change line number 43 to:

var files = null; if(os.type() === "Windows_NT"){ files = await execShellCommand(cd ${srcDir} & dir *.js *.ts *.vue /S /B 2> NUL); } else{ files = await execShellCommand(find ${srcDir} -name '*.js' -o -name '*.ts' -o -name '*.vue' 2> /dev/null); }

lzurbriggen commented 2 years ago

Hi @shylesh-kurup ! We released a preview version with a new extract script that doesn't rely on find anymore, you can follow the docs here. You will still need to install gettext on Windows though.

Please open a new issue if you encounter problems with the new version.

Rel. #3