Improved language file initialization code.
This commit is contained in:
parent
44da665abc
commit
6657745daa
@ -2289,32 +2289,32 @@
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/Dialog_MetaInfo.cpp" line="84"/>
|
||||
<location filename="../../src/Dialog_MetaInfo.cpp" line="87"/>
|
||||
<source>Meta Information</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/Dialog_MetaInfo.cpp" line="84"/>
|
||||
<location filename="../../src/Dialog_MetaInfo.cpp" line="87"/>
|
||||
<source>The following meta information have been extracted from the original file.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/Dialog_MetaInfo.cpp" line="103"/>
|
||||
<location filename="../../src/Dialog_MetaInfo.cpp" line="106"/>
|
||||
<source>Meta Information: %1</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/Dialog_MetaInfo.cpp" line="157"/>
|
||||
<location filename="../../src/Dialog_MetaInfo.cpp" line="160"/>
|
||||
<source>Load Artwork</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/Dialog_MetaInfo.cpp" line="173"/>
|
||||
<location filename="../../src/Dialog_MetaInfo.cpp" line="176"/>
|
||||
<source>Artwork Error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/Dialog_MetaInfo.cpp" line="173"/>
|
||||
<location filename="../../src/Dialog_MetaInfo.cpp" line="176"/>
|
||||
<source>Sorry, failed to load artwork from selected file!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
@ -2289,32 +2289,32 @@
|
||||
<translation type="unfinished">Usuń okładkę</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/Dialog_MetaInfo.cpp" line="84"/>
|
||||
<location filename="../../src/Dialog_MetaInfo.cpp" line="87"/>
|
||||
<source>Meta Information</source>
|
||||
<translation type="unfinished">Metadane</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/Dialog_MetaInfo.cpp" line="84"/>
|
||||
<location filename="../../src/Dialog_MetaInfo.cpp" line="87"/>
|
||||
<source>The following meta information have been extracted from the original file.</source>
|
||||
<translation type="unfinished">Następujące metadane zostały wyodrębnione z oryginalnego pliku.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/Dialog_MetaInfo.cpp" line="103"/>
|
||||
<location filename="../../src/Dialog_MetaInfo.cpp" line="106"/>
|
||||
<source>Meta Information: %1</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/Dialog_MetaInfo.cpp" line="157"/>
|
||||
<location filename="../../src/Dialog_MetaInfo.cpp" line="160"/>
|
||||
<source>Load Artwork</source>
|
||||
<translation type="unfinished">Załaduj okładkę</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/Dialog_MetaInfo.cpp" line="173"/>
|
||||
<location filename="../../src/Dialog_MetaInfo.cpp" line="176"/>
|
||||
<source>Artwork Error</source>
|
||||
<translation type="unfinished">Błąd pliku okładki</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/Dialog_MetaInfo.cpp" line="173"/>
|
||||
<location filename="../../src/Dialog_MetaInfo.cpp" line="176"/>
|
||||
<source>Sorry, failed to load artwork from selected file!</source>
|
||||
<translation type="unfinished">Załadowanie pliku okładki zakończone niepowodzeniem!</translation>
|
||||
</message>
|
||||
|
@ -30,7 +30,7 @@
|
||||
#define VER_LAMEXP_MINOR_LO 4
|
||||
#define VER_LAMEXP_TYPE Alpha
|
||||
#define VER_LAMEXP_PATCH 10
|
||||
#define VER_LAMEXP_BUILD 813
|
||||
#define VER_LAMEXP_BUILD 816
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Tool versions (minimum expected versions!)
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include <QLibrary>
|
||||
#include <QResource>
|
||||
#include <QTime>
|
||||
#include <QTextStream>
|
||||
|
||||
/* helper macros */
|
||||
#define PRINT_CPU_TYPE(X) case X: qDebug("Selected CPU is: " #X)
|
||||
@ -245,33 +246,42 @@ void InitializationThread::initTranslations(void)
|
||||
while(!qmFiles.isEmpty())
|
||||
{
|
||||
QString langId, langName;
|
||||
unsigned int systemId = 0;
|
||||
QString qmFile = qmFiles.takeFirst();
|
||||
unsigned int systemId = 0;
|
||||
|
||||
QRegExp langIdExp("LameXP_(\\w\\w)\\.qm", Qt::CaseInsensitive);
|
||||
if(langIdExp.indexIn(qmFile) >= 0)
|
||||
{
|
||||
langId = langIdExp.cap(1).toLower();
|
||||
}
|
||||
|
||||
QResource langRes = (QString(":/localization/%1.txt").arg(qmFile));
|
||||
if(langRes.isValid() && langRes.size() > 0)
|
||||
{
|
||||
QStringList langInfo = QString::fromUtf8(reinterpret_cast<const char*>(langRes.data()), langRes.size()).simplified().split(",", QString::SkipEmptyParts);
|
||||
if(langInfo.count() == 2)
|
||||
QResource langRes = QResource(QString(":/localization/%1.txt").arg(qmFile));
|
||||
if(langRes.isValid() && langRes.size() > 0)
|
||||
{
|
||||
systemId = langInfo.at(0).toUInt();
|
||||
langName = langInfo.at(1);
|
||||
QByteArray data = QByteArray::fromRawData(reinterpret_cast<const char*>(langRes.data()), langRes.size());
|
||||
QTextStream stream(&data, QIODevice::ReadOnly);
|
||||
stream.setAutoDetectUnicode(false); stream.setCodec("UTF-8");
|
||||
while(!stream.atEnd())
|
||||
{
|
||||
QStringList langInfo = stream.readLine().simplified().split(",", QString::SkipEmptyParts);
|
||||
if(langInfo.count() == 2)
|
||||
{
|
||||
systemId = langInfo.at(0).trimmed().toUInt();
|
||||
langName = langInfo.at(1).trimmed();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(lamexp_translation_register(langId, qmFile, langName, systemId))
|
||||
|
||||
if(!(langId.isEmpty() || langName.isEmpty() || systemId == 0))
|
||||
{
|
||||
qDebug("Registering translation: %s = %s (%u)", qmFile.toUtf8().constData(), langName.toUtf8().constData(), systemId);
|
||||
}
|
||||
else
|
||||
{
|
||||
qWarning("Failed to register: %s", qmFile.toLatin1().constData());
|
||||
if(lamexp_translation_register(langId, qmFile, langName, systemId))
|
||||
{
|
||||
qDebug("Registering translation: %s = %s (%u)", qmFile.toUtf8().constData(), langName.toUtf8().constData(), systemId);
|
||||
}
|
||||
else
|
||||
{
|
||||
qWarning("Failed to register: %s", qmFile.toLatin1().constData());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user