@@ -240,18 +240,32 @@ void DesktopFileAMParser::updateActions()
240240 auto actionNames = m_applicationInterface->actionName ();
241241
242242 for (auto action : actions) {
243- auto localeName = actionNames.value (action). value (currentLanguageCode );
243+ auto localeName = getLocaleName (currentLanguageCode, actionNames.value (action));
244244 auto fallbackDefaultName = actionNames.value (action).value (DEFAULT_KEY);
245245 m_actions.append ({action, localeName.isEmpty () ? fallbackDefaultName : localeName});
246246 }
247247}
248248
249+ QString DesktopFileAMParser::getLocaleName (const QString& currentLanguageCode, const QStringMap& names)
250+ {
251+ auto localeName = names.value (currentLanguageCode);
252+ if ( currentLanguageCode.contains (' _' ) && !(names.contains (currentLanguageCode)))
253+ {
254+ auto prefix = currentLanguageCode.split (' _' )[0 ];
255+ if (names.contains (prefix)) {
256+ localeName = names.value (prefix);
257+ }
258+ }
259+ return localeName;
260+ }
261+
249262void DesktopFileAMParser::updateLocalName ()
250263{
251264 QString currentLanguageCode = QLocale::system ().name ();
252265 auto names = m_applicationInterface->name ();
253- auto localeName = names. value (currentLanguageCode);
266+ auto localeName = getLocaleName (currentLanguageCode, names );
254267 auto fallbackName = names.value (DEFAULT_KEY);
268+
255269 m_name = localeName.isEmpty () ? fallbackName : localeName;
256270}
257271
@@ -264,8 +278,9 @@ void DesktopFileAMParser::updateLocalGenericName()
264278{
265279 QString currentLanguageCode = QLocale::system ().name ();
266280 auto genericNames = m_applicationInterface->genericName ();
267- auto localeGenericName = genericNames. value (currentLanguageCode);
281+ auto localeGenericName = getLocaleName (currentLanguageCode, genericNames );
268282 auto fallBackGenericName = genericNames.value (DEFAULT_KEY);
283+
269284 m_genericName = localeGenericName.isEmpty () ? fallBackGenericName : localeGenericName;
270285}
271286
0 commit comments