[libcalamares] Log the Python language-search process just once
- log the list of search paths once - log the found-language as if from Python - warn always if none are found
This commit is contained in:
parent
7bdccd0ea7
commit
b0149c2712
@ -16,6 +16,7 @@
|
|||||||
#include "partition/Mount.h"
|
#include "partition/Mount.h"
|
||||||
#include "utils/CalamaresUtilsSystem.h"
|
#include "utils/CalamaresUtilsSystem.h"
|
||||||
#include "utils/Logger.h"
|
#include "utils/Logger.h"
|
||||||
|
#include "utils/RAII.h"
|
||||||
#include "utils/String.h"
|
#include "utils/String.h"
|
||||||
|
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
@ -241,6 +242,10 @@ _add_localedirs( QStringList& pathList, const QString& candidate )
|
|||||||
bp::object
|
bp::object
|
||||||
gettext_path()
|
gettext_path()
|
||||||
{
|
{
|
||||||
|
// Going to log informatively just once
|
||||||
|
static bool first_time = true;
|
||||||
|
cPointerSetter( &first_time, false );
|
||||||
|
|
||||||
// TODO: distinguish between -d runs and normal runs
|
// TODO: distinguish between -d runs and normal runs
|
||||||
// TODO: can we detect DESTDIR-installs?
|
// TODO: can we detect DESTDIR-installs?
|
||||||
QStringList candidatePaths
|
QStringList candidatePaths
|
||||||
@ -257,21 +262,26 @@ gettext_path()
|
|||||||
}
|
}
|
||||||
_add_localedirs( candidatePaths, QDir().canonicalPath() ); // .
|
_add_localedirs( candidatePaths, QDir().canonicalPath() ); // .
|
||||||
|
|
||||||
|
if ( first_time )
|
||||||
|
{
|
||||||
cDebug() << "Determining gettext path from" << candidatePaths;
|
cDebug() << "Determining gettext path from" << candidatePaths;
|
||||||
|
}
|
||||||
|
|
||||||
QStringList candidateLanguages = _gettext_languages();
|
QStringList candidateLanguages = _gettext_languages();
|
||||||
|
|
||||||
for ( const auto& lang : candidateLanguages )
|
for ( const auto& lang : candidateLanguages )
|
||||||
|
{
|
||||||
for ( auto localedir : candidatePaths )
|
for ( auto localedir : candidatePaths )
|
||||||
{
|
{
|
||||||
QDir ldir( localedir );
|
QDir ldir( localedir );
|
||||||
if ( ldir.cd( lang ) )
|
if ( ldir.cd( lang ) )
|
||||||
{
|
{
|
||||||
cDebug() << Logger::SubEntry << "Found" << lang << "in" << ldir.canonicalPath();
|
Logger::CDebug( Logger::LOGDEBUG )
|
||||||
|
<< output_prefix << "Found gettext" << lang << "in" << ldir.canonicalPath();
|
||||||
return bp::object( localedir.toStdString() );
|
return bp::object( localedir.toStdString() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cDebug() << Logger::SubEntry << "No translation found for languages" << candidateLanguages;
|
}
|
||||||
|
cWarning() << "No translation found for languages" << candidateLanguages;
|
||||||
return bp::object(); // None
|
return bp::object(); // None
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user