feat: add a warning log for invalid locale
This commit is contained in:
parent
58eff3b927
commit
9f6ab28672
@ -82,9 +82,15 @@ std::optional<QPair<QString, QString>> DesktopEntry::processEntryKey(const QStri
|
|||||||
{
|
{
|
||||||
QString key;
|
QString key;
|
||||||
QString localeStr;
|
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) {
|
if (auto index = keyStr.indexOf('['); index != -1) {
|
||||||
key = keyStr.sliced(0, index);
|
key = keyStr.sliced(0, index);
|
||||||
localeStr = keyStr.sliced(index + 1, keyStr.length() - 1 - index - 1); // strip '[' and ']'
|
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 {
|
} else {
|
||||||
key = keyStr;
|
key = keyStr;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user