Author Topic: How to prevent wxSmith from auto overwriting wxS("") string format back to _("")  (Read 8505 times)

Offline tomay3000

  • Multiple posting newcomer
  • *
  • Posts: 58
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.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
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.
« Last Edit: June 04, 2021, 12:00:45 am by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1553
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)

Offline tomay3000

  • Multiple posting newcomer
  • *
  • Posts: 58
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.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
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.
 
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
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.

C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1553
It looks good and works OK here.

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
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!

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
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.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Replacing wxT() with wxT_2() would be better than removing it.
Why? wx people have removed wxT from their code base.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
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.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
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.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline gd_on

  • Lives here!
  • ****
  • Posts: 796
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.
Windows 11 64 bits (23H2), svn C::B (last version or almost!), wxWidgets 3.2.4 (tests with 3.3), Msys2 Compilers 13.2.0, 64 bits (seh, posix : gcc, g++ and gfortran in C:\msys64\mingw64) or 32 bits (dwarf2, posix  in C:\msys64\mingw32).

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1553
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