Add conversion from ISO-639-2/B codes to language names

This commit is contained in:
Martchus 2019-08-17 20:58:14 +02:00
parent a5224d930d
commit d3f84c4c39
4 changed files with 9 additions and 6 deletions

View File

@ -18,6 +18,7 @@
#include <tagparser/abstracttrack.h>
#include <tagparser/backuphelper.h>
#include <tagparser/diagnostics.h>
#include <tagparser/language.h>
#include <tagparser/mediafileinfo.h>
#include <tagparser/progressfeedback.h>
#include <tagparser/tag.h>
@ -198,8 +199,8 @@ void displayFileInfo(const ArgumentOccurrence &, const Argument &filesArg, const
printProperty("ID", track->id(), nullptr, true);
printProperty("Name", track->name());
printProperty("Type", track->mediaTypeName());
if (track->language() != "und") {
printProperty("Language", track->language());
if (isLanguageDefined(track->language())) {
printProperty("Language", languageNameFromIsoWithFallback(track->language()));
}
const char *fmtName = track->formatName(), *fmtAbbr = track->formatAbbreviation();
printProperty("Format", fmtName);

View File

@ -7,6 +7,7 @@
#include <tagparser/abstractcontainer.h>
#include <tagparser/abstracttrack.h>
#include <tagparser/diagnostics.h>
#include <tagparser/language.h>
#include <tagparser/matroska/matroskacontainer.h>
#include <tagparser/matroska/matroskaeditionentry.h>
#include <tagparser/mediafileinfo.h>
@ -415,7 +416,7 @@ void FileInfoModel::updateCache()
}
trackHelper.appendRow(tr("Creation time"), track->creationTime());
trackHelper.appendRow(tr("Modification time"), track->modificationTime());
trackHelper.appendRow(tr("Language"), track->language());
trackHelper.appendRow(tr("Language"), languageNameFromIsoWithFallback(track->language()));
trackHelper.appendRow(tr("Compressor name"), track->compressorName());
if (track->samplingFrequency()) {
trackHelper.appendRow(tr("Sampling frequency"),

View File

@ -6,6 +6,7 @@
#include <tagparser/abstractattachment.h>
#include <tagparser/abstractcontainer.h>
#include <tagparser/abstracttrack.h>
#include <tagparser/language.h>
#include <tagparser/matroska/matroskacontainer.h>
#include <tagparser/matroska/matroskaeditionentry.h>
#include <tagparser/mediafileinfo.h>
@ -587,7 +588,7 @@ public:
qstr(track->modificationTime().toString(DateTimeOutputFormat::DateAndTime, true)));
}
if (!track->language().empty()) {
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Language"), qstr(track->language()));
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Language"), qstr(languageNameFromIsoWithFallback(track->language())));
}
if (!track->compressorName().empty()) {
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Compressor name"), qstr(track->compressorName()));

View File

@ -828,7 +828,7 @@ void CliTests::testSettingTrackMetaData()
" ID 3134325680\n"
" Name audio track\n"
" Type Audio\n"
" Language ger\n"
" Language German\n"
" Format Advanced Audio Coding Low Complexity Profile\n"
" Abbreviation MPEG-4 AAC-LC\n"
" Raw format ID A_AAC\n"
@ -858,7 +858,7 @@ void CliTests::testSettingTrackMetaData()
" ID 1\n"
" Name sbr and ps\n"
" Type Audio\n"
" Language eng\n"
" Language English\n"
" Format Advanced Audio Coding Low Complexity Profile\n"
" Abbreviation MPEG-4 AAC-LC\n"
" Extensions Spectral Band Replication and Parametric Stereo / HE-AAC v2\n"