| 88 | } |
| 89 | |
| 90 | static QString readLocalized(const QLocale &locale, const QJsonObject &obj, const QString &baseKey) |
| 91 | { |
| 92 | const QString qtcLanguage = qApp->property("qtc_locale").toString(); |
| 93 | QStringList names = locale.uiLanguages(); |
| 94 | if (!qtcLanguage.isEmpty()) |
| 95 | names.prepend(qtcLanguage); |
| 96 | |
| 97 | for (auto name : std::as_const(names)) { |
| 98 | const QLocale uiLocale(name); |
| 99 | |
| 100 | // We are natively English, skip... |
| 101 | if (uiLocale.language() == QLocale::English || uiLocale.language() == QLocale::C) { |
| 102 | return obj.value(baseKey).toString(); |
| 103 | } |
| 104 | |
| 105 | // Check against name |
| 106 | QString key = baseKey + '[' + name + ']'; |
| 107 | auto it = obj.find(key); |
| 108 | |
| 109 | // Check against language |
| 110 | if (it == obj.end()) { |
| 111 | name.replace('-', '_'); |
| 112 | name = name.section(QLatin1Char('_'), 0, -2); |
| 113 | if (!name.isEmpty()) { |
| 114 | key = baseKey + '[' + name + ']'; |
| 115 | it = obj.find(key); |
| 116 | } |
| 117 | } |
| 118 | |
| 119 | if (it != obj.end()) |
| 120 | return it.value().toString(); |
| 121 | } |
| 122 | |
| 123 | return obj.value(baseKey).toString(); |
| 124 | } |
| 125 | |
| 126 | bool PluginInfo::isStatic() const |
| 127 | { |
no test coverage detected