From 9f6ab286724ddf92ca44fb39b449a3a825fd0c51 Mon Sep 17 00:00:00 2001 From: black-desk Date: Fri, 25 Aug 2023 11:16:01 +0800 Subject: [PATCH] feat: add a warning log for invalid locale --- src/desktopentry.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/desktopentry.cpp b/src/desktopentry.cpp index 199f2cc..35f6e20 100644 --- a/src/desktopentry.cpp +++ b/src/desktopentry.cpp @@ -82,9 +82,15 @@ std::optional> DesktopEntry::processEntryKey(const QStri { QString key; QString localeStr; + // NOTE: + // We are process "localized keys" here, for usage check: + // https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html#localized-keys if (auto index = keyStr.indexOf('['); index != -1) { key = keyStr.sliced(0, index); localeStr = keyStr.sliced(index + 1, keyStr.length() - 1 - index - 1); // strip '[' and ']' + if (!isInvalidLocaleString(localeStr)) { + qWarning().noquote() << QString("invalid LOCALE (%2) for key \"%1\"").arg(key, localeStr); + } } else { key = keyStr; }