From c6adb2863a33f81295f019d656bd06914ccd38c2 Mon Sep 17 00:00:00 2001 From: Fred Gleason Date: Thu, 29 Sep 2022 15:21:39 -0400 Subject: [PATCH] 2022-09-29 Fred Gleason * Added a workaround for a bug in 'QTranslator::load()' that indicates failure when attempting to load a valid-but-null translation map. Signed-off-by: Fred Gleason --- ChangeLog | 4 ++++ lib/rdtranslator.cpp | 14 ++++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 51ef9cef..05f2e651 100644 --- a/ChangeLog +++ b/ChangeLog @@ -23427,3 +23427,7 @@ 2022-09-29 Fred Gleason * Fixed a bug in 'rdcartslots/Makefile.am' that caused i18n translation maps for rdcartslots(1) to fail to be generated. +2022-09-29 Fred Gleason + * Added a workaround for a bug in 'QTranslator::load()' that + indicates failure when attempting to load a valid-but-null + translation map. diff --git a/lib/rdtranslator.cpp b/lib/rdtranslator.cpp index 36dff741..550d302c 100644 --- a/lib/rdtranslator.cpp +++ b/lib/rdtranslator.cpp @@ -19,6 +19,7 @@ // #include +#include #include "rdapplication.h" #include "rdtranslator.h" @@ -45,10 +46,15 @@ bool RDTranslator::LoadTranslation(const QString &filename, { QTranslator *qt=new QTranslator(0); if(!qt->load(filename,dirname)) { - fprintf(stderr,"%s: failed to load translation file \"%s/%s\"\n", - d_command_name.toUtf8().constData(), - dirname.toUtf8().constData(), - filename.toUtf8().constData()); + // + // Silly workaround so we don't false alarm on a valid-but-null file + // + if(QFile(dirname+"/"+filename).size()!=16) { + fprintf(stderr,"%s: failed to load translation file \"%s/%s\"\n", + d_command_name.toUtf8().constData(), + dirname.toUtf8().constData(), + filename.toUtf8().constData()); + } delete qt; return false; }