Merge branch 'master' of github.com:lordmulder/LameXP

This commit is contained in:
LoRd_MuldeR 2011-12-19 20:54:39 +01:00
commit 06889ec7a9
25 changed files with 2879 additions and 490 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

2351
etc/Translation/LameXP_TW.ts Normal file

File diff suppressed because it is too large Load Diff

View File

@ -111,10 +111,6 @@
<source>Released under the terms of the GNU General Public License.</source> <source>Released under the terms of the GNU General Public License.</source>
<translation>GNU通用公共许可证的条款</translation> <translation>GNU通用公共许可证的条款</translation>
</message> </message>
<message>
<source>LameXP as a whole is copyrighted by LoRd_MuldeR. The copyright of third-party software used in LameXP belongs to the individual authors.</source>
<translation>LameXP作为一个整体的版权归LoRd_MuldeRLameXP使用第三方软件著作权属于作者本人</translation>
</message>
<message> <message>
<source>LameXP - Audio Encoder Front-end</source> <source>LameXP - Audio Encoder Front-end</source>
<translation>LameXP - </translation> <translation>LameXP - </translation>
@ -227,6 +223,10 @@
<source>avs2wav - Avisynth to Wave Audio converter</source> <source>avs2wav - Avisynth to Wave Audio converter</source>
<translation>avs2wav - Avisynth到WAV音频转换器</translation> <translation>avs2wav - Avisynth到WAV音频转换器</translation>
</message> </message>
<message>
<source>LameXP as a whole is copyrighted by LoRd_MuldeR. The copyright of third-party software used in LameXP belongs to the individual authors.</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>AudioFileModel</name> <name>AudioFileModel</name>

View File

@ -9,6 +9,7 @@
<file>flags/kr.png</file> <file>flags/kr.png</file>
<file>flags/pl.png</file> <file>flags/pl.png</file>
<file>flags/ru.png</file> <file>flags/ru.png</file>
<file>flags/tw.png</file>
<file>flags/uk.png</file> <file>flags/uk.png</file>
<file>flags/zh.png</file> <file>flags/zh.png</file>
</qresource> </qresource>

View File

@ -15,6 +15,8 @@
<file>localization/LameXP_PL.qm.txt</file> <file>localization/LameXP_PL.qm.txt</file>
<file>localization/LameXP_RU.qm</file> <file>localization/LameXP_RU.qm</file>
<file>localization/LameXP_RU.qm.txt</file> <file>localization/LameXP_RU.qm.txt</file>
<file>localization/LameXP_TW.qm</file>
<file>localization/LameXP_TW.qm.txt</file>
<file>localization/LameXP_UK.qm</file> <file>localization/LameXP_UK.qm</file>
<file>localization/LameXP_UK.qm.txt</file> <file>localization/LameXP_UK.qm.txt</file>
<file>localization/LameXP_ZH.qm</file> <file>localization/LameXP_ZH.qm</file>

View File

Before

Width:  |  Height:  |  Size: 472 B

After

Width:  |  Height:  |  Size: 472 B

View File

@ -1 +1 @@
42,Deutsch 42,0,Deutsch

View File

@ -1 +1 @@
111,Español 111,0,Español

View File

@ -1 +1 @@
37,Française 37,0,Française

View File

@ -1 +1 @@
58,Italiano 58,0,Italiano

View File

@ -1 +1 @@
66,한국어 66,0,한국어

View File

@ -1 +1 @@
90,Polski 90,0,Polski

View File

@ -1 +1 @@
96,Русский 96,0,Русский

Binary file not shown.

View File

@ -0,0 +1 @@
25,208,繁体中文

View File

@ -1 +1 @@
129,Українська 129,0,Українська

Binary file not shown.

View File

@ -1 +1 @@
25,简体中文 25,44,简体中文

View File

@ -30,7 +30,7 @@
#define VER_LAMEXP_MINOR_LO 4 #define VER_LAMEXP_MINOR_LO 4
#define VER_LAMEXP_TYPE Alpha #define VER_LAMEXP_TYPE Alpha
#define VER_LAMEXP_PATCH 10 #define VER_LAMEXP_PATCH 10
#define VER_LAMEXP_BUILD 818 #define VER_LAMEXP_BUILD 820
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// Tool versions (minimum expected versions!) // Tool versions (minimum expected versions!)

