6#ifndef C_UTILS_LANGSELECT_H
7#define C_UTILS_LANGSELECT_H
9#include <Cutelyst/cutelyst_global.h>
10#include <Cutelyst/plugin.h>
38class LangSelectPrivate;
428 void setSupportedLocales(
const QVector<QLocale> &locales);
436 void setSupportedLocales(
const QStringList &locales);
442 void addSupportedLocale(
const QLocale &locale);
449 void addSupportedLocale(
const QString &locale);
477 void setLocalesFromDir(
const QString &path,
479 const QString &prefix = QStringLiteral(
"."),
480 const QString &suffix = QStringLiteral(
".qm"));
506 void setLocalesFromDirs(
const QString &path,
const QString &name);
513 [[nodiscard]] QVector<QLocale> supportedLocales()
const;
518 void setQueryKey(
const QString &key);
523 void setSessionKey(
const QString &key);
528 void setCookieName(
const QByteArray &name);
535 void setSubDomainMap(
const QMap<QString, QLocale> &map);
542 void setDomainMap(
const QMap<QString, QLocale> &map);
547 void setFallbackLocale(
const QLocale &fallback);
554 void setDetectFromHeader(
bool enabled);
559 void setLanguageCodeStashKey(
const QString &key = QStringLiteral(
"c_langselect_lang"));
565 void setLanguageDirStashKey(
const QString &key = QStringLiteral(
"c_langselect_dir"));
571 static QVector<QLocale> getSupportedLocales();
593 static bool fromUrlQuery(
Context *c,
const QString &key = QString());
612 static bool fromSession(
Context *c,
const QString &key = QString());
631 static bool fromCookie(
Context *c,
const QByteArray &name = {});
651 const QMap<QString, QLocale> &subDomainMap = QMap<QString, QLocale>());
668 static bool fromDomain(
Context *c,
669 const QMap<QString, QLocale> &domainMap = QMap<QString, QLocale>());
686 static bool fromPath(
Context *c,
const QString &locale);
698 const std::unique_ptr<LangSelectPrivate> d_ptr;
The Cutelyst Application.
Language selection plugin.
The Cutelyst namespace holds all public Cutelyst API.