1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-09-17 16:50:26 +02:00

Fix uses of wxPLURAL and update audacity.pot ...

so that
(1) we really get msgid_plural entries in the .pot
(2) i18n-comments get extracted too (needs workaround of xgettext bug)
This commit is contained in:
Paul Licameli 2018-01-05 00:35:04 -05:00
parent d5dca050bd
commit c66eae1a46
4 changed files with 61 additions and 39 deletions

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: audacity 2.2.0\n"
"Report-Msgid-Bugs-To: audacity-translation@lists.sourceforge.net\n"
"POT-Creation-Date: 2018-01-04 19:54-0500\n"
"POT-Creation-Date: 2018-01-05 00:25-0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -4135,20 +4135,20 @@ msgstr ""
msgid "Split New"
msgstr ""
#. i18n-hint:
#. i18n-hint: in the string after this one,
#. first number identifies one of a sequence of clips,
#. last number counts the clips,
#. string names a track
#.
#: src/Menus.cpp
#, c-format
msgid "%d of %d clip %s"
msgid "dummyStringOnSelectClip"
msgstr ""
#: src/Menus.cpp
#, c-format
msgid "%d of %d clips %s"
msgstr ""
msgid "%d of %d clip %s"
msgid_plural "%d of %d clips %s"
msgstr[0] ""
msgstr[1] ""
#: src/Menus.cpp src/import/Import.cpp
#, c-format
@ -4259,14 +4259,15 @@ msgstr ""
#. and the last string is the name of the track containing the clips.
#.
#: src/Menus.cpp
#, c-format
msgid "%s %d of %d clip %s"
msgid "dummyStringClipBoundaryMessage"
msgstr ""
#: src/Menus.cpp
#, c-format
msgid "%s %d of %d clips %s"
msgstr ""
msgid "%s %d of %d clip %s"
msgid_plural "%s %d of %d clips %s"
msgstr[0] ""
msgstr[1] ""
#: src/Menus.cpp
msgid "start"
@ -4276,15 +4277,24 @@ msgstr ""
msgid "end"
msgstr ""
#. i18n-hint: in the string after this one,
#. First two %s are each replaced with the noun "start"
#. or with "end", identifying and end of a clip,
#. first and second numbers give the position of those clips in
#. a seqeunce of clips,
#. last number counts all clips,
#. and the last string is the name of the track containing the clips.
#.
#: src/Menus.cpp
#, c-format
msgid "%s %d and %s %d of %d clip %s"
msgid "dummyStringClipBoundaryMessageLong"
msgstr ""
#: src/Menus.cpp
#, c-format
msgid "%s %d and %s %d of %d clips %s"
msgstr ""
msgid "%s %d and %s %d of %d clip %s"
msgid_plural "%s %d and %s %d of %d clips %s"
msgstr[0] ""
msgstr[1] ""
#. i18n-hint: In this and similar messages describing editing actions,
#. the starting or ending points of tracks are re-"aligned" to other
@ -4875,11 +4885,9 @@ msgstr ""
#: src/PluginManager.cpp
msgid "Enable this plug-in?"
msgstr ""
#: src/PluginManager.cpp
msgid "Enable these plug-ins?"
msgstr ""
msgid_plural "Enable these plug-ins?"
msgstr[0] ""
msgstr[1] ""
#: src/PluginManager.cpp
msgid "Enable new plug-ins"

View File

@ -233,8 +233,23 @@ extern const wxString& GetCustomSubstitution(const wxString& str1 );
#undef wxPLURAL
#endif
// Note: The strings will go to the .pot file (do not use _(...)).
#define wxPLURAL(sing, plur, n) wxGetTranslation((sing), (plur), n)
// The two string arugments will go to the .pot file, as
// msgid sing
// msgid_plural plural
//
// (You must use plain string literals. Do not use _() or wxT() or L prefix,
// which (inentionally) will fail to compile. The macro inserts wxT).
//
// Note too: it seems an i18n-hint comment is not extracted if it precedes
// wxPLURAL directly. A workaround: after the comment, insert a line
// _("dummyStringXXXX");
// where for XXXX subsitute something making this dummy string unique in the
// program. Then check in your generated audacity.pot that the dummy is
// immediately before the singular/plural entry.
//
// Your i18n-comment should therefore say something like,
// "In the string after this one, ..."
#define wxPLURAL(sing, plur, n) wxGetTranslation( wxT(sing), wxT(plur), n)
#ifdef _

View File

@ -6352,14 +6352,14 @@ void AudacityProject::OnSelectClip(bool next)
for (auto& result : results) {
auto longName = result.ComposeTrackName();
auto nClips = result.waveTrack->GetNumClips();
auto format = wxPLURAL(
/* i18n-hint:
/* i18n-hint: in the string after this one,
first number identifies one of a sequence of clips,
last number counts the clips,
string names a track
*/
_("%d of %d clip %s"),
_("%d of %d clips %s"),
string names a track */
_("dummyStringOnSelectClip")
auto format = wxPLURAL(
"%d of %d clip %s",
"%d of %d clips %s",
nClips
);
auto str = wxString::Format( format, result.index + 1, nClips, longName );
@ -7449,7 +7449,6 @@ wxString AudacityProject::ClipBoundaryMessage(const std::vector<FoundClipBoundar
wxString str;
auto nClips = result.waveTrack->GetNumClips();
if (result.nFound < 2) {
auto format = wxPLURAL(
/* i18n-hint: First %s is replaced with the noun "start" or "end"
identifying one end of a clip,
first number gives the position of that clip in a sequence
@ -7457,8 +7456,10 @@ wxString AudacityProject::ClipBoundaryMessage(const std::vector<FoundClipBoundar
last number counts all clips,
and the last string is the name of the track containing the clips.
*/
_("%s %d of %d clip %s"),
_("%s %d of %d clips %s"),
_("dummyStringClipBoundaryMessage");
auto format = wxPLURAL(
"%s %d of %d clip %s",
"%s %d of %d clips %s",
nClips
);
str = wxString::Format(format,
@ -7469,16 +7470,18 @@ wxString AudacityProject::ClipBoundaryMessage(const std::vector<FoundClipBoundar
);
}
else {
/* i18n-hint: First two %s are each replaced with the noun "start"
/* i18n-hint: in the string after this one,
First two %s are each replaced with the noun "start"
or with "end", identifying and end of a clip,
first and second numbers give the position of those clips in
a seqeunce of clips,
last number counts all clips,
and the last string is the name of the track containing the clips.
*/
_("dummyStringClipBoundaryMessageLong");
auto format = wxPLURAL(
_("%s %d and %s %d of %d clip %s"),
_("%s %d and %s %d of %d clips %s"),
"%s %d and %s %d of %d clip %s",
"%s %d and %s %d of %d clips %s",
nClips
);
str = wxString::Format(format,

View File

@ -1835,11 +1835,7 @@ bool PluginManager::DropFile(const wxString &fileName)
// Ask whether to enable the plug-ins
if (auto nIds = ids.size()) {
auto message = wxPLURAL(
_("Enable this plug-in?"),
_("Enable these plug-ins?"),
nIds
);
auto message = wxPLURAL( "Enable this plug-in?", "Enable these plug-ins?", nIds );
message += wxT("\n");
for (const auto &name : names)
message += name + wxT("\n");