perpetualKid / GetText.NET

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

Another control properties #20

Closed a-sanders closed 3 years ago

a-sanders commented 3 years ago

Hello, Is it possible to handle other control properties than Text/HeaderText/ToopTipText? Is there a way to extend a list of predefined properties?

For instance, I'd like to localize property EmptyListMsg of ObjectListView control.

Thank you! Regards.

perpetualKid commented 3 years ago

it should be straight forward to extend the list of properties extracted: https://github.com/perpetualKid/GetText.NET/blob/d2c3059808d53c756fc2c0d4d0f732fd5640e96b/src/GetText.Extractor/Engine/ParserBase.cs#L21

However I'm bit hesitant to implement this hardcoded in source, as it will cover all properties of the same names in any kind of object, so maybe rather have it configurable in commandline (or config file). Would that be acceptable solution?

a-sanders commented 3 years ago

@perpetualKid The config file for that is the best idea for being able to extend the list of properties. Not sure about the command-line way... however it can be an option like a file with a property list.

perpetualKid commented 3 years ago

the most effort will be to adapt/implement solid configuration framework, handling error cases etc.... so not exactly a quick fix but something worth to start working on. In the meanwhile you may just localize these properties "manually" in code:

ObjectListView.EmptyListMsg = catalog.GetString("Empty List Message")

That will work both ways, the Extractor will find the messages because of the GetString call, and instead the WinForms Localizer you'll just use plain catalog GetString calls

a-sanders commented 3 years ago

@perpetualKid , Thanks!

perpetualKid commented 3 years ago

closing for now, using catalog.GetString* should be a suitable way which works both ways in extractor and localization. Customization would require some more advanced implemenation which should ensure consistency between the both part.