remove usage of _T(); it's just confusing and it's not needed anymore; use wxTRANSLATE instead of wxGetTranslation for the 'Bad luck...' literal
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58140 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -120,24 +120,24 @@ static const wxLanguage langIds[] =
|
|||||||
// shown before we set the locale anyhow
|
// shown before we set the locale anyhow
|
||||||
const wxString langNames[] =
|
const wxString langNames[] =
|
||||||
{
|
{
|
||||||
_T("System default"),
|
"System default",
|
||||||
_T("French"),
|
"French",
|
||||||
_T("Italian"),
|
"Italian",
|
||||||
_T("German"),
|
"German",
|
||||||
_T("Russian"),
|
"Russian",
|
||||||
_T("Bulgarian"),
|
"Bulgarian",
|
||||||
_T("Czech"),
|
"Czech",
|
||||||
_T("Polish"),
|
"Polish",
|
||||||
_T("Swedish"),
|
"Swedish",
|
||||||
#if wxUSE_UNICODE || defined(__WXMOTIF__)
|
#if wxUSE_UNICODE || defined(__WXMOTIF__)
|
||||||
_T("Japanese"),
|
"Japanese",
|
||||||
#endif
|
#endif
|
||||||
#if wxUSE_UNICODE
|
#if wxUSE_UNICODE
|
||||||
_T("Georgian"),
|
"Georgian",
|
||||||
_T("English"),
|
"English",
|
||||||
_T("English (U.S.)"),
|
"English (U.S.)",
|
||||||
_T("Arabic"),
|
"Arabic",
|
||||||
_T("Arabic (Egypt)")
|
"Arabic (Egypt)"
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -246,7 +246,7 @@ bool MyApp::OnInit()
|
|||||||
#ifdef __LINUX__
|
#ifdef __LINUX__
|
||||||
{
|
{
|
||||||
wxLogNull noLog;
|
wxLogNull noLog;
|
||||||
m_locale.AddCatalog(_T("fileutils"));
|
m_locale.AddCatalog("fileutils");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -370,9 +370,10 @@ void MyFrame::OnPlay(wxCommandEvent& WXUNUSED(event))
|
|||||||
{
|
{
|
||||||
// this is a more implicit way to write _() but note that if you use it
|
// this is a more implicit way to write _() but note that if you use it
|
||||||
// you must ensure that the strings get extracted in the message
|
// you must ensure that the strings get extracted in the message
|
||||||
// catalog as by default xgettext won't do it (it only knows of _(),
|
// catalog as by default xgettext won't do it; it only knows of _(),
|
||||||
// not wxGetTranslation())
|
// not of wxTRANSLATE(). As internat's readme.txt says you should thus
|
||||||
str = wxGetTranslation(_T("Bad luck! try again..."));
|
// call xgettext with -kwxTRANSLATE.
|
||||||
|
str = wxTRANSLATE("Bad luck! try again...");
|
||||||
}
|
}
|
||||||
|
|
||||||
wxMessageBox(str, _("Result"), wxOK | wxICON_INFORMATION);
|
wxMessageBox(str, _("Result"), wxOK | wxICON_INFORMATION);
|
||||||
@@ -417,12 +418,13 @@ void MyFrame::OnTest1(wxCommandEvent& WXUNUSED(event))
|
|||||||
const wxString title = _("Testing _() (gettext)");
|
const wxString title = _("Testing _() (gettext)");
|
||||||
wxTextEntryDialog d(this, _("Please enter text to translate"),
|
wxTextEntryDialog d(this, _("Please enter text to translate"),
|
||||||
title, wxTRANSLATE("default value"));
|
title, wxTRANSLATE("default value"));
|
||||||
|
|
||||||
if (d.ShowModal() == wxID_OK)
|
if (d.ShowModal() == wxID_OK)
|
||||||
{
|
{
|
||||||
wxString v = d.GetValue();
|
wxString v = d.GetValue();
|
||||||
wxString s(title);
|
wxString s(title);
|
||||||
s << _T("\n") << v << _T(" -> ")
|
s << "\n" << v << " -> "
|
||||||
<< wxGetTranslation(v.c_str()) << _T("\n");
|
<< wxGetTranslation(v.c_str()) << "\n";
|
||||||
wxMessageBox(s);
|
wxMessageBox(s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -432,18 +434,19 @@ void MyFrame::OnTest2(wxCommandEvent& WXUNUSED(event))
|
|||||||
const wxString title = _("Testing _N() (ngettext)");
|
const wxString title = _("Testing _N() (ngettext)");
|
||||||
wxTextEntryDialog d(this,
|
wxTextEntryDialog d(this,
|
||||||
_("Please enter range for plural forms of \"n files deleted\" phrase"),
|
_("Please enter range for plural forms of \"n files deleted\" phrase"),
|
||||||
title, _T("0-10"));
|
title, "0-10");
|
||||||
|
|
||||||
if (d.ShowModal() == wxID_OK)
|
if (d.ShowModal() == wxID_OK)
|
||||||
{
|
{
|
||||||
int first, last;
|
int first, last;
|
||||||
wxSscanf(d.GetValue(), _T("%d-%d"), &first, &last);
|
wxSscanf(d.GetValue(), "%d-%d", &first, &last);
|
||||||
wxString s(title);
|
wxString s(title);
|
||||||
s << _T("\n");
|
s << "\n";
|
||||||
for (int n = first; n <= last; ++n)
|
for (int n = first; n <= last; ++n)
|
||||||
{
|
{
|
||||||
s << n << _T(" ") <<
|
s << n << " " <<
|
||||||
wxPLURAL("file deleted", "files deleted", n) <<
|
wxPLURAL("file deleted", "files deleted", n) <<
|
||||||
_T("\n");
|
"\n";
|
||||||
}
|
}
|
||||||
wxMessageBox(s);
|
wxMessageBox(s);
|
||||||
}
|
}
|
||||||
@@ -457,11 +460,12 @@ void MyFrame::OnTest3(wxCommandEvent& WXUNUSED(event))
|
|||||||
wxTRANSLATE("line 2"),
|
wxTRANSLATE("line 2"),
|
||||||
wxTRANSLATE("line 3"),
|
wxTRANSLATE("line 3"),
|
||||||
};
|
};
|
||||||
|
|
||||||
wxString s(_("Testing wxTRANSLATE() (gettext_noop)"));
|
wxString s(_("Testing wxTRANSLATE() (gettext_noop)"));
|
||||||
s << _T("\n");
|
s << "\n";
|
||||||
for (size_t i = 0; i < WXSIZEOF(lines); ++i)
|
for (size_t i = 0; i < WXSIZEOF(lines); ++i)
|
||||||
{
|
{
|
||||||
s << lines[i] << _T(" -> ") << wxGetTranslation(lines[i]) << _T("\n");
|
s << lines[i] << " -> " << wxGetTranslation(lines[i]) << "\n";
|
||||||
}
|
}
|
||||||
wxMessageBox(s);
|
wxMessageBox(s);
|
||||||
}
|
}
|
||||||
|
@@ -19,7 +19,7 @@ A. Your system doesn't have the translation in the language you use, sorry.
|
|||||||
Q. Why the message when I enter '9' is not translated?
|
Q. Why the message when I enter '9' is not translated?
|
||||||
A. This is on purpose: the corresponding string wasn't enclosed in _() macro and
|
A. This is on purpose: the corresponding string wasn't enclosed in _() macro and
|
||||||
so didn't get into the message catalog when it was created using xgettext.
|
so didn't get into the message catalog when it was created using xgettext.
|
||||||
|
|
||||||
Q. Why the message when I enter '17' is only partly translated?
|
Q. Why the message when I enter '17' is only partly translated?
|
||||||
A. This will only work under some versions of Linux, don't worry if the second
|
A. This will only work under some versions of Linux, don't worry if the second
|
||||||
half of the sentence is not translated.
|
half of the sentence is not translated.
|
||||||
@@ -36,7 +36,7 @@ Q. How to do translations to other language?
|
|||||||
A. First of all, you will need the GNU gettext tools (see the next question).
|
A. First of all, you will need the GNU gettext tools (see the next question).
|
||||||
After you've probably installed them, type the following (example is for Unix
|
After you've probably installed them, type the following (example is for Unix
|
||||||
and you should do exactly the same under Windows).
|
and you should do exactly the same under Windows).
|
||||||
|
|
||||||
# all translations forgiven language should be in a separate directory.
|
# all translations forgiven language should be in a separate directory.
|
||||||
# Please use the standard abbreviation for the language names!
|
# Please use the standard abbreviation for the language names!
|
||||||
mkdir <language>
|
mkdir <language>
|
||||||
@@ -44,10 +44,10 @@ A. First of all, you will need the GNU gettext tools (see the next question).
|
|||||||
|
|
||||||
# generate the .po file for the program itself
|
# generate the .po file for the program itself
|
||||||
# see `xgettext --help' for options, "-C" is important!
|
# see `xgettext --help' for options, "-C" is important!
|
||||||
xgettext -C -n -k_ -kwxPLURAL:1,2 -kwxTRANSLATE -k_T -o internat.po ../internat.cpp
|
xgettext -C -n -k_ -kwxPLURAL:1,2 -kwxTRANSLATE -o internat.po ../internat.cpp
|
||||||
|
|
||||||
# .po file for wxWidgets might be generated in the same way. An already
|
# .po file for wxWidgets might be generated in the same way. An already
|
||||||
# generated wxstd.pot as well as translations for some languages can be
|
# generated wxstd.pot as well as translations for some languages can be
|
||||||
# found in the locale directory.
|
# found in the locale directory.
|
||||||
cp ../../locale/<language>.po ./wxstd.pot
|
cp ../../locale/<language>.po ./wxstd.pot
|
||||||
- or -
|
- or -
|
||||||
@@ -64,7 +64,7 @@ A. First of all, you will need the GNU gettext tools (see the next question).
|
|||||||
|
|
||||||
# run the sample to test it
|
# run the sample to test it
|
||||||
cd ..
|
cd ..
|
||||||
./internat <language>
|
./internat <language>
|
||||||
|
|
||||||
Q. How to get the gettext tools?
|
Q. How to get the gettext tools?
|
||||||
A. For Unix, you should be able to get the source distribution of any GNU mirror
|
A. For Unix, you should be able to get the source distribution of any GNU mirror
|
||||||
|
Reference in New Issue
Block a user