perpetualKid / GetText.NET

A .NET Standard cross-platform implementation of GNU Gettext
Other
34 stars 11 forks source link

Ignore wrongly extracted string #50

Closed fsobolev closed 1 year ago

fsobolev commented 1 year ago

Hello! In a project I work on there's a line:

if (json.RootElement.GetProperty("result").GetString() != "success")

The GetString here is JsonElement.GetString method. But GetText Extractor seems to treat this as GetText method and extracts the result string. Is there a way to tell the extractor to ignore this particular line or at least a .cs file?

perpetualKid commented 1 year ago

seems like a bug where the argument is pulled from wrong syntax element - if there is no argument on the GetString method, extractor should not extract anything, so nothing will show up in catalog, which is your expected behaviour. I have a fix but need to test so it doesn't have other side effects, stay tuned.

It would still extract a text if your code was something like if (json.RootElement.GetProperty("result").GetString("someothertext") != "success") because Extractor intentionally doesn't resolve the semantic (ie. if 'json.RootElement.GetProperty("result")' actually returns some kind of an ICatalog), and currently there is no way to ignore lines.

perpetualKid commented 1 year ago

addressed in 1759777659cd9ed8080334b5a8dc31b9eeb704b7

fsobolev commented 1 year ago

Thank you! 😊