vue-translation-manager
vue-translation-manager copied to clipboard
Error when a string to translate contains specific characters ?
Steps to Reproduce
- Have a file containing a problematic string like "String (one / two)"
- Run npx vue-translation-manager translate
Context (Environment)
- Using npm v6.14.15
- Ubuntu LTS 20.04
Error message
(node:42613) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'toUpperCase' of undefined
at /home/user/folder/project/Project1/node_modules/vue-translation-manager/index.js:338:49
at Array.map (<anonymous>)
at camelCase (/home/user/folder/project/Project1/node_modules/vue-translation-manager/index.js:338:6)
at TranslationManager.getSuggestedKey (/home/user/folder/project/Project1/node_modules/vue-translation-manager/index.js:212:14)
at /home/user/folder/project/Project1/node_modules/vue-translation-manager/bin.js:180:31
(Use `node --trace-warnings ...` to show where the warning was created)
(node:42613) 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(). 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:42613) [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.
Possible Implementation
I'm going to investigate this bug and reply to this issue if I find a fix / open a PR.
The issue seems to come from the string that is passed to the camelCase()
function. It seems that the '/' in the input string gets removed and replaced by a whitespace.
So the function ends up calling
.toUppercase()
on a whitespace.
I have the same issue: green ( opted out )
converts to green opted
with double space.
I have same problem with &
character.