6#ifndef C_UTILS_LANGSELECT_H
7#define C_UTILS_LANGSELECT_H
9#include <Cutelyst/Plugins/Utils/langselect_export.h>
10#include <Cutelyst/plugin.h>
18class LangSelectPrivate;
407 void setSupportedLocales(
const QVector<QLocale> &locales);
415 void setSupportedLocales(
const QStringList &locales);
421 void addSupportedLocale(
const QLocale &locale);
428 void addSupportedLocale(
const QString &locale);
456 void setLocalesFromDir(
const QString &path,
458 const QString &prefix = QStringLiteral(
"."),
459 const QString &suffix = QStringLiteral(
".qm"));
485 void setLocalesFromDirs(
const QString &path,
const QString &name);
492 [[nodiscard]] QVector<QLocale> supportedLocales()
const;
497 void setQueryKey(
const QString &key);
502 void setSessionKey(
const QString &key);
507 void setCookieName(
const QByteArray &name);
514 void setSubDomainMap(
const QMap<QString, QLocale> &map);
521 void setDomainMap(
const QMap<QString, QLocale> &map);
526 void setFallbackLocale(
const QLocale &fallback);
533 void setDetectFromHeader(
bool enabled);
538 void setLanguageCodeStashKey(
const QString &key = QStringLiteral(
"c_langselect_lang"));
544 void setLanguageDirStashKey(
const QString &key = QStringLiteral(
"c_langselect_dir"));
550 static QVector<QLocale> getSupportedLocales();
572 static bool fromUrlQuery(
Context *c,
const QString &key = QString());
591 static bool fromSession(
Context *c,
const QString &key = QString());
610 static bool fromCookie(
Context *c,
const QByteArray &name = {});
630 const QMap<QString, QLocale> &subDomainMap = QMap<QString, QLocale>());
647 static bool fromDomain(
Context *c,
648 const QMap<QString, QLocale> &domainMap = QMap<QString, QLocale>());
665 static bool fromPath(
Context *c,
const QString &locale);
677 const std::unique_ptr<LangSelectPrivate> d_ptr;
The Cutelyst application.
Detect and select locale based on different input parameters.
Base class for Cutelyst Plugins.
Plugin providing methods for session management.
The Cutelyst namespace holds all public Cutelyst API.