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

Allow adding new keys from tree view #137

Closed
JohanBeekers opened this issue Dec 10, 2019 · 11 comments
Closed

Allow adding new keys from tree view #137

JohanBeekers opened this issue Dec 10, 2019 · 11 comments
Labels
fixed Already fixed in the latest version

Comments

@JohanBeekers
Copy link

From the tree view, it is possible to edit translations, rename keys and delete keys. But it isn't possible to add new keys from there. It would be great if it was possible to add new keys from the tree view.

Duplicating existing keys here would also be a great feature. As i often see myself duplicating existing keys, like error messages, and slightly changing them.

antfu added a commit that referenced this issue Dec 10, 2019
antfu added a commit that referenced this issue Dec 10, 2019
@antfu
Copy link
Contributor

antfu commented Dec 10, 2019

Landed in v1.4.2 🎉 Thanks again for the great idea!

@antfu antfu added the fixed Already fixed in the latest version label Dec 10, 2019
@JohanBeekers
Copy link
Author

I tested it, but found some issues.

  • Duplicating a key seems to work well.
  • Creating a new key seems to work, but doesn't appear to respect the recently added 'keepFulfilled' setting. It only adds an English translation. A followup action however, like duplicating a key, will update all translation files with the missing keys.
  • Editing translations from the tree seems to have broken. I took a quick peek at your commit and i think I found the issue. It looks like you accidentally removed the EditKey command and register the NewKey command twice.
    image

Also, i'm not sure if it is related to the changes you made for this feature, but i can't remember having this issue before. When switching between different files, like... i'm on the HTML file, go to my package.json, and then back to the HTML file, the side panel looks a bit messed up. Like this:
image

The tree and 'help & feedback' sections turn into empty 'progress' sections. And ordered differently. Hiding and showing all sections from the right-click menu seems to fix it temporarily. Until i switch between different files again.

@antfu
Copy link
Contributor

antfu commented Dec 10, 2019

Wow! Thanks for such detailed feedback!

2 and 3 are fixed in v1.4.3.

For the side panel issue. Please restart VSCode after updating and see if it still presents. I am not sure what's the problem(it happens sometimes when I am developing). I will keep investigating it. If you can consistently reproduce it please let me know the steps! Thanks!!

@JohanBeekers
Copy link
Author

Thanks for the fixes. Those seem to be working fine now.

The side panel thing seems to happen fairly consistently for me.
Basically all i do is this:

  • Close all files, just to make sure that nothing is opened automatically when i start VSCode again.
  • Close VSCode.
  • Open VSCode and my project, i see the welcome screen. The i18n Ally icon is not available yet in the activity bar.
  • I open the HTML file of a component with translations. The i18n Ally icon appears.
  • I click the i18n Ally icon and see all the sections correctly. 'current file', 'progress', 'tree' and 'help & feedback'.
  • I open the 'package.json' file of my project. The first section now turns into the 'tree', 'help & feedback' is just below, and at the very bottom is now 'progress'.
  • I open the same HTML file again that i had open previously. The first section is now 'help & feedback', then 'current file', 'progress' and another, but empty, 'progress' section.
  • I open the 'package.json' again. Now i see 3 'progress' sections. The first 2 empty and the third with the progress content.
  • Open the HTML file again, 'progress', 'current file', 'progress', 'progress'. Exactly like i showed in the screenshot above.

@antfu
Copy link
Contributor

antfu commented Dec 10, 2019

@JohanBeekers Thanks for the info. I repeated your steps but it seems to work fine for me. May I have some of your information

  • Your OS and Version
  • VSCode version
  • Frameworks you are using
  • The output of "i18n Ally"

@JohanBeekers
Copy link
Author

  • Windows 10, version 1901, build 18363.476
  • VSCode 1.40.2
  • Angular ngx-translate
  • Output:
🈶 Activated, v1.4.5

――――――

💼 Workspace root changed to "c:\Users\johan.beekers\Git\MobileNXT"
Error on parsing pubspec.yaml
🌞 Enabled
🐱‍🏍 "Angular ngx-translate" framework(s) detected, extension enabled.
🚀 Initializing loader "c:\Users\johan.beekers\Git\MobileNXT"

📂 Loading locales under c:\Users\johan.beekers\Git\MobileNXT\src\assets\i18n
	📑 Loading (de) de.json
	📑 Loading (en) en.json
	📑 Loading (fr) fr.json
	📑 Loading (nl) nl.json

👀 Watching change on c:\Users\johan.beekers\Git\MobileNXT\src\assets\i18n

✅ Loading finished

――――――

@JohanBeekers
Copy link
Author

JohanBeekers commented Dec 11, 2019

Just to rule it out, i also just disabled every single extension except i18n ally, and i'm still having the problem that it messes up the sections when switching between files.

Oh, and these are my settings:

"i18n-ally.localesPaths": ["src/assets/i18n"],
"i18n-ally.sortKeys": true,
"i18n-ally.keystyle": "flat",
"i18n-ally.displayLanguage": "en",
"i18n-ally.keepFulfilled": true,
"i18n-ally.indent": 4

@JohanBeekers
Copy link
Author

Okay, i made a VERY simple project and i'm still having the issue. Only the i18n Ally extension is enabled.
It only has a package.json file with the ngx-translate/core package, 1 html file and 2 translation json files.

nUlDDLoAuY

@antfu
Copy link
Contributor

antfu commented Dec 11, 2019

@JohanBeekers You are awesome, dude! Thanks for being so patient on this. Now I can reproduce it.

It happens when you manually reorder the views (that's why I didn't find it out before). The extension would remove the current file view when no needed and create a new one when necessary, and somehow this messed up with the manual positions. I think it's kinda a bug of VSCode.

For now, I have made the current file view always visible as a workaround. Please update to v1.4.6. Hope it works.

@JohanBeekers
Copy link
Author

Was a bit busy today, but i just tried it out and it seems to be working now.
Thank you for all these quick fixes and updates.

I'll probably come up with some more feature idea's and bugs later. 😄

@antfu
Copy link
Contributor

antfu commented Dec 12, 2019

@JohanBeekers Thanks for all the help! Any ideas are welcome!

@antfu antfu closed this as completed Dec 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fixed Already fixed in the latest version
Development

No branches or pull requests

2 participants