diff --git a/src/extension.cpp b/src/extension.cpp index f610fc60..bf0db9a9 100644 --- a/src/extension.cpp +++ b/src/extension.cpp @@ -308,16 +308,26 @@ TranslationExtension::parseTranslation(std::filesystem::path const& extensionFol const QString& identifier, const QJsonObject& jsonTranslation) { - const auto name = jsonTranslation["name"].toString(); const auto jsonGlobFiles = jsonTranslation["files"].toVariant().toStringList(); std::vector qm_files = globExtensionFiles(extensionFolder, jsonGlobFiles); - if (name.isEmpty() || qm_files.empty()) { + if (qm_files.empty()) { return nullptr; } + const auto jsonName = jsonTranslation["name"]; + QString name; + if (jsonName.isString()) { + name = jsonName.toString(); + } else { + QLocale locale(identifier); + name = QString("%1 (%2)") + .arg(locale.nativeLanguageName()) + .arg(locale.nativeCountryName()); + } + return std::make_shared(identifier.toStdString(), name.toStdString(), std::move(qm_files)); }