Author Topic: wxSmith issue about the generation of _T() or _()  (Read 1707 times)

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5913
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
wxSmith issue about the generation of _T() or _()
« on: May 19, 2023, 05:23:38 am »
I just found that by using the latest svn header version of code::blocks

Some generated code has changed from:

Code
    ComboBoxBaudRate = new wxComboBox(ConfigPanel, ID_COMBOBOX1, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, 0, wxTE_PROCESS_ENTER, wxDefaultValidator, _T("ID_COMBOBOX1"));
    ComboBoxBaudRate->Append(_("110"));

to

Code
    ComboBoxBaudRate->Append(_T("110"));

I mean the _() is changed to _T().

Is that by design? Any ideas?

I think the choice option should be translated, so I think _() is the correct option.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5913
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: wxSmith issue about the generation of _T() or _()
« Reply #1 on: May 19, 2023, 07:25:40 am »
OK, I think I have found the reason.

It is in this code:

- wxSmith: Do not add _() to strings without alphabetic chars. arnholm/codeblocks_sfmirror@60e1e7d

So, only translate the text if is has some alphabetic chars. Nice feature!
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.