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

Wrong text extraction #48

Open
PatrizioG opened this issue Mar 8, 2023 · 6 comments
Open

Wrong text extraction #48

PatrizioG opened this issue Mar 8, 2023 · 6 comments
Labels

Comments

@PatrizioG
Copy link

GetText.Extractor version: 1.8.7+bff42fb416

In our code we concatenate strings in this way:
lblArtCode.Text += " - " + ds.Current.Name;

and the correct call to extract is:
localizer.TextTranslator("Correct call to my localization method");

Calling GetText.Extractor -as TextTranslator erroneously add the string " - " to messages.pot

#: ..\example.cs:1
msgid " - "
msgstr ""

#: ..\example.cs:2
msgid "Correct call to my localization method"
msgstr ""
@perpetualKid
Copy link
Owner

see https://github.com/perpetualKid/GetText.NET/wiki/Extractor-Intro last chapter

The Extractor will automatically export all literal string assignments from .Text/HeaderText/ToolTipText properties, which are typically saved in the (Form1).Designer.cs files

Is the issue that the " - " string is unnecessarily extracted and stored in the .pot file?

@PatrizioG
Copy link
Author

Exactly, that's the problem. Is there a way to perform recognition of those properties only on *.Designer.cs files?

@perpetualKid
Copy link
Owner

right now it's hardcoded to extract strings from any of the listed properties.
While I would not like to limited extraxting these form .designer.cs files only (there are often cases in Winform development where such properties are set in regular .cs files also), I concur to make it configurable/explicit option (via extra cli parameter) whether such strings should be extracted.

Given though this is irritating but otherwise harmless, not sure if an enhancement will justify a new version to be released. Is this causing any blocking issues in your workflow?

@PatrizioG
Copy link
Author

Don't worry, is not urgent. I have currently made a workaround within the parser to check those properties only on files with the extension *.Designer.cs.
Thank you for your helpfulness

@Menelion
Copy link

@perpetualKid We have a similar problem where the Extractor extracts all Text properties even for invisible items and so on.
Would it be possible to add some kind of attribute or other indicator that this particular control, like this toolStripLabel, should be ignored by the Extractor? Thanks!

@perpetualKid
Copy link
Owner

@perpetualKid We have a similar problem where the Extractor extracts all Text properties even for invisible items and so on. Would it be possible to add some kind of attribute or other indicator that this particular control, like this toolStripLabel, should be ignored by the Extractor? Thanks!

certainly possible, code contributions are welcome

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants