don't use _T() inside wxGetTranslation() and related macros (wxTRANSLATE, _, ...) to preserve compatibility with the old ASCII build (even at the expense with the Unicode build compatibility)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@48603 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2007-09-07 21:47:45 +00:00
parent 066f3611df
commit e6d4038a8b
8 changed files with 45 additions and 31 deletions

View File

@@ -5,6 +5,23 @@
INCOMPATIBLE CHANGES SINCE 2.8.x INCOMPATIBLE CHANGES SINCE 2.8.x
================================ ================================
Unicode-related changes
-----------------------
The biggest changes in wxWidgets 3.0 are the changes due to the merge of the
old ANSI and Unicode build modes in a single build. See the Unicode overview
in the manual for more details but here are the most important incompatible
changes:
- Many wxWidgets functions taking "const wxChar *" have been changed to take
either "const wxString&" if they should accept both Unicode or ANSI strings
and the argument can't be NULL or "const char *" if the strings are always
ANSI but may be NULL.
- Some structure fields have been changed from "wxChar *" to "char *" too:
e.g. wxCmdLineEntryDesc fields.
Changes in behaviour not resulting in compilation errors, please read this! Changes in behaviour not resulting in compilation errors, please read this!
--------------------------------------------------------------------------- ---------------------------------------------------------------------------

View File

@@ -1801,11 +1801,9 @@ build. In fact, its definition is:
\func{const wxChar *}{wxTRANSLATE}{\param{const char *}{s}} \func{const wxChar *}{wxTRANSLATE}{\param{const char *}{s}}
This macro doesn't do anything in the program code -- it simply expands to the This macro doesn't do anything in the program code -- it simply expands to the
value of its argument (except in Unicode build where it is equivalent to value of its argument.
\helpref{wxT}{wxt} which makes it unnecessary to use both wxTRANSLATE and wxT
with the same string which would be really unreadable).
However it does have a purpose and it is to mark the literal strings for the However it does have a purpose which is to mark the literal strings for the
extraction into the message catalog created by {\tt xgettext} program. Usually extraction into the message catalog created by {\tt xgettext} program. Usually
this is achieved using \helpref{\_()}{underscore} but that macro not only marks this is achieved using \helpref{\_()}{underscore} but that macro not only marks
the string for extraction but also expands into a the string for extraction but also expands into a
@@ -1820,7 +1818,7 @@ translated (note that it is a bad example, really, as
day names already). If you write day names already). If you write
\begin{verbatim} \begin{verbatim}
static const wxChar * const weekdays[] = { _("Mon"), ..., _("Sun") }; static const char * const weekdays[] = { _("Mon"), ..., _("Sun") };
... ...
// use weekdays[n] as usual // use weekdays[n] as usual
\end{verbatim} \end{verbatim}
@@ -1829,7 +1827,7 @@ the code wouldn't compile because the function calls are forbidden in the array
initializer. So instead you should do initializer. So instead you should do
\begin{verbatim} \begin{verbatim}
static const wxChar * const weekdays[] = { wxTRANSLATE("Mon"), ..., wxTRANSLATE("Sun") }; static const char * const weekdays[] = { wxTRANSLATE("Mon"), ..., wxTRANSLATE("Sun") };
... ...
// use wxGetTranslation(weekdays[n]) // use wxGetTranslation(weekdays[n])
\end{verbatim} \end{verbatim}
@@ -1841,6 +1839,7 @@ wxTRANSLATE() in the above, it wouldn't work as expected because there would be
no translations for the weekday names in the program message catalog and no translations for the weekday names in the program message catalog and
wxGetTranslation wouldn't find them. wxGetTranslation wouldn't find them.
\membersection{::wxVsnprintf}\label{wxvsnprintf} \membersection{::wxVsnprintf}\label{wxvsnprintf}
\func{int}{wxVsnprintf}{\param{wxChar *}{buf}, \param{size\_t }{len}, \param{const wxChar *}{format}, \param{va\_list }{argPtr}} \func{int}{wxVsnprintf}{\param{wxChar *}{buf}, \param{size\_t }{len}, \param{const wxChar *}{format}, \param{va\_list }{argPtr}}

View File

