2018-09-29 15:56:04 +03:00
|
|
|
/*
|
2019-12-08 13:51:32 +03:00
|
|
|
* Copyright (C) 2018-2020 QuasarApp.
|
2018-09-29 15:56:04 +03:00
|
|
|
* Distributed under the lgplv3 software license, see the accompanying
|
|
|
|
* Everyone is permitted to copy and distribute verbatim copies
|
|
|
|
* of this license document, but changing it is not allowed.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef LOCALES_H
|
|
|
|
#define LOCALES_H
|
|
|
|
|
|
|
|
#include "quasarapp_global.h"
|
|
|
|
|
2020-05-15 01:43:32 +03:00
|
|
|
#include <QString>
|
|
|
|
|
2018-09-29 15:56:04 +03:00
|
|
|
class QCoreApplication;
|
|
|
|
class QTranslator;
|
|
|
|
|
|
|
|
namespace QuasarAppUtils {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief The Locales class for parese local files
|
|
|
|
*/
|
|
|
|
class QUASARAPPSHARED_EXPORT Locales
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
Locales() = delete;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief initLocale init translation of applictaion
|
2018-12-06 21:30:48 +03:00
|
|
|
* @param prefix - path to folder with qm files. example (/home)
|
2020-05-15 01:43:32 +03:00
|
|
|
* @param locale - string value of locale. example (en) by default empty. @note If use by default this function set sstem language.
|
|
|
|
* @return return true if locale set for application
|
|
|
|
*/
|
|
|
|
static bool setLocale(const QString& prefix , const QString &locale = {});
|
|
|
|
|
|
|
|
private:
|
|
|
|
/**
|
|
|
|
* @brief initLocale
|
|
|
|
* @return true if function finished seccusseful
|
|
|
|
*/
|
|
|
|
static bool initLocale(QTranslator*);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief getTranslator
|
|
|
|
* @return instance of Translation
|
2018-09-29 15:56:04 +03:00
|
|
|
*/
|
2020-05-15 01:43:32 +03:00
|
|
|
static QTranslator* getTranslator();
|
2018-09-29 15:56:04 +03:00
|
|
|
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endif // LOCALES_H
|