Page 1 of 1

wxCrafter generates some strings that are not translatable

Posted: Thu Jan 22, 2015 7:19 pm
by simo75
Hi everyone,
I was using wxFormBuilder for one of my old projects and I wanted to convert and import the gui into wxCrafter.
This was almost straightforward but I noticed that some text is missing from translation, in particular the code generated by wxCrafter for the classes wxFilePickerCtrl, wxFilePickerCtrl and wxRadioBox uses the wxT() macro instead of the translatable one _().

Here is an example of code generated by wxCrafter:

Code: Select all

m_filePicker1 = new wxFilePickerCtrl(this, wxID_ANY, wxEmptyString, wxT("Select a file"), wxT("*"), wxDefaultPosition, wxSize(-1,-1), wxFLP_DEFAULT_STYLE);

m_dirPicker1 = new wxDirPickerCtrl(this, wxID_ANY, wxEmptyString, wxT("Select a folder"), wxDefaultPosition, wxSize(-1,-1), wxDIRP_DEFAULT_STYLE);

wxArrayString m_radioBox21Arr;
m_radioBox21Arr.Add(wxT("First option"));
m_radioBox21Arr.Add(wxT("Second Option"));
m_radioBox21 = new wxRadioBox(this, wxID_ANY, _("My RadioBox"), wxDefaultPosition, wxSize(-1,-1), m_radioBox21Arr, 1, 0);
I think that the strings "Select a file" and "Select a folder" should be translatable so the options in radiobox "First option" and "Second Option". Those strings should be enclosed in the _() macro not inthe wxT() form.
Maybe there are other places where there is the same problem but I found these three classes so far.

Re: wxCrafter generates some strings that are not translatab

Posted: Sat Jan 24, 2015 2:28 pm
by DavidGH
Hi,

You're right. In addition I found wxListBox and wxCheckListBox.

Thank you for reporting it. It should be fixed in the next wxCrafter release.

Regards,

David

Re: wxCrafter generates some strings that are not translatab

Posted: Mon Jan 26, 2015 1:01 pm
by simo75
Thanks for your work.

Someone on this forum suggested to add an option to make the strings translatable or not (i.e. use _() macro or classic wxT() one). This is because gettext works the right way if use only english chracters but if you input text in a language that uses accented characters, umlauts and other special chars those chars are not rendered the right way in the final compiled program.
So, to not force someone that doesn't need multilanguage support to write the program in english and then translate all the strings in the language he needs, it would be a great addition to have a box to select whether you want the program to be translated or not.

Again, thanks a lot for your great work.
Simone

Re: wxCrafter generates some strings that are not translatab

Posted: Mon Feb 02, 2015 3:38 pm
by nezos
I've came up with the same problem in the wxStaticText control. Don't forget add this too to the list! My problem was with the greater or equal sign.

The check box would be a useful addition, cause if i add new controls and generate the code, i have to correct it with the _() macro.

Re: wxCrafter generates some strings that are not translatab

Posted: Mon Feb 02, 2015 3:43 pm
by eranif
Can you give an example of the generated code? (just the relevant line)

Eran

Re: wxCrafter generates some strings that are not translatab

Posted: Sat Mar 07, 2015 2:05 am
by nezos
Sorry i missed the reply.

Here is the code generated automatically from wxCrafter:

m_staticText30 = new wxStaticText(this, wxID_ANY, _("≤ Longitude ≤"), wxDefaultPosition, wxSize(-1,-1), 0);

Replacing _ with wxT works:

m_staticText30 = new wxStaticText(this, wxID_ANY, wxT("≤ Longitude ≤"), wxDefaultPosition, wxSize(-1,-1), 0);