@@ -240,17 +240,41 @@ void DesktopFileAMParser::updateActions()
240240 auto actionNames = m_applicationInterface->actionName ();
241241
242242 for (auto action : actions) {
243+ <<<<<<< HEAD
243244 auto localeName = actionNames.value (action).value (currentLanguageCode);
245+ =======
246+ auto localeName = getLocaleName (currentLanguageCode, actionNames.value (action));
247+ >>>>>>> 69273dc (fix: Change the translation language of the application in dock #1100 )
244248 auto fallbackDefaultName = actionNames.value (action).value (DEFAULT_KEY);
245249 m_actions.append ({action, localeName.isEmpty () ? fallbackDefaultName : localeName});
246250 }
247251}
248252
253+ <<<<<<< HEAD
254+ =======
255+ QString DesktopFileAMParser::getLocaleName (const QString& currentLanguageCode, const QStringMap& names)
256+ {
257+ auto localeName = names.value (currentLanguageCode);
258+ if ( currentLanguageCode.contains (' _' ) && !(names.contains (currentLanguageCode))) {
259+ {
260+ auto prefix = currentLanguageCode.split (' _' )[0 ];
261+ if (names.contains (prefix)) {
262+ localeName = names.value (prefix);
263+ }
264+ }
265+ return localeName;
266+ }
267+
268+ >>>>>>> 69273dc (fix: Change the translation language of the application in dock #1100 )
249269void DesktopFileAMParser::updateLocalName ()
250270{
251271 QString currentLanguageCode = QLocale::system ().name ();
252272 auto names = m_applicationInterface->name ();
273+ <<<<<<< HEAD
253274 auto localeName = names.value (currentLanguageCode);
275+ =======
276+ auto localeName = getLocaleName (currentLanguageCode, names);
277+ >>>>>>> 69273dc (fix: Change the translation language of the application in dock #1100 )
254278 auto fallbackName = names.value (DEFAULT_KEY);
255279 m_name = localeName.isEmpty () ? fallbackName : localeName;
256280}
@@ -264,7 +288,11 @@ void DesktopFileAMParser::updateLocalGenericName()
264288{
265289 QString currentLanguageCode = QLocale::system ().name ();
266290 auto genericNames = m_applicationInterface->genericName ();
291+ <<<<<<< HEAD
267292 auto localeGenericName = genericNames.value (currentLanguageCode);
293+ =======
294+ auto localeGenericName = getLocaleName (currentLanguageCode, genericNames);
295+ >>>>>>> 69273dc (fix: Change the translation language of the application in dock #1100 )
268296 auto fallBackGenericName = genericNames.value (DEFAULT_KEY);
269297 m_genericName = localeGenericName.isEmpty () ? fallBackGenericName : localeGenericName;
270298}
0 commit comments