Incorrect operation for non-English settings
tsc-watch is based on compiler messages regular expressions wich fail when you use --locale typescript option.
Yeap, that means that we need to copy all the translations from the TypeScript compiler itself (Not optimal, but doable)
It's also possible to force the --locale to be in English to temporarily fix this.
@pronebird If someone specifically asked for a locale, changing it back to English would be misleading.
The right thing to do is to extract the requested local json from the node_modules\typescript and use that, but it's not simple, as I'm use RegEx and the json holds strings...
..., as I'm use RegEx and the json holds strings...
@gilamran You can compile regular expressions from strings.
const pattern = "[a-z]+";
const flags = "i";
const exp = new RegExp(pattern, flags);
exp.test('Hello'); // true
@trs I know that you can do many things with regex... how would this help with Japanese for example?
@gilamran I see, I thought the issue was converting a string into a RegExp 😄
Perhaps the expressions can also be associated to a locale object and referenced as such:
// english.json
{
"compilationCompleteWithErrorRegex": " Found [^0][0-9]* error[s]?\\. Watching for file changes\\."
...
}
// japanese.json
{
"compilationCompleteWithErrorRegex": " 見つかった [^0][0-9]* エラー\\. ファイルの変更を監視する
}
(ignore my ignorance to the language, just Google translated for an example)
Then you would just import the correct expressions file based on the locale.
const expressions = require(`${locale}.json`)
🤷♂
@trs Yeap that's what I wrote in the comment above, we should extract the current locale json from node_modules\typescript and do just that :-)
If you want to PR this, it would be gr8!
Not for me, sorry! Hopefully someone else can tackle this PR.