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
================================
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!
---------------------------------------------------------------------------

View File

@@ -1801,11 +1801,9 @@ build. In fact, its definition is:
\func{const wxChar *}{wxTRANSLATE}{\param{const char *}{s}}
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
\helpref{wxT}{wxt} which makes it unnecessary to use both wxTRANSLATE and wxT
with the same string which would be really unreadable).
value of its argument.
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
this is achieved using \helpref{\_()}{underscore} but that macro not only marks
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
\begin{verbatim}
static const wxChar * const weekdays[] = { _("Mon"), ..., _("Sun") };
static const char * const weekdays[] = { _("Mon"), ..., _("Sun") };
...
// use weekdays[n] as usual
\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
\begin{verbatim}
static const wxChar * const weekdays[] = { wxTRANSLATE("Mon"), ..., wxTRANSLATE("Sun") };
static const char * const weekdays[] = { wxTRANSLATE("Mon"), ..., wxTRANSLATE("Sun") };
...
// use wxGetTranslation(weekdays[n])
\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
wxGetTranslation wouldn't find them.
\membersection{::wxVsnprintf}\label{wxvsnprintf}
\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
{
wxKeyCode code;
const wxChar *name;
const char *name;
} wxKeyNames[] =
{
{ 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
// 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
#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
static int IsNumberedAccelKey(const wxString& str,
const wxChar *prefix,
const char *prefix,
wxKeyCode prefixCode,
unsigned first,
unsigned last)

View File

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

View File

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

View File

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

View File

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

View File

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