fix ngettext issue

This commit is contained in:
tildearrow 2024-05-27 16:02:36 -05:00
parent 4e18bb7ee9
commit 972346d22d
3 changed files with 12 additions and 1 deletions

View file

@ -4578,9 +4578,15 @@ bool FurnaceGUI::loop() {
int totalMonths=totalDays/30; int totalMonths=totalDays/30;
totalDays%=30; totalDays%=30;
#ifdef HAVE_LOCALE
info+=fmt::sprintf(ngettext("%d year ","%d years ",totalYears),totalYears); info+=fmt::sprintf(ngettext("%d year ","%d years ",totalYears),totalYears);
info+=fmt::sprintf(ngettext("%d month ","%d months ",totalMonths),totalMonths); info+=fmt::sprintf(ngettext("%d month ","%d months ",totalMonths),totalMonths);
info+=fmt::sprintf(ngettext("%d day ","%d days ",totalDays),totalDays); info+=fmt::sprintf(ngettext("%d day ","%d days ",totalDays),totalDays);
#else
info+=fmt::sprintf(_GN("%d year ","%d years ",totalYears),totalYears);
info+=fmt::sprintf(_GN("%d month ","%d months ",totalMonths),totalMonths);
info+=fmt::sprintf(_GN("%d day ","%d days ",totalDays),totalDays);
#endif
} }
if (totalSeconds>=3600) { if (totalSeconds>=3600) {

View file

@ -1406,8 +1406,13 @@ void FurnaceGUI::drawSettings() {
TAAudioDesc& audioWant=e->getAudioDescWant(); TAAudioDesc& audioWant=e->getAudioDescWant();
TAAudioDesc& audioGot=e->getAudioDescGot(); TAAudioDesc& audioGot=e->getAudioDescGot();
#ifdef HAVE_LOCALE
ImGui::Text(ngettext("want: %d samples @ %.0fHz (%d channel)","want: %d samples @ %.0fHz (%d channels)",audioWant.outChans),audioWant.bufsize,audioWant.rate,audioWant.outChans); ImGui::Text(ngettext("want: %d samples @ %.0fHz (%d channel)","want: %d samples @ %.0fHz (%d channels)",audioWant.outChans),audioWant.bufsize,audioWant.rate,audioWant.outChans);
ImGui::Text(ngettext("got: %d samples @ %.0fHz (%d channel)","got: %d samples @ %.0fHz (%d channels)",audioGot.outChans),audioGot.bufsize,audioGot.rate,audioGot.outChans); ImGui::Text(ngettext("got: %d samples @ %.0fHz (%d channel)","got: %d samples @ %.0fHz (%d channels)",audioGot.outChans),audioGot.bufsize,audioGot.rate,audioGot.outChans);
#else
ImGui::Text(_GN("want: %d samples @ %.0fHz (%d channel)","want: %d samples @ %.0fHz (%d channels)",audioWant.outChans),audioWant.bufsize,audioWant.rate,audioWant.outChans);
ImGui::Text(_GN("got: %d samples @ %.0fHz (%d channel)","got: %d samples @ %.0fHz (%d channels)",audioGot.outChans),audioGot.bufsize,audioGot.rate,audioGot.outChans);
#endif
// SUBSECTION MIXING // SUBSECTION MIXING
CONFIG_SUBSECTION(_("Mixing")); CONFIG_SUBSECTION(_("Mixing"));

View file

@ -47,9 +47,9 @@ typedef std::string String;
#define _(_str) gettext(_str) #define _(_str) gettext(_str)
#else #else
#define _(_str) _str #define _(_str) _str
#define ngettext(_strS,_strP,_cond) (((_cond)==1)?(_strS):(_strP))
#endif #endif
#define _GN(_strS,_strP,_cond) (((_cond)==1)?(_strS):(_strP))
#define _N(_str) _str #define _N(_str) _str
typedef std::wstring WString; typedef std::wstring WString;