@@ -40,7 +40,7 @@
static const struct wxKeyName static const struct wxKeyName
{ {
wxKeyCode code; wxKeyCode code;
const wxChar *name; const char *name;
} wxKeyNames[] = } wxKeyNames[] =
{ {
{ WXK_DELETE, wxTRANSLATE("DEL") }, { WXK_DELETE, wxTRANSLATE("DEL") },
@@ -114,7 +114,7 @@ static const struct wxKeyName
// //
// as accels can be either translated or not, check for both possibilities and // as accels can be either translated or not, check for both possibilities and
// also compare case-insensitively as the key names case doesn't count // also compare case-insensitively as the key names case doesn't count
static inline bool CompareAccelString(const wxString& str, const wxChar *accel) static inline bool CompareAccelString(const wxString& str, const char *accel)
{ {
return str.CmpNoCase(accel) == 0 return str.CmpNoCase(accel) == 0
#if wxUSE_INTL #if wxUSE_INTL
@@ -128,7 +128,7 @@ static inline bool CompareAccelString(const wxString& str, const wxChar *accel)
// //
// first and last parameter specify the valid domain for "number" part // first and last parameter specify the valid domain for "number" part
static int IsNumberedAccelKey(const wxString& str, static int IsNumberedAccelKey(const wxString& str,
const wxChar *prefix, const char *prefix,
wxKeyCode prefixCode, wxKeyCode prefixCode,
unsigned first, unsigned first,
unsigned last) unsigned last)

View File

@@ -466,7 +466,7 @@ bool wxAppConsoleBase::OnExceptionInMainLoop()
#if wxUSE_CMDLINE_PARSER #if wxUSE_CMDLINE_PARSER
#define OPTION_VERBOSE _T("verbose") #define OPTION_VERBOSE "verbose"
void wxAppConsoleBase::OnInitCmdLine(wxCmdLineParser& parser) void wxAppConsoleBase::OnInitCmdLine(wxCmdLineParser& parser)
{ {
@@ -475,8 +475,8 @@ void wxAppConsoleBase::OnInitCmdLine(wxCmdLineParser& parser)
{ {
{ {
wxCMD_LINE_SWITCH, wxCMD_LINE_SWITCH,
_T("h"), "h",
_T("help"), "help",
gettext_noop("show this help message"), gettext_noop("show this help message"),
wxCMD_LINE_VAL_NONE, wxCMD_LINE_VAL_NONE,
wxCMD_LINE_OPTION_HELP wxCMD_LINE_OPTION_HELP
@@ -485,7 +485,7 @@ void wxAppConsoleBase::OnInitCmdLine(wxCmdLineParser& parser)
#if wxUSE_LOG #if wxUSE_LOG
{ {
wxCMD_LINE_SWITCH, wxCMD_LINE_SWITCH,
wxEmptyString, "",
OPTION_VERBOSE, OPTION_VERBOSE,
gettext_noop("generate verbose log messages"), gettext_noop("generate verbose log messages"),
wxCMD_LINE_VAL_NONE, wxCMD_LINE_VAL_NONE,
@@ -496,9 +496,9 @@ void wxAppConsoleBase::OnInitCmdLine(wxCmdLineParser& parser)
// terminator // terminator
{ {
wxCMD_LINE_NONE, wxCMD_LINE_NONE,
wxEmptyString, "",
wxEmptyString, "",
wxEmptyString, "",
wxCMD_LINE_VAL_NONE, wxCMD_LINE_VAL_NONE,
0x0 0x0
} }

View File

@@ -203,7 +203,7 @@ void wxAppBase::OnInitCmdLine(wxCmdLineParser& parser)
#ifdef __WXUNIVERSAL__ #ifdef __WXUNIVERSAL__
{ {
wxCMD_LINE_OPTION, wxCMD_LINE_OPTION,
wxEmptyString, "",
OPTION_THEME, OPTION_THEME,
gettext_noop("specify the theme to use"), gettext_noop("specify the theme to use"),
wxCMD_LINE_VAL_STRING, wxCMD_LINE_VAL_STRING,
@@ -217,7 +217,7 @@ void wxAppBase::OnInitCmdLine(wxCmdLineParser& parser)
// and not mgl/app.cpp // and not mgl/app.cpp
{ {
wxCMD_LINE_OPTION, wxCMD_LINE_OPTION,
wxEmptyString, "",
OPTION_MODE, OPTION_MODE,
gettext_noop("specify display mode to use (e.g. 640x480-16)"), gettext_noop("specify display mode to use (e.g. 640x480-16)"),
wxCMD_LINE_VAL_STRING, wxCMD_LINE_VAL_STRING,
@@ -228,9 +228,9 @@ void wxAppBase::OnInitCmdLine(wxCmdLineParser& parser)
// terminator // terminator
{ {
wxCMD_LINE_NONE, wxCMD_LINE_NONE,
wxEmptyString, "",
wxEmptyString, "",
wxEmptyString, "",
wxCMD_LINE_VAL_NONE, wxCMD_LINE_VAL_NONE,
0x0 0x0
} }

View File

@@ -3835,7 +3835,7 @@ const wxChar *wxDateTime::ParseDate(const wxChar *date)
// some special cases // some special cases
static struct static struct
{ {
const wxChar *str; const char *str;
int dayDiffFromToday; int dayDiffFromToday;
} literalDates[] = } literalDates[] =
{ {
@@ -4010,7 +4010,7 @@ const wxChar *wxDateTime::ParseDate(const wxChar *date)
else // not a valid weekday name else // not a valid weekday name
{ {
// try the ordinals // try the ordinals
static const wxChar *ordinals[] = static const char *ordinals[] =
{ {
wxTRANSLATE("first"), wxTRANSLATE("first"),
wxTRANSLATE("second"), wxTRANSLATE("second"),
@@ -4176,7 +4176,7 @@ const wxChar *wxDateTime::ParseTime(const wxChar *time)
// first try some extra things // first try some extra things
static const struct static const struct
{ {
const wxChar *name; const char *name;
wxDateTime_t hour; wxDateTime_t hour;
} stdTimes[] = } stdTimes[] =
{ {

View File

@@ -103,7 +103,7 @@ static wxFontEncoding gs_encodings[] =
}; };
// the descriptions for them // the descriptions for them
static const wxChar* gs_encodingDescs[] = static const char* gs_encodingDescs[] =
{ {
wxTRANSLATE( "Western European (ISO-8859-1)" ), wxTRANSLATE( "Western European (ISO-8859-1)" ),
wxTRANSLATE( "Central European (ISO-8859-2)" ), wxTRANSLATE( "Central European (ISO-8859-2)" ),

View File

@@ -452,12 +452,10 @@ wxDialUpManagerMSW::wxDialUpManagerMSW()
exit: exit:
if ( funcName ) if ( funcName )
{ {
static const wxChar *msg = wxTRANSLATE( wxLogError(_("The version of remote access service (RAS) installed "
"The version of remote access service (RAS) installed on this machine is too\ "on this machine is too old, please upgrade (the "
old, please upgrade (the following required function is missing: %s)." "following required function is missing: %s)."),
); funcName);
wxLogError(wxGetTranslation(msg), funcName);
m_dllRas.Unload(); m_dllRas.Unload();
return; return;
} }