View File

@ -67,8 +67,9 @@ g_lamexp_contributors[] =
{"pl", L"Polski", L"Sir Daniel K", "Sir.Daniel.K@gmail.com"}, {"pl", L"Polski", L"Sir Daniel K", "Sir.Daniel.K@gmail.com"},
{"ru", L"Русский", L"Neonailol", "Neonailol@gmail.com" }, {"ru", L"Русский", L"Neonailol", "Neonailol@gmail.com" },
{"", L"", L"Иван Митин", "bardak@inbox.ru" }, {"", L"", L"Иван Митин", "bardak@inbox.ru" },
{"tw", L"繁体中文", L"456Vv", "123@456vv.com" },
{"uk", L"Українська", L"Arestarh", "Arestarh@ukr.net" }, {"uk", L"Українська", L"Arestarh", "Arestarh@ukr.net" },
{"zh", L"普通话", L"456Vv", "123@456vv.com" }, {"zh", L"简体中文", L"456Vv", "123@456vv.com" },
{NULL, NULL, NULL, NULL} {NULL, NULL, NULL, NULL}
}; };

View File

@ -186,6 +186,7 @@ static struct
QMap<QString, QString> files; QMap<QString, QString> files;
QMap<QString, QString> names; QMap<QString, QString> names;
QMap<QString, unsigned int> sysid; QMap<QString, unsigned int> sysid;
QMap<QString, unsigned int> cntry;
} }
g_lamexp_translation; g_lamexp_translation;
@ -1251,7 +1252,7 @@ const QString lamexp_version2string(const QString &pattern, unsigned int version
/* /*
* Register a new translation * Register a new translation
*/ */
bool lamexp_translation_register(const QString &langId, const QString &qmFile, const QString &langName, unsigned int &systemId) bool lamexp_translation_register(const QString &langId, const QString &qmFile, const QString &langName, unsigned int &systemId, unsigned int &country)
{ {
if(qmFile.isEmpty() || langName.isEmpty() || systemId < 1) if(qmFile.isEmpty() || langName.isEmpty() || systemId < 1)
{ {
@ -1261,6 +1262,7 @@ bool lamexp_translation_register(const QString &langId, const QString &qmFile, c
g_lamexp_translation.files.insert(langId, qmFile); g_lamexp_translation.files.insert(langId, qmFile);
g_lamexp_translation.names.insert(langId, langName); g_lamexp_translation.names.insert(langId, langName);
g_lamexp_translation.sysid.insert(langId, systemId); g_lamexp_translation.sysid.insert(langId, systemId);
g_lamexp_translation.cntry.insert(langId, country);
return true; return true;
} }
@ -1289,6 +1291,14 @@ unsigned int lamexp_translation_sysid(const QString &langId)
return g_lamexp_translation.sysid.value(langId.toLower(), 0); return g_lamexp_translation.sysid.value(langId.toLower(), 0);
} }
/*
* Get translation script id
*/
unsigned int lamexp_translation_country(const QString &langId)
{
return g_lamexp_translation.cntry.value(langId.toLower(), 0);
}
/* /*
* Install a new translator * Install a new translator
*/ */

View File

@ -111,9 +111,10 @@ bool lamexp_is_hibernation_supported(void);
//Translation support //Translation support
QStringList lamexp_query_translations(void); QStringList lamexp_query_translations(void);
bool lamexp_translation_register(const QString &langId, const QString &qmFile, const QString &langName, unsigned int &systemId); bool lamexp_translation_register(const QString &langId, const QString &qmFile, const QString &langName, unsigned int &systemId, unsigned int &country);
QString lamexp_translation_name(const QString &language); QString lamexp_translation_name(const QString &language);
unsigned int lamexp_translation_sysid(const QString &langId); unsigned int lamexp_translation_sysid(const QString &langId);
unsigned int lamexp_translation_country(const QString &langId);
bool lamexp_install_translator_from_file(const QString &qmFile); bool lamexp_install_translator_from_file(const QString &qmFile);
bool lamexp_install_translator(const QString &language); bool lamexp_install_translator(const QString &language);
QStringList lamexp_available_codepages(bool noAliases = true); QStringList lamexp_available_codepages(bool noAliases = true);

View File

@ -271,17 +271,38 @@ QString SettingsModel::defaultLanguage(void)
return *m_defaultLanguage; return *m_defaultLanguage;
} }
//Check if we can use the default translation //Detect system langauge
QLocale systemLanguage= QLocale::system(); QLocale systemLanguage= QLocale::system();
if(systemLanguage.language() == QLocale::English || systemLanguage.language() == QLocale::C) qDebug("[Locale]");
qDebug("Language: %s (%d)", QLocale::languageToString(systemLanguage.language()).toUtf8().constData(), systemLanguage.language());
qDebug("Country is: %s (%d)", QLocale::countryToString(systemLanguage.country()).toUtf8().constData(), systemLanguage.country());
qDebug("Script is: %s (%d)\n", QLocale::scriptToString(systemLanguage.script()).toUtf8().constData(), systemLanguage.script());
//Check if we can use the default translation
if(systemLanguage.language() == QLocale::English /*|| systemLanguage.language() == QLocale::C*/)
{ {
m_defaultLanguage = new QString(LAMEXP_DEFAULT_LANGID); m_defaultLanguage = new QString(LAMEXP_DEFAULT_LANGID);
return LAMEXP_DEFAULT_LANGID; return LAMEXP_DEFAULT_LANGID;
} }
//Try to find a suitable translation for the user's system language //Try to find a suitable translation for the user's system language *and* country
QStringList languages = lamexp_query_translations(); QStringList languages = lamexp_query_translations();
while(!languages.isEmpty()) while(!languages.isEmpty())
{
QString currentLangId = languages.takeFirst();
if(lamexp_translation_sysid(currentLangId) == systemLanguage.language())
{
if(lamexp_translation_country(currentLangId) == systemLanguage.country())
{
m_defaultLanguage = new QString(currentLangId);
return currentLangId;
}
}
}
//Try to find a suitable translation for the user's system language
languages = lamexp_query_translations();
while(!languages.isEmpty())
{ {
QString currentLangId = languages.takeFirst(); QString currentLangId = languages.takeFirst();
if(lamexp_translation_sysid(currentLangId) == systemLanguage.language()) if(lamexp_translation_sysid(currentLangId) == systemLanguage.language())

View File

@ -246,8 +246,8 @@ void InitializationThread::initTranslations(void)
while(!qmFiles.isEmpty()) while(!qmFiles.isEmpty())
{ {
QString langId, langName; QString langId, langName;
unsigned int systemId = 0, country = 0;
QString qmFile = qmFiles.takeFirst(); QString qmFile = qmFiles.takeFirst();
unsigned int systemId = 0;
QRegExp langIdExp("LameXP_(\\w\\w)\\.qm", Qt::CaseInsensitive); QRegExp langIdExp("LameXP_(\\w\\w)\\.qm", Qt::CaseInsensitive);
if(langIdExp.indexIn(qmFile) >= 0) if(langIdExp.indexIn(qmFile) >= 0)
@ -262,10 +262,11 @@ void InitializationThread::initTranslations(void)
while(!stream.atEnd()) while(!stream.atEnd())
{ {
QStringList langInfo = stream.readLine().simplified().split(",", QString::SkipEmptyParts); QStringList langInfo = stream.readLine().simplified().split(",", QString::SkipEmptyParts);
if(langInfo.count() == 2) if(langInfo.count() == 3)
{ {
systemId = langInfo.at(0).trimmed().toUInt(); systemId = langInfo.at(0).trimmed().toUInt();
langName = langInfo.at(1).trimmed(); country = langInfo.at(1).trimmed().toUInt();
langName = langInfo.at(2).trimmed();
break; break;
} }
} }
@ -274,9 +275,9 @@ void InitializationThread::initTranslations(void)
if(!(langId.isEmpty() || langName.isEmpty() || systemId == 0)) if(!(langId.isEmpty() || langName.isEmpty() || systemId == 0))
{ {
if(lamexp_translation_register(langId, qmFile, langName, systemId)) if(lamexp_translation_register(langId, qmFile, langName, systemId, country))
{ {
qDebug("Registering translation: %s = %s (%u)", qmFile.toUtf8().constData(), langName.toUtf8().constData(), systemId); qDebug("Registering translation: %s = %s (%u) [%u]", qmFile.toUtf8().constData(), langName.toUtf8().constData(), systemId, country);
} }
else else
{ {