Pages
API Documentation
On this page

KJsonUtils Namespace

Additions to Qt Core. More...

  • Header: #include <KJsonUtils>
  • CMake: find_package(KF6 REQUIRED COMPONENTS CoreAddons)
    target_link_libraries(mytarget PRIVATE KF6::CoreAddons)

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

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

We use cookies to personalize content and to analyze our traffic. Please decide if you are willing to accept cookies from our website.