Kodi Community Forum
Kodi skin localize VS Code extension - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Skinning (https://forum.kodi.tv/forumdisplay.php?fid=12)
+--- Thread: Kodi skin localize VS Code extension (/showthread.php?tid=367861)

Pages: 1 2 3 4 5 6 7


RE: Kodi skin localize VS Code extension - roidy - 2024-08-10

(2024-08-10, 19:06)kittmaster Wrote: Another quick question, you set the range for the strings based on what Kodi "says" etc... any merit in allow the user to put in their own values for like issues you found with mine?

Not really necessary, I've increased the range to the highest Kodi says, so hopefully that should cover every possibility and fix all but one of your issues. The only other issue you had was because a string entry was missing from your strings.po file. I suppose it could be nice to catch missing strings and decorate the line with a warning message telling you the string is missing.... I'll look into it.


RE: Kodi skin localize VS Code extension - kittmaster - 2024-08-10

(2024-08-10, 20:31)roidy Wrote:
(2024-08-10, 19:06)kittmaster Wrote: Another quick question, you set the range for the strings based on what Kodi "says" etc... any merit in allow the user to put in their own values for like issues you found with mine?

Not really necessary, I've increased the range to the highest Kodi says, so hopefully that should cover every possibility and fix all but one of your issues. The only other issue you had was because a string entry was missing from your strings.po file. I suppose it could be nice to catch missing strings and decorate the line with a warning message telling you the string is missing.... I'll look into it.

Ok, no worries on range.

The string missing would be a nice feature to have, and make the message really "obnoxious" so there is no confusion... -=+ !! Localized string not found !! +=- 

No way to confuse something like that or would ever be seen in a skin under any condition.... of course I leave that to you, or make a user option so "they" know what to look for in string parsing their code in dev... have a default and user maybe? 

Missing strings would be a great nice to have.

Another feature request could be... "re-order" all localized strings?? I have a bunch where it is like 31010, 31011, 31012, <NUMBER GAP>, 31033, 31034...... etc.

That one might be a bit harder, but would be a cool feature to "fix" improperly ascending .po files from years of abuse etc.

Again, just thinking out loud, it is great as it is and your work is much appreciated.


RE: Kodi skin localize VS Code extension - roidy - 2024-08-24

(2024-08-05, 16:50)kittmaster Wrote: My question, is there a way to go in reverse? i.e. You are at the variable, you right click the name, it takes you to the "function"? That would be super useful IMHO. 

Just thinking out loud.

@kittmaster this has now been added.

v0.2.3 - Added 'Find All References'


RE: Kodi skin localize VS Code extension - kittmaster - 2024-08-25

(2024-08-24, 17:54)roidy Wrote:
(2024-08-05, 16:50)kittmaster Wrote: My question, is there a way to go in reverse? i.e. You are at the variable, you right click the name, it takes you to the "function"? That would be super useful IMHO. 

Just thinking out loud.

@kittmaster this has now been added.

v0.2.3 - Added 'Find All References'

Wow, sweet!

I'll give it a whirl, will try tomorrow as I'm at the end of a long day out... Thank you again for your work on this great plugin, it really is a time saver.


RE: Kodi skin localize VS Code extension - kittmaster - 2024-08-25

If you use my skin, includes_infodialogs: <label>$VAR[VideoInfoSubtitleVar]</label> ~line 124

In the left pane, the all references show the files, but when you expand them, it basically shows the entire file in the reference left pane... is that supposed to happen? 

Showing the entire file that is 3K lines was unexpected... I was thinking it would drill down and only show the instances?

Maybe I did something wrong, LMK.

Nice feature!


RE: Kodi skin localize VS Code extension - roidy - 2024-08-25

v0.2.4 - Add highlighting to 'Find All References' function


RE: Kodi skin localize VS Code extension - roidy - 2024-08-25

(2024-08-25, 02:31)kittmaster Wrote: If you use my skin, includes_infodialogs: <label>$VAR[VideoInfoSubtitleVar]</label> ~line 124

In the left pane, the all references show the files, but when you expand them, it basically shows the entire file in the reference left pane... is that supposed to happen? 

Showing the entire file that is 3K lines was unexpected... I was thinking it would drill down and only show the instances?

Maybe I did something wrong, LMK.

Nice feature!

Sorry, I can't reproduce this issue. Using your skin and multiple different selections it works ok. Try uninstall and installing again, does the rest of the functions of the extension work? Make sure you set the correct language code in the settings, setting the wrong language code will cause the entire extension to fail (I need to fix this).

Image


RE: Kodi skin localize VS Code extension - kittmaster - 2024-08-25

Have a look at this in operation, maybe you can see something I can't? 


http://www.kittmaster.com/imagedump/kodi/skin/FindAll.html


RE: Kodi skin localize VS Code extension - kittmaster - 2024-08-25

(2024-08-25, 10:21)roidy Wrote:
(2024-08-25, 02:31)kittmaster Wrote: If you use my skin, includes_infodialogs: <label>$VAR[VideoInfoSubtitleVar]</label> ~line 124

In the left pane, the all references show the files, but when you expand them, it basically shows the entire file in the reference left pane... is that supposed to happen? 

Showing the entire file that is 3K lines was unexpected... I was thinking it would drill down and only show the instances?

Maybe I did something wrong, LMK.

Nice feature!

Sorry, I can't reproduce this issue. Using your skin and multiple different selections it works ok. Try uninstall and installing again, does the rest of the functions of the extension work? Make sure you set the correct language code in the settings, setting the wrong language code will cause the entire extension to fail (I need to fix this).

Image

This is exactly what I would have expected to see, but clearly, something amiss on my end?


RE: Kodi skin localize VS Code extension - roidy - 2024-08-25

Looking at your video you don't seem to be selecting any text to search for......

I can reproduce the issue by doing the same, pressing 'Find All References' without any text selected.


RE: Kodi skin localize VS Code extension - roidy - 2024-08-25

v0.2.5 - Pop up a warning if selection is empty


RE: Kodi skin localize VS Code extension - kittmaster - 2024-08-25

OIC, that functionality issue is where "some" if not most will fall apart... but, it works now as expected. 

In "most" IDEs, then you right click on a sub function or call, the IDE is smart enough to know that finding all references are typically selected by the cursor position and it must "autofill" its buffer with the word at the cursor position.

Here, you need to actually select the word/line, which you did for localization of a string, and force the highlight to execute any given action which makes sense now... so the error is a programming nuance, the error popup will solve that under all execution modes for those that don't know better or have certain workflow expectations that may not jive with universal methods in other languages like C, C++ etc.

Maybe it can be tweaked in the future, but right now it works as expected now that I'm aware of how to properly use it and the message popup will help anyone not following this thread with its use coming from another IDE or muscle memory of what "find all references" implementation typically acts like.

The feature is exactly what is needed.

You should have a coffee link somewhere, unless I missed it....

Regards,
Chris


RE: Kodi skin localize VS Code extension - roidy - 2024-08-25

Unfortunately as far as I know the VSCode extension api doesn't give you the ability to extract a word at the cursor position without the use of some sort of language server that knows how the xml should be formatted or some kind of dictionary lookup, all of which is far beyond my limited programming skills Smile


RE: Kodi skin localize VS Code extension - kittmaster - 2024-08-25

(2024-08-25, 12:47)roidy Wrote: Unfortunately as far as I know the VSCode extension api doesn't give you the ability to extract a word at the cursor position without the use of some sort of language server that knows how the xml should be formatted or some kind of dictionary lookup, all of which is far beyond my limited programming skills Smile

Quick search came up with this, not sure if it is of any use to you? Not sure you use javascript or not?? If not, what language you building this with? Anyway, here is an excerpt:

Yes, the VSCode API does support capturing the word at the cursor position. You can use the vscode.window.activeTextEditor to get the current editor and then use the selection object to get the position of the cursor. Here’s a basic example:

javascript:
const editor = vscode.window.activeTextEditor; if (editor) { const position = editor.selection.active; const wordRange = editor.document.getWordRangeAtPosition(position); const word = editor.document.getText(wordRange); console.log(word); // This will log the word at the cursor position }

You can then use this captured word to search for a term in the IDE editor. If you need to perform a search, you can use the vscode.commands.executeCommand function with the actions.find command:

javascript:
vscode.commands.executeCommand('actions.find', { searchString: word });

This should help you capture the word at the cursor position and use it for searching within the IDE.


RE: Kodi skin localize VS Code extension - roidy - 2024-08-25

Excellent, can I ask where you found this? I looked for ages but found nothing.