File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -308,16 +308,26 @@ TranslationExtension::parseTranslation(std::filesystem::path const& extensionFol
308308 const QString& identifier,
309309 const QJsonObject& jsonTranslation)
310310{
311- const auto name = jsonTranslation[" name" ].toString ();
312311 const auto jsonGlobFiles = jsonTranslation[" files" ].toVariant ().toStringList ();
313312
314313 std::vector<std::filesystem::path> qm_files =
315314 globExtensionFiles (extensionFolder, jsonGlobFiles);
316315
317- if (name. isEmpty () || qm_files.empty ()) {
316+ if (qm_files.empty ()) {
318317 return nullptr ;
319318 }
320319
320+ const auto jsonName = jsonTranslation[" name" ];
321+ QString name;
322+ if (jsonName.isString ()) {
323+ name = jsonName.toString ();
324+ } else {
325+ QLocale locale (identifier);
326+ name = QString (" %1 (%2)" )
327+ .arg (locale.nativeLanguageName ())
328+ .arg (locale.nativeCountryName ());
329+ }
330+
321331 return std::make_shared<Translation>(identifier.toStdString (), name.toStdString (),
322332 std::move (qm_files));
323333}
You can’t perform that action at this time.
0 commit comments