-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
[Editor] Fix return of EditorTranslationParserPlugin._get_comments
#99297
base: master
Are you sure you want to change the base?
[Editor] Fix return of EditorTranslationParserPlugin._get_comments
#99297
Conversation
Method used passed arguments as return data which does not work with extensions, switched to using a `Dictionary` return.
<description> | ||
If overridden, called after [method _parse_file] to get comments for the parsed entries. This method should fill the arrays with the same number of elements and in the same order as [method _parse_file]. | ||
If overridden, called after [method _parse_file] to get comments for the parsed entries. This method should fill the arrays with the same number of elements and in the same order as [method _parse_file]. The returned [Dictionary] should contain two elements, [code]msgids_comment[/code] and [code]msgids_context_plural_comment[/code] each a typed [Array] of [String]s. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unsure what exactly this should say but started out with this
for (int i = 0; i < ids_comment.size(); i++) { | ||
r_ids_comment->append(ids_comment[i]); | ||
if (GDVIRTUAL_CALL(_get_comments, ret)) { | ||
if (ret.has("msgids_comment")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unsure if this should error if we don't have these, if so I'll change it
To illustrate the issue, this is the signature of the related virtual void _parse_file(const String &p_path, const TypedArray<String> &p_msgids, const TypedArray<Array> &p_msgids_context_plural); Haven't generated the headers for the current state but |
I'm not familiar with the GDExtension issue, but it looks good to me as long as
|
That makes sense, will test some alternatives for deprecation and update as needed I'm not familiar enough with the code here to say if merging the two methods into one is feasible, but if it is might merging the two, dropping The new method could be That way we could possibly detect if Would depend on if we consider deprecation worth it, unsure what happens in other languages but it is possible to use it in godot-cpp but requires casting, I don't know how it works in C# though so confirming how the current methods work or don't work for plugins made in C# would be good It does seem that these cases do work with plugins in GDScript so that's a reason to deprecate over entirely replacing, but will test with GDScript soon to confirm |
I haven't tested personally but since Arrays in C# are reference types I imagine they may work. #99195 uses the method so, assuming the PR works, it would prove that the method works in C#. Also, how is the GDExtension validation not complaining about breaking compatibility? Does it not check virtual methods? |
I guess it depends on how we handle other cases in #92175. Yes, the fact that it seems to work in GDScript and C# is an argument for deprecation instead of removal/replacement. However, I don't think |
I'll see about some options today for this and #92175 |
Will try investigate this properly this week Edit: haven't been able to find the time to investigate this yet but will try next week |
Method used passed arguments as return data which does not work with extensions, switched to using a
Dictionary
return. This might work in extensions after fixing typed array copying, but unsure, and I think this return format is safer in any case to use, and is the standard in most of the virtual methods like this (also any binding for this will have to useconst_cast
as the resulting methods will pass asconst TypedArray<String> &
)Follow-up to:
TRANSLATORS:
andNO_TRANSLATE
comments #98099See also: