diff --git a/RingWinClient.pro b/RingWinClient.pro index 4df771b512b1cefccc627e4ef9f0ee485ce854a6..c9fa80f546cfa837a86924cea33322c11885db5f 100644 --- a/RingWinClient.pro +++ b/RingWinClient.pro @@ -25,6 +25,10 @@ contains(BUILD, Debug) { CONFIG += console } +isEmpty(QMAKE_LRELEASE) { + QMAKE_LRELEASE = lrelease +} + SOURCES += main.cpp\ mainwindow.cpp \ callwidget.cpp \ @@ -101,6 +105,26 @@ RESOURCES += \ RC_FILE = ico.rc +TRANSLATIONS = + +maketranslationdir.target = customtarget +maketranslationdir.commands = $(MKDIR) $$OUT_PWD/share/ring/translations/ + +updateqm.input = TRANSLATIONS +updateqm.output = $$OUT_PWD/release/share/ring/translations/${QMAKE_FILE_BASE}.qm +updateqm.commands = $$QMAKE_LRELEASE ${QMAKE_FILE_IN} -qm $$OUT_PWD/release/share/ring/translations/${QMAKE_FILE_BASE}.qm +updateqm.CONFIG += no_link + +QMAKE_EXTRA_TARGETS += maketranslationdir +QMAKE_EXTRA_COMPILERS += updateqm + +PRE_TARGETDEPS += customtarget compiler_updateqm_make_all + +QM_FILES.files = share +QM_FILES.path = $$OUT_PWD/release + +INSTALLS += QM_FILES + DISTFILES += \ License.rtf \ ringtones/konga.ul \ @@ -122,6 +146,9 @@ win32 { RUNTIME.files = $${RING}/bin/libring.dll $${RING}/bin/libringclient.dll RUNTIME.path = $$OUT_PWD/release + LRC_TRANSLATION.files = $${RING}/share/libringclient/translations + LRC_TRANSLATION.path = $$OUT_PWD/release/share/libringclient/ + QTRUNTIME.files = $$RUNTIMEDIR/Qt5Core.dll $$RUNTIMEDIR/Qt5Widgets.dll \ $$RUNTIMEDIR/Qt5Gui.dll $$RUNTIMEDIR/Qt5Svg.dll \ $$RUNTIMEDIR/Qt5Xml.dll @@ -145,6 +172,6 @@ win32 { $$RUNTIMEDIR/libwinpthread-1.dll LIBSTD.path = $$OUT_PWD/release - INSTALLS += RINGTONES PACKAGING LICENSE RUNTIME QTRUNTIME QTDEPSRUNTIME \ + INSTALLS += RINGTONES PACKAGING LICENSE RUNTIME LRC_TRANSLATION QTRUNTIME QTDEPSRUNTIME \ QTPLUGINIMAGE QTPLATFORMS LIBSTD } diff --git a/aboutdialog.cpp b/aboutdialog.cpp index 4551181bd4ef32e07852a3e3f773b17ef95965b8..f5be38ee0250a923c0febc2398fc0353e4116ce9 100644 --- a/aboutdialog.cpp +++ b/aboutdialog.cpp @@ -31,10 +31,9 @@ AboutDialog::AboutDialog(QWidget *parent) : this->setFixedSize(this->width(),this->height()); ui->creditsWidget->hide(); ui->clientVersionLabel->setText( - QString("

Windows Ring v") - + VERSION - + "

"); - ui->gitVersionLabel->setText(QString("version: ") + GIT_VERSION); + QString("

" + "%1 v%2

").arg(tr("Windows Ring"), VERSION)); + ui->gitVersionLabel->setText(QString("%1: %2").arg(tr("version"), GIT_VERSION)); } AboutDialog::~AboutDialog() diff --git a/aboutdialog.ui b/aboutdialog.ui index c0f6a3e5837834ce713799f2c9a9500d9c82d078..116f605878324985bb40a02c46919df367fc5900 100644 --- a/aboutdialog.ui +++ b/aboutdialog.ui @@ -7,7 +7,7 @@ 0 0 674 - 534 + 565 diff --git a/accountdetails.cpp b/accountdetails.cpp index a9873f32d99bbb350f1c3f14f84880d64ba46940..b4c1afe25f40c1cc3c11dadfbfa9df98f1695a2b 100644 --- a/accountdetails.cpp +++ b/accountdetails.cpp @@ -40,14 +40,14 @@ AccountDetails::AccountDetails(QWidget *parent) : setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); ui->audioCodecView->setColumnCount(4); - QStringList audioHeader {"Enabled", "Name", "Bitrate", "Samplerate"}; + QStringList audioHeader {tr("Enabled"), tr("Name"), tr("Bitrate"), tr("Samplerate")}; ui->audioCodecView->setHorizontalHeaderLabels(audioHeader); ui->audioCodecView->verticalHeader()->hide(); ui->audioCodecView->setSelectionBehavior(QAbstractItemView::SelectRows); ui->audioCodecView->setShowGrid(false); ui->videoCodecView->setColumnCount(3); - QStringList videoHeader {"Enabled", "Name", "Bitrate"}; + QStringList videoHeader {tr("Enabled"), tr("Name"), tr("Bitrate")}; ui->videoCodecView->setHorizontalHeaderLabels(videoHeader); ui->videoCodecView->verticalHeader()->hide(); ui->videoCodecView->setSelectionBehavior(QAbstractItemView::SelectRows); diff --git a/callwidget.cpp b/callwidget.cpp index 705e2e71b7fe923f6800c2db75fc2c7e58370260..3293b7efef9ca5a26096ee0f84d675a0c6706152 100644 --- a/callwidget.cpp +++ b/callwidget.cpp @@ -120,13 +120,13 @@ CallWidget::CallWidget(QWidget *parent) : ContactMethod* contactMethod = ui->historyList->currentIndex() .data(static_cast(Call::Role::ContactMethod)).value(); - auto copyAction = new QAction("Copy number", this); + auto copyAction = new QAction(tr("Copy number"), this); menu.addAction(copyAction); connect(copyAction, &QAction::triggered, [=]() { QApplication::clipboard()->setText(contactMethod->uri()); }); if (not contactMethod->contact() || contactMethod->contact()->isPlaceHolder()) { - auto addExisting = new QAction("Add to contact", this); + auto addExisting = new QAction(tr("Add to contact"), this); menu.addAction(addExisting); connect(addExisting, &QAction::triggered, [=]() { ContactPicker contactPicker(contactMethod); @@ -171,13 +171,13 @@ CallWidget::findRingAccount(QModelIndex idx1, QModelIndex idx2, QVector vec if ((Account::Protocol)protocol.toUInt() == Account::Protocol::RING) { auto username = idx.data(static_cast(Account::Role::Username)); ui->ringIdLabel->setText( - "Your Ring ID: " + username.toString()); + QString("%1: %2").arg(tr("Your RingID"), username.toString())); found = true; return; } } if (not found){ - ui->ringIdLabel->setText("NO RING ACCOUNT FOUND"); + ui->ringIdLabel->setText(tr("NO RING ACCOUNT FOUND")); } } @@ -241,7 +241,7 @@ CallWidget::findRingAccount() account->displayName() = account->alias(); auto username = account->username(); ui->ringIdLabel->setText( - "Your Ring ID: " + username); + QString("%1: %2").arg(tr("Your RingID"), username)); found = true; return; } @@ -257,7 +257,7 @@ void CallWidget::callIncoming(Call *call) { if (!call->account()->isAutoAnswer()) { - ui->callLabel->setText("Call from " + call->formattedName()); + ui->callLabel->setText(QString("%1 %2").arg(tr("Call from"), call->formattedName())); ui->callInvite->setVisible(true); ui->callInvite->raise(); } @@ -315,7 +315,8 @@ CallWidget::callStateChanged(Call* call, Call::State previousState) displaySpinner(false); ui->videoWidget->show(); } - ui->callStateLabel->setText("Call State : " + call->toHumanStateName()); + ui->callStateLabel->setText(QString("%1: %2") + .arg(tr("Call State"), call->toHumanStateName())); } void diff --git a/configurationwidget.cpp b/configurationwidget.cpp index b7162dfb6d160156d8a9a1ebcfb34b65ea4f0ec6..ad5eed9366cb2d8f70f0f9098dd463a08b885117 100644 --- a/configurationwidget.cpp +++ b/configurationwidget.cpp @@ -168,7 +168,7 @@ ConfigurationWidget::on_deleteAccountButton_clicked() void ConfigurationWidget::on_addAccountButton_clicked() { - auto account = accountModel_->add("New Account", + auto account = accountModel_->add(tr("New Account"), ui->accountTypeBox->model()->index( ui->accountTypeBox->currentIndex(), 0)); account->setRingtonePath(Utils::GetRingtonePath()); @@ -199,7 +199,7 @@ ConfigurationWidget::on_clearHistoryButton_clicked() { QMessageBox confirmationDialog; - confirmationDialog.setText("Are you sure you want to clear all your history?"); + confirmationDialog.setText(tr("Are you sure you want to clear all your history?")); confirmationDialog.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel); auto ret = confirmationDialog.exec(); diff --git a/contactdelegate.cpp b/contactdelegate.cpp index c8f05651ea4048528f403f6d3e7cfb653698cd61..009d1026dbd5bff941f5f95d150c177aae508fee 100644 --- a/contactdelegate.cpp +++ b/contactdelegate.cpp @@ -86,7 +86,7 @@ ContactDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, painter->drawText(QRect(rect.left()+sizeImage_+5, rect.top() + rect.height()/2, rect.width(), rect.height()/2), - opt.displayAlignment, ""); + opt.displayAlignment, tr("")); break; } } diff --git a/instantmessagingwidget.cpp b/instantmessagingwidget.cpp index 7cf1893102f38d198b1756677ed6fc21cbaabc52..f64c6623f05090c1245d1aaf12a3046db80b55ed 100644 --- a/instantmessagingwidget.cpp +++ b/instantmessagingwidget.cpp @@ -39,15 +39,15 @@ InstantMessagingWidget::InstantMessagingWidget(QWidget *parent) : imDelegate_ = new ImDelegate(); ui->messageOutput->setItemDelegate(imDelegate_); ui->messageOutput->setContextMenuPolicy(Qt::ActionsContextMenu); - auto copyAction = new QAction("Copy", this); + auto copyAction = new QAction(tr("Copy"), this); ui->messageOutput->addAction(copyAction); connect(copyAction, &QAction::triggered, [=]() { copyToClipboard(); }); - auto displayDate = new QAction("Display date", this); + auto displayDate = new QAction(tr("Display date"), this); displayDate->setCheckable(true); ui->messageOutput->addAction(displayDate); - auto displayAuthor = new QAction("Display author", this); + auto displayAuthor = new QAction(tr("Display author"), this); displayAuthor->setCheckable(true); ui->messageOutput->addAction(displayAuthor); auto lamdba = [=](){ diff --git a/main.cpp b/main.cpp index 2da8d3bc28381a05eb7d315ae8d460fd0356741f..590f6f08bf78d3a791c7c0ff8d313cdb7a9d1725 100644 --- a/main.cpp +++ b/main.cpp @@ -28,6 +28,8 @@ #include #include +#include +#include #ifdef Q_OS_WIN32 #include @@ -66,6 +68,19 @@ main(int argc, char *argv[]) Console(); } + QTranslator qtTranslator; + qtTranslator.load("qt_" + QLocale::system().name(), + QLibraryInfo::location(QLibraryInfo::TranslationsPath)); + a.installTranslator(&qtTranslator); + + QTranslator lrcTranslator; + lrcTranslator.load("share/libringclient/translations/lrc_" + QLocale::system().name()); + a.installTranslator(&lrcTranslator); + + QTranslator mainTranslator; + mainTranslator.load("share/ring/translations/ring_client_windows_" + QLocale::system().name()); + a.installTranslator(&mainTranslator); + QFont font; font.setFamily("Segoe UI"); a.setFont(font); diff --git a/mainbar.cpp b/mainbar.cpp index 46351d8e81bf671e56ab7858c53a0de63e1a0ab5..45f497386c67d9d9bca408b6860d96bf43c093eb 100644 --- a/mainbar.cpp +++ b/mainbar.cpp @@ -29,11 +29,11 @@ MainBar::MainBar(QWidget *parent) : { ui->setupUi(this); - auto aboutAction = new QAction("About", this); + auto aboutAction = new QAction(tr("About"), this); menu_->addAction(aboutAction); connect(aboutAction, SIGNAL(triggered()), this, SLOT(showAboutDialog())); - auto exitAction = new QAction("Exit", this); + auto exitAction = new QAction(tr("Exit"), this); menu_->addAction(exitAction); connect(exitAction, SIGNAL(triggered()), this, SLOT(on_exitButton_clicked())); diff --git a/ring.nsi b/ring.nsi index 9be84c2d137a6e757f0780f4c8b5caefa855bb1f..4f2c35bbbfaea4f16c7cde38c55395c72fd06845 100644 --- a/ring.nsi +++ b/ring.nsi @@ -70,6 +70,10 @@ section "install" file imageformats/* setOutPath $INSTDIR\ringtones file ringtones/* + setOutPath $INSTDIR\share\ring\translations + file share/ring/translations/* + setOutPath $INSTDIR\share\libringclient\translations + file share/libringclient/translations/* # Uninstaller - See function un.onInit and section "uninstall" for configuration writeUninstaller "$INSTDIR\uninstall.exe" @@ -129,6 +133,7 @@ section "uninstall" rmDir /r $INSTDIR\platforms rmDir /r $INSTDIR\imageformats rmDir /r $INSTDIR\ringtones + rmDir /r $INSTDIR\share # Always delete uninstaller as the last action delete $INSTDIR\uninstall.exe diff --git a/videooverlay.cpp b/videooverlay.cpp index c3bcc79a0d9f1f8f449a0f3c71e113b847810864..3ab2f80c80eecfb8a74bbe783c9acc9d45436ae9 100644 --- a/videooverlay.cpp +++ b/videooverlay.cpp @@ -33,14 +33,14 @@ VideoOverlay::VideoOverlay(QWidget *parent) : setAttribute(Qt::WA_NoSystemBackground); menu_ = new QMenu(this); - auto muteAudio = new QAction("Mute Audio", this); + auto muteAudio = new QAction(tr("Mute Audio"), this); muteAudio->setCheckable(true); connect(muteAudio, &QAction::triggered, [=](bool) { actionModel_->execute(UserActionModel::Action::MUTE_AUDIO); }); menu_->addAction(muteAudio); - auto muteVideo = new QAction("Mute Video", this); + auto muteVideo = new QAction(tr("Mute Video"), this); muteVideo->setCheckable(true); connect(muteVideo, &QAction::triggered, [=](bool) { actionModel_->execute(UserActionModel::Action::MUTE_VIDEO); diff --git a/videoview.cpp b/videoview.cpp index c9075309920e60aa459a1b61205451a6e7ae2227..c43b99593edc7a7cc50c1f968eb0cf695d0cc1ec 100644 --- a/videoview.cpp +++ b/videoview.cpp @@ -181,18 +181,18 @@ VideoView::showContextMenu(const QPoint& pos) menu.addSeparator(); - auto shareAction = new QAction("Share entire screen", this); + auto shareAction = new QAction(tr("Share entire screen"), this); menu.addAction(shareAction); connect(shareAction, &QAction::triggered, [=]() { Video::SourceModel::instance()->setDisplay(0, QApplication::desktop()->rect()); }); - auto shareAreaAction = new QAction("Share screen area", this); + auto shareAreaAction = new QAction(tr("Share screen area"), this); menu.addAction(shareAreaAction); connect(shareAreaAction, &QAction::triggered, [=]() { SelectAreaDialog selec; selec.exec(); }); - auto shareFileAction = new QAction("Share file", this); + auto shareFileAction = new QAction(tr("Share file"), this); menu.addAction(shareFileAction); connect(shareFileAction, &QAction::triggered, [=]() { QFileDialog dialog(this); diff --git a/wizarddialog.cpp b/wizarddialog.cpp index 5f73ef65b90983aae1e63d8b4a23ed875f6c2df6..28f1fd3c1cffeddd05b996e1f8aebdd2f7942765 100644 --- a/wizarddialog.cpp +++ b/wizarddialog.cpp @@ -58,7 +58,7 @@ void WizardDialog::accept() { //ui->spinnerLabel->show(); - ui->label->setText("Please wait while we create your account."); + ui->label->setText(tr("Please wait while we create your account.")); ui->buttonBox->setEnabled(false); ui->usernameEdit->setEnabled(false);