ttag-cli icon indicating copy to clipboard operation
ttag-cli copied to clipboard

ttag spell fails

Open dimaqq opened this issue 6 years ago • 6 comments

> 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

dimaqq avatar Feb 13 '19 04:02 dimaqq

Thanks for the report! Seems like a bug. @vharitonsky

AlexMost avatar Feb 13 '19 07:02 AlexMost

I'm seeing the same issue. I've tried this with and without the [locale] argument: image

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...

cube-dan avatar Jul 03 '19 00:07 cube-dan

Any updates on this? Workarounds?

tino avatar Sep 16 '19 08:09 tino

I think @tino is asking repo owner to tag this issue help-wanted 😆

dimaqq avatar Sep 19 '19 07:09 dimaqq

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

NotSqrt avatar Mar 28 '22 13:03 NotSqrt

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.

dimaqq avatar Mar 29 '22 11:03 dimaqq