Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when a string to translate contains specific characters ? #38

Open
Theo-Fourniez opened this issue Jan 26, 2022 · 3 comments · May be fixed by #39
Open

Error when a string to translate contains specific characters ? #38

Theo-Fourniez opened this issue Jan 26, 2022 · 3 comments · May be fixed by #39

Comments

@Theo-Fourniez
Copy link

Steps to Reproduce

  1. Have a file containing a problematic string like "String (one / two)"
  2. 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.

@Theo-Fourniez
Copy link
Author

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.

@Theo-Fourniez Theo-Fourniez linked a pull request Jan 26, 2022 that will close this issue
2 tasks
@ebisbe
Copy link

ebisbe commented Jun 28, 2022

I have the same issue: green ( opted out ) converts to green opted with double space.

@BXYMartin
Copy link

I have same problem with & character.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants