Hi All
I am looking it making an application more international. Having read chapter 16 “writing international applications” in the “wxBook”, and I have one question before I start. Is there any easy way the to add the require _() and _T() macros around the strings in code, that has been written without them. Or more to the point is there a utility that will find and highlight literal strings which have not been wrapped.
I know I could edit the code manual (and probably will do). But it would be nice if there was an automated way to do it, or at least check I haven't missing any strings.
I am using MS Visual studio 2005 standard, wxWidgets 2.8.7 and poEdit 1.4
Thanks in advance
ahoyle
Search for text in code Topic is solved
You don't need to include _() and _T() before any string, you can put them in the output routines.
An example:
An example:
Code: Select all
...
void foo::showError(const char *msj)
{
wxMessageDialog dlg(NULL, _(msj), "Error", wxICON_OK | wxICON_INFORMATION);
dlg.ShowModal();
}
...
Hi,
Of course if you have 5000 strings, this might be a little time-consuming .
But one thing you can do is afterwards to try to compile your app against a unicode wxWidgets build. This will give your an error for every string literal that isn't surrounded by a macro of some sort, so you can be fairly sure you haven't missed any.
Regards,
David
Not afaik; I just searched for ".Is there any easy way...
Of course if you have 5000 strings, this might be a little time-consuming .
But one thing you can do is afterwards to try to compile your app against a unicode wxWidgets build. This will give your an error for every string literal that isn't surrounded by a macro of some sort, so you can be fairly sure you haven't missed any.
Regards,
David
mc2r wrote:sed
-Max
Code: Select all
sed 's/\("\([^"]\|\"\)*"\)/_(\1)/g' your.cpp > yournew.cpp
This command made use of the powerful sed(stream editor) and Regular Expression(sed flavor), it might be hard to read/understand, but it's easy to use.
CAUTION:
If you have added _(),wxT() or _T() to some of your strings, you must strip them off first.
So in this case, you better excute the following:
Code: Select all
sed 's/\(wxT\|_T\|_\)(\("\([^"]\|\"\)*"\))/\2/g' Yours.cpp > Temp.cpp
sed 's/\("\([^"]\|\"\)*"\)/_(\1)/g' Temp.cpp > YourNew.cpp
In fascination of creating worlds by words, and in pursuit of words behind the world.
On Github: http://utensil.github.com
Technical Blog in Chinese: http://utensil.iteye.com/
On Github: http://utensil.github.com
Technical Blog in Chinese: http://utensil.iteye.com/