You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When running svelte-i18n extract as documented here on a file that formats a message with $_ using a message key build by string interpolation or concatenation, the CLI tool crashes with an exception.
There is such a message key in the Sapper template for svelte-i18n: $_('languages.' + item.replace('-', '_')) (source).
How to reproduce:
$ git clone https://github.com/kaisermann/sapper-template-i18n.git
$ npm install
$ ./node_modules/.bin/svelte-i18n extract "src/components/Nav.svelte"
(node:1180263) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'split' of undefined
at /home/cbenz/Dev/vendor/sapper-template-i18n/node_modules/svelte-i18n/dist/cli.js:17:2801
at Array.forEach (<anonymous>)
at h (/home/cbenz/Dev/vendor/sapper-template-i18n/node_modules/svelte-i18n/dist/cli.js:17:2644)
at Command.<anonymous> (/home/cbenz/Dev/vendor/sapper-template-i18n/node_modules/svelte-i18n/dist/cli.js:17:4131)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:1180263) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async functionwithout a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:1180263) [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.
I've tried with some other patterns that also fail with the same exception:
$('key.'+value)$(`key.${value}`)
Expected behavior: the message extractor could display a warning, and skip this message key. I understand that it can't guess all the possible values of the string interpolation.
I'm using:
node v14.2.0 (Arch Linux)
svelte-i18n 3.0.4 (latest version at the time I write the issue)
The text was updated successfully, but these errors were encountered:
When running
svelte-i18n extract
as documented here on a file that formats a message with$_
using a message key build by string interpolation or concatenation, the CLI tool crashes with an exception.There is such a message key in the Sapper template for svelte-i18n:
$_('languages.' + item.replace('-', '_'))
(source).How to reproduce:
I've tried with some other patterns that also fail with the same exception:
Expected behavior: the message extractor could display a warning, and skip this message key. I understand that it can't guess all the possible values of the string interpolation.
I'm using:
svelte-i18n
3.0.4 (latest version at the time I write the issue)The text was updated successfully, but these errors were encountered: