mirror of
https://github.com/QuasarApp/QuasarAppLib.git
synced 2025-04-30 19:54:43 +00:00
fix load translations on android and ios dvices
This commit is contained in:
parent
11947d4cde
commit
071a01a2d6
13
locales.cpp
13
locales.cpp
@ -21,10 +21,21 @@ using namespace QuasarAppUtils;
|
||||
bool QuasarAppUtils::Locales::findQm(const QString& localePrefix,
|
||||
QFileInfoList &qmFiles) {
|
||||
|
||||
if (localePrefix.isEmpty())
|
||||
return false;
|
||||
|
||||
qDebug() << "Search for " << localePrefix;
|
||||
|
||||
const auto prefixes = localePrefix.split(QRegExp("[_-]"));
|
||||
|
||||
auto prefixIt = prefixes.begin();
|
||||
|
||||
for (const auto &location: qAsConst(_locations)) {
|
||||
qmFiles += QDir(location).entryInfoList({"*" + localePrefix + "*.qm"}, QDir::Files);
|
||||
qmFiles += QDir(location).entryInfoList({"*" + (*prefixIt).toLower() + "*.qm"}, QDir::Files);
|
||||
}
|
||||
|
||||
qDebug() << "Found" << qmFiles;
|
||||
|
||||
return qmFiles.size();
|
||||
}
|
||||
|
||||
|
@ -33,6 +33,8 @@ namespace QuasarAppUtils {
|
||||
* @code{cpp}
|
||||
* QuasarAppUtils::Locales::init(QLocale::system(), "myPath");
|
||||
* @endcode
|
||||
*
|
||||
* @note All translations qm files should be named with lower case example : en.qm
|
||||
*/
|
||||
class QUASARAPPSHARED_EXPORT Locales : public QObject
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user