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

Bug: Simple JSON Key: Value translates to a strange object JSON #32

Closed
Franklin89 opened this issue Dec 2, 2021 · 2 comments · Fixed by #36
Closed

Bug: Simple JSON Key: Value translates to a strange object JSON #32

Franklin89 opened this issue Dec 2, 2021 · 2 comments · Fixed by #36
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@Franklin89
Copy link
Contributor

I was testing this GitHub Action with the following *.json input:

{
  "...almost there": "...almost there!"
}

The output in the PR was the following:

image

@IEvangelist IEvangelist added bug Something isn't working help wanted Extra attention is needed labels Dec 6, 2021
@Franklin89
Copy link
Contributor Author

I have been playing around with this a bit...

The issue seems to when writing calling parser.toFileFormatted AND only with the ... (three dots)

Ah ok I see the issue here. Because to get the key we do a const keyParts = key.split("."); which splits on the key. I guess this is a limitation and can not be solved in a easy way.

@Franklin89
Copy link
Contributor Author

Franklin89 commented Dec 7, 2021

If there are any strings in the key with a '.' it could break the translation process. I just created a simple string Hello World. which breaks the JSON Parser.

It also breaks if there is a period inside of a text to be translated: Hello World. Hello Universe. for example.

This:

"Reference number already in use. Please enter a different reference number": "Reference number already in use. Please enter a different reference number",

results:

"Reference number already in use": {
   " Please enter a different reference number": "Reference number already in use. Please enter a different reference number"
},

Update

There actually is a solution to this. When building the map a period is used which then prevents that any key can have this inside of the string. The easiest way to solve this is by using another delimiter. I tested with something like [--] which works but is not really the nice IMHO :-D Any suggestion?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants