Skip to content
  • 0 Votes
    4 Posts
    527 Views
    T

    I found the error. From docs here: https://doc.qt.io/qt-6/qdatetime.html#toString it is reported

    Note: Day and month names as well as AM/PM indication are given in English (C locale). If localized month and day names and localized forms of AM/PM are used, use QLocale::system().toDateTime().

    Correct way to use system locale or a desired locale is

    qInfo().nospace() << QLocale::system().toString(QDateTime::currentDateTime(), "dd MMMM yyyy hh:mm:ss.zzz");
  • 0 Votes
    8 Posts
    657 Views
    SiO2S

    It is worse in fact

    QFontDatabase::styleString(const QFontInfo &fontInfo) //"Normal"

    mismatch

    QStringList QFontDatabase::styles(const QString &family) //"Обычный", "Полужирный"

    so this class essentially breaks its own logic. Also default font keeps those localized stylestring even after me giving up localization via

    QLocale::setDefault(QLocale::English);

    std::map<QString, QStringList> stylesPack

  • 0 Votes
    5 Posts
    2k Views
    JoseCastroJ

    I eventually found out that those changes mentioned in the links in the last post require you to set "QT_IM_MODULE=compose" but even then composing didn't work.

    That being the case, I've reported a bug: https://bugreports.qt.io/browse/QTBUG-79097

    I'm keeping this as unanswered until there is a workaround or a fix, but if you do not need dead keys or composition, just setting the XKB_DEFAULT vars and ensuring you are using libinput/xkbcommon should be enough to get your keyboard layout "working".

  • 0 Votes
    3 Posts
    1k Views
    D

    Hello SGaist,

    Thanks for your response. I expect for Serbian (Cyrillic, Serbia) to get:

    2 (QLocale::Script::CyrillicScript) from QLocale::system().script(), and "sr-Cyrl-RS" from QLocale::system().bcp47Name().

    Similarly, for Serbian (Latin, Serbia) I expect:

    7 (QLocale::Script::LatinScript) from QLocale::system().script(), and "sr-Latn-RS" from QLocale::system().bcp47Name().

    Should I open new bugs for script() and bcp47Name()?

    This is the workaround I made for bcp47Name:

    QString bcp47Name; #ifdef Q_OS_WIN wchar_t buffer[LOCALE_NAME_MAX_LENGTH]; ::GetUserDefaultLocaleName(buffer, LOCALE_NAME_MAX_LENGTH); bcp47Name = QString::fromWCharArray(buffer); #else bcp47Name = QLocale::system().bcp47Name(); #endif

    But didn't have a chance to try it on non-Windows platforms yet.

    Thanks!