KJsonUtils Namespace
Header: | #include <KJsonUtils> |
CMake: | find_package(KF6 REQUIRED COMPONENTS CoreAddons) target_link_libraries(mytarget PRIVATE KF6::CoreAddons) |
Since: | 5.88 |
Functions
(since 5.88) QString | readTranslatedString(const QJsonObject &jo, const QString &key, const QString &defaultValue = QString()) |
Detailed Description
Reads a value from jo but unlike QJsonObject::value() it allows different entries for each locale This is done by appending the locale identifier in brackets to the key (e.g. "[de_DE]" or "[es]") When looking for a key "foo" with German (Germany) locale we will first attempt to read "foo[de_DE]", if that does not exist "foo[de]", finally falling back to "foo" if that also doesn't exist. Returns the translated value for key from jo or defaultValue if key was not found
Function Documentation
[since 5.88]
QString KJsonUtils::readTranslatedString(const QJsonObject &jo, const QString &key, const QString &defaultValue = QString())
Returns the translated value of key from jo as a string or defaultValue if key was not found or the value for key is not of type string
This function was introduced in 5.88.
See also KPluginMetaData::readTranslatedValue(const QJsonObject &jo, const QString &key).