ttag-cli
ttag-cli copied to clipboard
ttag spell fails
> yarn run ttag spell int/ja.po
yarn run v1.12.3
$ /xxx/node_modules/.bin/ttag spell int/ja.po
⠋ Loading dict for ja...(node:8291) UnhandledPromiseRejectionWarning: Incorrect or unsupported locale
(node:8291) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:8291) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
⠙ Loading dict for ja...
A few issues with this:
- none of my locales seems supported
- unhandled rejection
- command appears to hang
Thanks for the report! Seems like a bug. @vharitonsky
I'm seeing the same issue. I've tried this with and without the [locale] argument:
In my case however I'm using ttag-cli, like this:
npx ttag spell src/i18n/es.po es
... or like this (without the locale arg):
npx ttag spell src/i18n/es.po
Either way I get back this error (full error at bottom of this post)
Loading dict for es...(node:52752) UnhandledPromiseRejectionWarning: Incorrect or unsupported locale
My .po file was created with npx ttag init
following the locale naming guidelines here:
https://ttag.js.org/docs/quickstart.html#create-po-file
Additionally I'm using "es" which the "GNU Usual Language Codes" manual says is valid:
https://www.gnu.org/software/gettext/manual/html_node/Usual-Language-Codes.html
Thanks for the awesome lib guys ... everything else I've done with the lib has worked great!
-Dan
Full error text:
⠋ Loading dict for es...(node:52752) UnhandledPromiseRejectionWarning: Incorrect or unsupported locale
(node:52752) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:52752) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
⠇ Loading dict for es...
Any updates on this? Workarounds?
I think @tino is asking repo owner to tag this issue help-wanted
😆
Hello,
Allowed locales are hardcoded here : https://github.com/ttag-org/ttag-cli/blob/master/src/lib/spell.ts#L75 : only uk
or ru
or en
My 2c: instead of hardcoded locale list, I think it makes more sense to try and fetch the corresponding file from LibreOffice (which is what the code does for whitelisted locales now) and if that succeeds, use the dictionary; if that fails, then locale is not supported.
The minor caveat is that some dictionary folders are like bo
and others like br_FR
(with the geographical locale tag), so maybe some guessing is required... or perhaps that mapping alone can be specified in the ttag cli repo.