2023-06-01 Fred Gleason <fredg@paravelsystems.com>

* Fixed a bug that would cause 'failed to load translation file'
	warnings to be sent to the Apache error log.

Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
Fred Gleason
2023-06-01 15:48:34 -04:00
parent ef6165184e
commit 210bb8bca7
59 changed files with 105 additions and 65 deletions

View File

@@ -25,8 +25,9 @@
RDApplication *rda=NULL;
RDApplication::RDApplication(const QString &module_name,const QString &cmdname,
const QString &usage,QObject *parent)
: RDCoreApplication(module_name,cmdname,usage,parent)
const QString &usage,bool use_translations,
QObject *parent)
: RDCoreApplication(module_name,cmdname,usage,use_translations,parent)
{
app_icon_engine=new RDIconEngine();
}

View File

@@ -29,7 +29,7 @@ class RDApplication : public RDCoreApplication
Q_OBJECT;
public:
RDApplication(const QString &module_name,const QString &cmdname,
const QString &usage,QObject *parent);
const QString &usage,bool use_translations,QObject *parent);
~RDApplication();
RDIconEngine *iconEngine() const;
static QString locale();

View File

@@ -45,7 +45,8 @@ void __RDCoreApplication_ExitCallback()
RDCoreApplication::RDCoreApplication(const QString &module_name,
const QString &cmdname,
const QString &usage,QObject *parent)
const QString &usage,bool use_translations,
QObject *parent)
: QObject(parent)
{
app_module_name=module_name;
@@ -81,7 +82,7 @@ RDCoreApplication::RDCoreApplication(const QString &module_name,
//
// Translations
//
rdt=new RDTranslator(app_command_name,this);
rdt=new RDTranslator(app_command_name,use_translations,this);
atexit(__RDCoreApplication_ExitCallback);
}

View File

@@ -56,7 +56,7 @@ class RDCoreApplication : public QObject
ExitInvalidCart=16,ExitNoSchedCode=17,
ExitBadTicket=18,ExitNoStation=19,ExitLast=20};
RDCoreApplication(const QString &module_name,const QString &cmdname,
const QString &usage,QObject *parent=0);
const QString &usage,bool use_translations,QObject *parent);
~RDCoreApplication();
bool open(QString *err_msg,ErrorType *err_type,bool check_svc);
RDAirPlayConf *airplayConf();

View File

@@ -26,13 +26,14 @@
RDTranslator *rdt=NULL;
RDTranslator::RDTranslator(const QString &cmdname,QObject *parent)
RDTranslator::RDTranslator(const QString &cmdname,bool use_translations,
QObject *parent)
: QObject(parent)
{
d_command_name=cmdname;
QString loc=RDApplication::locale().left(2)+".qm";
if(loc.left(2)!="en") { // There are no English translations
if(use_translations&&(loc.left(2)!="en")) { // There are no English translations
LoadTranslation("qt_"+loc,"/usr/share/qt5/translations");
LoadTranslation("librd_"+loc,"/usr/share/rivendell");
LoadTranslation("rdhpi_"+loc,"/usr/share/rivendell");

View File

@@ -27,7 +27,7 @@ class RDTranslator : public QObject
{
Q_OBJECT;
public:
RDTranslator(const QString &cmdname,QObject *parent=0);
RDTranslator(const QString &cmdname,bool use_translations,QObject *parent=0);
private:
bool LoadTranslation(const QString &filename,const QString &dirname);