Skip to content

Commit

Permalink
Use uiLanguages preferences (#84)
Browse files Browse the repository at this point in the history
IB-7564

Signed-off-by: Raul Metsma <[email protected]>
  • Loading branch information
metsma authored Jun 25, 2023
1 parent 89efee9 commit 00d27dd
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
version: 6.5.0
version: 6.5.1
arch: win64_msvc2019_64
modules: qt5compat
- name: Setup dev env
Expand All @@ -60,8 +60,8 @@ jobs:
arch: x64
- name: Build
run: |
cmake "-GNinja" -S . -B build `
-DCMAKE_TOOLCHAIN_FILE=${{ env.VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake
cmake -S . -B build `
-DCMAKE_TOOLCHAIN_FILE=${{ env.RUNVCPKG_VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake
cmake --build build --target installer
- name: Archive artifacts
uses: actions/upload-artifact@v3
Expand Down
9 changes: 8 additions & 1 deletion Application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,14 @@ Application::Application( int &argc, char **argv )
QTranslator *qt = new QTranslator( this );
QTranslator *common = new QTranslator( this );
QTranslator *t = new QTranslator( this );
QString lang = Common::language();
QString lang;
auto languages = QLocale().uiLanguages().first();
if(languages.contains(QLatin1String("et"), Qt::CaseInsensitive))
lang = QStringLiteral("et");
else if(languages.contains(QLatin1String("ru"), Qt::CaseInsensitive))
lang = QStringLiteral("ru");
else
lang = QStringLiteral("en");
void(qt->load(QStringLiteral(":/qtbase_%1.qm").arg(lang)));
void(common->load(QStringLiteral(":/common_%1.qm").arg(lang)));
void(t->load(QStringLiteral(":/idupdater_%1.qm").arg(lang)));
Expand Down
4 changes: 2 additions & 2 deletions idupdater.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ idupdater::idupdater( QObject *parent )
, conf(new Configuration(this))
{
QString userAgent = QStringLiteral("%1/%2 (%3) Lang: %4 Devices: %5")
.arg(qApp->applicationName(), qApp->applicationVersion(), Common::applicationOs(),
Common::language(), QPCSC::instance().drivers().join('/'));
.arg(QApplication::applicationName(), QApplication::applicationVersion(), Common::applicationOs(),
QLocale().uiLanguages().first(), QPCSC::instance().drivers().join('/'));
qDebug() << "User-Agent:" << userAgent;
request.setRawHeader( "User-Agent", userAgent.toUtf8() );
connect(conf, &Configuration::finished, this, &idupdater::finished);
Expand Down

0 comments on commit 00d27dd

Please sign in to comment.