Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: tomay3000 on June 03, 2021, 11:24:12 pm

Title: How to prevent wxSmith from auto overwriting wxS("") string format back to _("")
Post by: tomay3000 on June 03, 2021, 11:24:12 pm
Hello,

I need to prevent wxSmith from auto overwriting all string format manually changed to wxS("") back to _("") each time?
I need it to stay like wxS("").

TIA.
Title: Re: How to prevent wxSmith from auto overwriting wxS("") string format back to _("")
Post by: stahta01 on June 03, 2021, 11:40:32 pm
Hello,

I need to prevent wxSmith from auto overwriting all string format manually changed to wxS("") back to _("") each time?
I need it to stay like wxS("").

TIA.

Do the change outside of the wxSmith comment block.

Edit: If that is not possible post where it happens and maybe someone can fix the wxSmith code.

Tim S.
Title: Re: How to prevent wxSmith from auto overwriting wxS("") string format back to _("")
Post by: Miguel Gimenez on June 04, 2021, 08:17:08 am
In wxSmith's properties you can deactivate usage of i18n strings, but then it will use the format specified for non-i18n strings (wxS is not in the list)
Title: Re: How to prevent wxSmith from auto overwriting wxS("") string format back to _("")
Post by: tomay3000 on June 04, 2021, 06:31:32 pm
In wxSmith's properties you can deactivate usage of i18n strings, but then it will use the format specified for non-i18n strings (wxS is not in the list)

That helped, thank you ;)
I think wxS should be added to the list too in future development.
Title: Re: How to prevent wxSmith from auto overwriting wxS("") string format back to _("")
Post by: stahta01 on June 05, 2021, 04:13:10 am
In wxSmith's properties you can deactivate usage of i18n strings, but then it will use the format specified for non-i18n strings (wxS is not in the list)

That helped, thank you ;)
I think wxS should be added to the list too in future development.

Do you know how to build Code::Blocks from source?
And, do you know how to use wxSmith?
If yes to both, I am trying to create a patch that adds wxS to list.
But, I have little knowledge of how to use wxSmith and really can not test it.

Tim S.
 
Title: Re: How to prevent wxSmith from auto overwriting wxS("") string format back to _("")
Post by: stahta01 on June 05, 2021, 04:41:47 am
Possible patch that needs tested by someone who uses wxSmith and checked by someone who knows how to patch wxSmith.

Edit: Patch is too simple to give me credit; just use sf.net to add feature request and add this as a possible patch.

Tim S.

Title: Re: How to prevent wxSmith from auto overwriting wxS("") string format back to _("")
Post by: Miguel Gimenez on June 05, 2021, 12:08:54 pm
It looks good and works OK here.
Title: Re: How to prevent wxSmith from auto overwriting wxS("") string format back to _("")
Post by: BlueHazzard on June 05, 2021, 04:22:33 pm
Possible patch that needs tested by someone who uses wxSmith and checked by someone who knows how to patch wxSmith.

Edit: Patch is too simple to give me credit; just use sf.net to add feature request and add this as a possible patch.

Tim S.

Can you create the ticket? I will try to apply it as soon as i am at home, but in case i forget it... (we should add this... wxT() is deprecated according to the docs)
Credit to the creator!
Title: Re: How to prevent wxSmith from auto overwriting wxS("") string format back to _("")
Post by: stahta01 on June 05, 2021, 06:41:44 pm
Possible patch that needs tested by someone who uses wxSmith and checked by someone who knows how to patch wxSmith.

Edit: Patch is too simple to give me credit; just use sf.net to add feature request and add this as a possible patch.

Tim S.

Can you create the ticket? I will try to apply it as soon as i am at home, but in case i forget it... (we should add this... wxT() is deprecated according to the docs)
Credit to the creator!

Replacing wxT() with wxT_2() would be better than removing it.

Tim S.
Title: Re: How to prevent wxSmith from auto overwriting wxS("") string format back to _("")
Post by: oBFusCATed on June 05, 2021, 07:31:42 pm
Replacing wxT() with wxT_2() would be better than removing it.
Why? wx people have removed wxT from their code base.
Title: Re: How to prevent wxSmith from auto overwriting wxS("") string format back to _("")
Post by: stahta01 on June 05, 2021, 08:00:31 pm
https://docs.wxwidgets.org/trunk/group__group__funcmacro__string.html#ga2e7c1f911a731a4b98a85fa44f1d9fbc (https://docs.wxwidgets.org/trunk/group__group__funcmacro__string.html#ga2e7c1f911a731a4b98a85fa44f1d9fbc)

Quote
Compatibility macro which expands to wxT() in wxWidgets 2 only.

This macro can be used in code which needs to compile with both wxWidgets 2 and 3 versions, in places where the wx2 API requires a Unicode string (in Unicode build) but the wx3 API only accepts a standard narrow string, as in e.g. wxCmdLineEntryDesc structure objects initializers.

Tim S.
Title: Re: How to prevent wxSmith from auto overwriting wxS("") string format back to _("")
Post by: oBFusCATed on June 05, 2021, 08:09:32 pm
wx2.x compatibility is not required for wxSmith.
For me a goal for wxSmith is to be able to generate correct and readable wx3.x code.
If it works in wx2.x fine, but it shouldn't be our goal.
Title: Re: How to prevent wxSmith from auto overwriting wxS("") string format back to _("")
Post by: gd_on on June 10, 2021, 10:09:54 am
In wxssettings.cpp, line 259, you use the macro _() to set the string wxS(""). As far as I understand, this string does not need to be translated (and more, must not...). So a macro as _T() or wxT() or may be wxT_2() should be preferable. And it's probably also the case for some other strings in the same cpp file.
Title: Re: How to prevent wxSmith from auto overwriting wxS("") string format back to _("")
Post by: Miguel Gimenez on June 10, 2021, 11:11:41 am
Or just "wxS()", _T() and wxT() are not needed anymore.

Quote
Note that since wxWidgets 2.9.0 you shouldn't use wxT() anymore in your program sources