-
-
Notifications
You must be signed in to change notification settings - Fork 22.7k
Fix LSP not returning expected localization for API docs. #104062
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
Conversation
I'll need to spend more time to review this properly, but if we change the DocTools loading to perform the localization at this stage, we need to check:
|
Got it. If further modifications are needed, I’m more than happy to do that. |
Perhaps the translation should be done in LSP. I am not very familiar with the GDScript LSP implementation and not at all with the VSCode plugin implementation. We should test this hypothesis.
|
I've considered implementing the feature in this way: adding an option to VSCode to set the document language and then modifying the LSP implementation to return the corresponding translation. However, this would require changes to two repositories, so I opted for the approach with fewer modifications. If this method is more suitable, I'm happy to implement the relevant content, but I still need some time to familiarize myself with the LSP implementation. |
Storing translated strings in docs cache means you need to re-create the cache every time language is changed.
Localized class reference would make it more difficult to switch languages. If there is a way to localize the strings on LSP/VSCode side, I think that would be better approach. |
I believe that implementing translation on either the LSP side or the VSCode side is feasible. However, translating on the LSP side and providing configurations for VSCode would require modifications to two repositories. On the other hand, translating on the VSCode side might necessitate including localized po files for documentation, which could increase the plugin package size to some extent. Additionally, we need to maintain the version compatibility between the VSCode extension and Godot. Therefore, we should carefully consider which approach is more suitable. |
Let's not make this more complicated than it is and just translate in the LSP using the language set in the Godot editor. After all we don't offer settings in VSCode for other LSP related things like quote style. So the LSP does depend on editor settings anyway. |
This PR was closed due to my fork repository cleanup, so I submitted a new PR to deal with this issue, and now we're dealing with translations in LSP. #105344 |
corresponding language of the editor. This issue arises because the DocTools class does not translate the description when loading the documentation. To address this, I have modified the DocTools class to process the translation of description using _translate_doc_string during loading. Additionally, to prevent caching-related issues, I have added the localization language as a feature to the hash in the _compute_doc_version_hash function within the EditorHelp class.
before:

after:
