question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bug with nested jsons

See original GitHub issue

Describe the bug when you have the translations in nested json, and you want to translate from the code, and the key is for example "example.user" instead of putting it as an object in the json, it puts it exactly the same as "example.user": ""

Extension Version

  • i18n Ally 2.2.7

Framework/i18n package you are using

  • react-i18next

To Reproduce

  1. create a json with nested translations
  2. put a translation in the code that should be nested ex: “example.user”
  3. put any translation and in the file you will find the key exactly as it is written instead of being in an ex: "example": {"user": ""} "

Device Infomation

  • OS: Ubuntu
  • Version: 19.04
  • VS Code Version: 1.46.1

Extension Log Go to View -> Output -> i18n Ally, and paste the content below. You should mask any sensitive information


🧰 Config "i18n-ally.enabledParsers" changed, reloading
🔁 Reloading loader
🧩 Enabled frameworks: i18next
🧬 Enabled parsers: json

🚀 Initializing loader "/home/lawrence/apps/frontend-react"
📂 Directory structure: dir
🗃 Custom Path Matcher: {locale}/translation.json
🗃 Path Matcher Regex: /^(?<locale>[\w-_]+)\/translation\.json$/

📂 Loading locales under /home/lawrence/apps/frontend-react/src/locales
	📑 Loading (en) en/translation.json [1594085693895.4465]
	📑 Loading (es) es/translation.json [1594086180291.0793]

👀 Watching change on /home/lawrence/apps/frontend-react/src/locales
✅ Loading finished


――――――

🔄 File changed (change) es/translation.json
	📑 Loading (es) es/translation.json [1594086471940.9163]

Screenshots Peek 2020-07-06 21-05

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
PasinduPrabhashithacommented, Jan 23, 2022

I experience the same issue. Everything seems to be fine, all translations are detected and shown in the editor. Then I attempt to update a translation from within the editor, and after accepting the change via “enter”, it appends a non-nested string to the end of the json file and from now on does not detect any nested translation correctly. What am I missing?

“i18n-ally.keystyle”: “nested”, “i18n-ally.localeCountryMap”: {}

I also faced this same issue today. But when I change the key style both in user and workspace settings in Vscode it was solved. Initially, I only changed this setting in user settings.

0reactions
grupofanteccommented, Oct 3, 2020

Having exact same issue as originally described, same steps to reproduce. Framework is vue-i18n.

@Yalian Did you find a solution?

no 😒,I ended up stopping using the tool, and used traduora for the translations and it serves me for multiple projects

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bug with nested jsons · Issue #345 · lokalise/i18n-ally - GitHub
Describe the bug when you have the translations in nested json, and you want to translate from the code, and the key is...
Read more >
Managing deeply nested JSON documents with JSON_SET ...
Description: Updating deeply nested JSON documents is cumbersome. The problem is that JSON_SET will not work on paths which have not been ...
Read more >
Get Correctly Formatted Deep-Nested JSON Files At Scale ...
A good strategy to improve the query performance is the following: 1) Get all the columns you need avoiding nested queries and just...
Read more >
json_to_recordset with nested json objects NULLs columns
In json_populate_record(set), ignore its value and deprecate using it. ... behavior should always be as below. * For nested json objects, we'll spit...
Read more >
Thread: BUG #10728: json_to_recordset with nested json ...
I am guessing that the bug origin is in pg_parse_json in the way nested json is managed, it is the only code path...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found