Commit 53ac6e5a authored by Edric Milaret's avatar Edric Milaret

i18n: make the win client translation ready

Issue: #80359
Change-Id: I87f674050c1345dd75699505b5ea57a4de5a4961
parent c9d3e413
...@@ -25,6 +25,10 @@ contains(BUILD, Debug) { ...@@ -25,6 +25,10 @@ contains(BUILD, Debug) {
CONFIG += console CONFIG += console
} }
isEmpty(QMAKE_LRELEASE) {
QMAKE_LRELEASE = lrelease
}
SOURCES += main.cpp\ SOURCES += main.cpp\
mainwindow.cpp \ mainwindow.cpp \
callwidget.cpp \ callwidget.cpp \
...@@ -101,6 +105,26 @@ RESOURCES += \ ...@@ -101,6 +105,26 @@ RESOURCES += \
RC_FILE = ico.rc 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 += \ DISTFILES += \
License.rtf \ License.rtf \
ringtones/konga.ul \ ringtones/konga.ul \
...@@ -122,6 +146,9 @@ win32 { ...@@ -122,6 +146,9 @@ win32 {
RUNTIME.files = $${RING}/bin/libring.dll $${RING}/bin/libringclient.dll RUNTIME.files = $${RING}/bin/libring.dll $${RING}/bin/libringclient.dll
RUNTIME.path = $$OUT_PWD/release 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 \ QTRUNTIME.files = $$RUNTIMEDIR/Qt5Core.dll $$RUNTIMEDIR/Qt5Widgets.dll \
$$RUNTIMEDIR/Qt5Gui.dll $$RUNTIMEDIR/Qt5Svg.dll \ $$RUNTIMEDIR/Qt5Gui.dll $$RUNTIMEDIR/Qt5Svg.dll \
$$RUNTIMEDIR/Qt5Xml.dll $$RUNTIMEDIR/Qt5Xml.dll
...@@ -145,6 +172,6 @@ win32 { ...@@ -145,6 +172,6 @@ win32 {
$$RUNTIMEDIR/libwinpthread-1.dll $$RUNTIMEDIR/libwinpthread-1.dll
LIBSTD.path = $$OUT_PWD/release LIBSTD.path = $$OUT_PWD/release
INSTALLS += RINGTONES PACKAGING LICENSE RUNTIME QTRUNTIME QTDEPSRUNTIME \ INSTALLS += RINGTONES PACKAGING LICENSE RUNTIME LRC_TRANSLATION QTRUNTIME QTDEPSRUNTIME \
QTPLUGINIMAGE QTPLATFORMS LIBSTD QTPLUGINIMAGE QTPLATFORMS LIBSTD
} }
...@@ -31,10 +31,9 @@ AboutDialog::AboutDialog(QWidget *parent) : ...@@ -31,10 +31,9 @@ AboutDialog::AboutDialog(QWidget *parent) :
this->setFixedSize(this->width(),this->height()); this->setFixedSize(this->width(),this->height());
ui->creditsWidget->hide(); ui->creditsWidget->hide();
ui->clientVersionLabel->setText( ui->clientVersionLabel->setText(
QString("<html><head/><body><p><span style=\" font-weight:600;\">Windows Ring v") QString("<html><head/><body><p><span style=\" font-weight:600;\">"
+ VERSION "%1 v%2</span></p></body></html>").arg(tr("Windows Ring"), VERSION));
+ "</span></p></body></html>"); ui->gitVersionLabel->setText(QString("%1: %2").arg(tr("version"), GIT_VERSION));
ui->gitVersionLabel->setText(QString("version: ") + GIT_VERSION);
} }
AboutDialog::~AboutDialog() AboutDialog::~AboutDialog()
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>674</width> <width>674</width>
<height>534</height> <height>565</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
......
...@@ -40,14 +40,14 @@ AccountDetails::AccountDetails(QWidget *parent) : ...@@ -40,14 +40,14 @@ AccountDetails::AccountDetails(QWidget *parent) :
setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
ui->audioCodecView->setColumnCount(4); 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->setHorizontalHeaderLabels(audioHeader);
ui->audioCodecView->verticalHeader()->hide(); ui->audioCodecView->verticalHeader()->hide();
ui->audioCodecView->setSelectionBehavior(QAbstractItemView::SelectRows); ui->audioCodecView->setSelectionBehavior(QAbstractItemView::SelectRows);
ui->audioCodecView->setShowGrid(false); ui->audioCodecView->setShowGrid(false);
ui->videoCodecView->setColumnCount(3); ui->videoCodecView->setColumnCount(3);
QStringList videoHeader {"Enabled", "Name", "Bitrate"}; QStringList videoHeader {tr("Enabled"), tr("Name"), tr("Bitrate")};
ui->videoCodecView->setHorizontalHeaderLabels(videoHeader); ui->videoCodecView->setHorizontalHeaderLabels(videoHeader);
ui->videoCodecView->verticalHeader()->hide(); ui->videoCodecView->verticalHeader()->hide();
ui->videoCodecView->setSelectionBehavior(QAbstractItemView::SelectRows); ui->videoCodecView->setSelectionBehavior(QAbstractItemView::SelectRows);
......
...@@ -120,13 +120,13 @@ CallWidget::CallWidget(QWidget *parent) : ...@@ -120,13 +120,13 @@ CallWidget::CallWidget(QWidget *parent) :
ContactMethod* contactMethod = ui->historyList->currentIndex() ContactMethod* contactMethod = ui->historyList->currentIndex()
.data(static_cast<int>(Call::Role::ContactMethod)).value<ContactMethod*>(); .data(static_cast<int>(Call::Role::ContactMethod)).value<ContactMethod*>();
auto copyAction = new QAction("Copy number", this); auto copyAction = new QAction(tr("Copy number"), this);
menu.addAction(copyAction); menu.addAction(copyAction);
connect(copyAction, &QAction::triggered, [=]() { connect(copyAction, &QAction::triggered, [=]() {
QApplication::clipboard()->setText(contactMethod->uri()); QApplication::clipboard()->setText(contactMethod->uri());
}); });
if (not contactMethod->contact() || contactMethod->contact()->isPlaceHolder()) { 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); menu.addAction(addExisting);
connect(addExisting, &QAction::triggered, [=]() { connect(addExisting, &QAction::triggered, [=]() {
ContactPicker contactPicker(contactMethod); ContactPicker contactPicker(contactMethod);
...@@ -171,13 +171,13 @@ CallWidget::findRingAccount(QModelIndex idx1, QModelIndex idx2, QVector<int> vec ...@@ -171,13 +171,13 @@ CallWidget::findRingAccount(QModelIndex idx1, QModelIndex idx2, QVector<int> vec
if ((Account::Protocol)protocol.toUInt() == Account::Protocol::RING) { if ((Account::Protocol)protocol.toUInt() == Account::Protocol::RING) {
auto username = idx.data(static_cast<int>(Account::Role::Username)); auto username = idx.data(static_cast<int>(Account::Role::Username));
ui->ringIdLabel->setText( ui->ringIdLabel->setText(
"Your Ring ID: " + username.toString()); QString("%1: %2").arg(tr("Your RingID"), username.toString()));
found = true; found = true;
return; return;
} }
} }
if (not found){ if (not found){
ui->ringIdLabel->setText("NO RING ACCOUNT FOUND"); ui->ringIdLabel->setText(tr("NO RING ACCOUNT FOUND"));
} }
} }
...@@ -241,7 +241,7 @@ CallWidget::findRingAccount() ...@@ -241,7 +241,7 @@ CallWidget::findRingAccount()
account->displayName() = account->alias(); account->displayName() = account->alias();
auto username = account->username(); auto username = account->username();
ui->ringIdLabel->setText( ui->ringIdLabel->setText(
"Your Ring ID: " + username); QString("%1: %2").arg(tr("Your RingID"), username));
found = true; found = true;
return; return;
} }
...@@ -257,7 +257,7 @@ void ...@@ -257,7 +257,7 @@ void
CallWidget::callIncoming(Call *call) CallWidget::callIncoming(Call *call)
{ {
if (!call->account()->isAutoAnswer()) { 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->setVisible(true);
ui->callInvite->raise(); ui->callInvite->raise();
} }
...@@ -315,7 +315,8 @@ CallWidget::callStateChanged(Call* call, Call::State previousState) ...@@ -315,7 +315,8 @@ CallWidget::callStateChanged(Call* call, Call::State previousState)
displaySpinner(false); displaySpinner(false);
ui->videoWidget->show(); ui->videoWidget->show();
} }
ui->callStateLabel->setText("Call State : " + call->toHumanStateName()); ui->callStateLabel->setText(QString("%1: %2")
.arg(tr("Call State"), call->toHumanStateName()));
} }
void void
......
...@@ -168,7 +168,7 @@ ConfigurationWidget::on_deleteAccountButton_clicked() ...@@ -168,7 +168,7 @@ ConfigurationWidget::on_deleteAccountButton_clicked()
void void
ConfigurationWidget::on_addAccountButton_clicked() ConfigurationWidget::on_addAccountButton_clicked()
{ {
auto account = accountModel_->add("New Account", auto account = accountModel_->add(tr("New Account"),
ui->accountTypeBox->model()->index( ui->accountTypeBox->model()->index(
ui->accountTypeBox->currentIndex(), 0)); ui->accountTypeBox->currentIndex(), 0));
account->setRingtonePath(Utils::GetRingtonePath()); account->setRingtonePath(Utils::GetRingtonePath());
...@@ -199,7 +199,7 @@ ConfigurationWidget::on_clearHistoryButton_clicked() ...@@ -199,7 +199,7 @@ ConfigurationWidget::on_clearHistoryButton_clicked()
{ {
QMessageBox confirmationDialog; 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); confirmationDialog.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
auto ret = confirmationDialog.exec(); auto ret = confirmationDialog.exec();
......
...@@ -86,7 +86,7 @@ ContactDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, ...@@ -86,7 +86,7 @@ ContactDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option,
painter->drawText(QRect(rect.left()+sizeImage_+5, painter->drawText(QRect(rect.left()+sizeImage_+5,
rect.top() + rect.height()/2, rect.top() + rect.height()/2,
rect.width(), rect.height()/2), rect.width(), rect.height()/2),
opt.displayAlignment, "<Multiple contact methods>"); opt.displayAlignment, tr("<Multiple contact methods>"));
break; break;
} }
} }
......
...@@ -39,15 +39,15 @@ InstantMessagingWidget::InstantMessagingWidget(QWidget *parent) : ...@@ -39,15 +39,15 @@ InstantMessagingWidget::InstantMessagingWidget(QWidget *parent) :
imDelegate_ = new ImDelegate(); imDelegate_ = new ImDelegate();
ui->messageOutput->setItemDelegate(imDelegate_); ui->messageOutput->setItemDelegate(imDelegate_);
ui->messageOutput->setContextMenuPolicy(Qt::ActionsContextMenu); ui->messageOutput->setContextMenuPolicy(Qt::ActionsContextMenu);
auto copyAction = new QAction("Copy", this); auto copyAction = new QAction(tr("Copy"), this);
ui->messageOutput->addAction(copyAction); ui->messageOutput->addAction(copyAction);
connect(copyAction, &QAction::triggered, [=]() { connect(copyAction, &QAction::triggered, [=]() {
copyToClipboard(); copyToClipboard();
}); });
auto displayDate = new QAction("Display date", this); auto displayDate = new QAction(tr("Display date"), this);
displayDate->setCheckable(true); displayDate->setCheckable(true);
ui->messageOutput->addAction(displayDate); ui->messageOutput->addAction(displayDate);
auto displayAuthor = new QAction("Display author", this); auto displayAuthor = new QAction(tr("Display author"), this);
displayAuthor->setCheckable(true); displayAuthor->setCheckable(true);
ui->messageOutput->addAction(displayAuthor); ui->messageOutput->addAction(displayAuthor);
auto lamdba = [=](){ auto lamdba = [=](){
......
...@@ -28,6 +28,8 @@ ...@@ -28,6 +28,8 @@
#include <iostream> #include <iostream>
#include <QThread> #include <QThread>
#include <QTranslator>
#include <QLibraryInfo>
#ifdef Q_OS_WIN32 #ifdef Q_OS_WIN32
#include <windows.h> #include <windows.h>
...@@ -66,6 +68,19 @@ main(int argc, char *argv[]) ...@@ -66,6 +68,19 @@ main(int argc, char *argv[])
Console(); 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; QFont font;
font.setFamily("Segoe UI"); font.setFamily("Segoe UI");
a.setFont(font); a.setFont(font);
......
...@@ -29,11 +29,11 @@ MainBar::MainBar(QWidget *parent) : ...@@ -29,11 +29,11 @@ MainBar::MainBar(QWidget *parent) :
{ {
ui->setupUi(this); ui->setupUi(this);
auto aboutAction = new QAction("About", this); auto aboutAction = new QAction(tr("About"), this);
menu_->addAction(aboutAction); menu_->addAction(aboutAction);
connect(aboutAction, SIGNAL(triggered()), this, SLOT(showAboutDialog())); connect(aboutAction, SIGNAL(triggered()), this, SLOT(showAboutDialog()));
auto exitAction = new QAction("Exit", this); auto exitAction = new QAction(tr("Exit"), this);
menu_->addAction(exitAction); menu_->addAction(exitAction);
connect(exitAction, SIGNAL(triggered()), this, SLOT(on_exitButton_clicked())); connect(exitAction, SIGNAL(triggered()), this, SLOT(on_exitButton_clicked()));
......
...@@ -70,6 +70,10 @@ section "install" ...@@ -70,6 +70,10 @@ section "install"
file imageformats/* file imageformats/*
setOutPath $INSTDIR\ringtones setOutPath $INSTDIR\ringtones
file 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 # Uninstaller - See function un.onInit and section "uninstall" for configuration
writeUninstaller "$INSTDIR\uninstall.exe" writeUninstaller "$INSTDIR\uninstall.exe"
...@@ -129,6 +133,7 @@ section "uninstall" ...@@ -129,6 +133,7 @@ section "uninstall"
rmDir /r $INSTDIR\platforms rmDir /r $INSTDIR\platforms
rmDir /r $INSTDIR\imageformats rmDir /r $INSTDIR\imageformats
rmDir /r $INSTDIR\ringtones rmDir /r $INSTDIR\ringtones
rmDir /r $INSTDIR\share
# Always delete uninstaller as the last action # Always delete uninstaller as the last action
delete $INSTDIR\uninstall.exe delete $INSTDIR\uninstall.exe
......
...@@ -33,14 +33,14 @@ VideoOverlay::VideoOverlay(QWidget *parent) : ...@@ -33,14 +33,14 @@ VideoOverlay::VideoOverlay(QWidget *parent) :
setAttribute(Qt::WA_NoSystemBackground); setAttribute(Qt::WA_NoSystemBackground);
menu_ = new QMenu(this); menu_ = new QMenu(this);
auto muteAudio = new QAction("Mute Audio", this); auto muteAudio = new QAction(tr("Mute Audio"), this);
muteAudio->setCheckable(true); muteAudio->setCheckable(true);
connect(muteAudio, &QAction::triggered, [=](bool) { connect(muteAudio, &QAction::triggered, [=](bool) {
actionModel_->execute(UserActionModel::Action::MUTE_AUDIO); actionModel_->execute(UserActionModel::Action::MUTE_AUDIO);
}); });
menu_->addAction(muteAudio); menu_->addAction(muteAudio);
auto muteVideo = new QAction("Mute Video", this); auto muteVideo = new QAction(tr("Mute Video"), this);
muteVideo->setCheckable(true); muteVideo->setCheckable(true);
connect(muteVideo, &QAction::triggered, [=](bool) { connect(muteVideo, &QAction::triggered, [=](bool) {
actionModel_->execute(UserActionModel::Action::MUTE_VIDEO); actionModel_->execute(UserActionModel::Action::MUTE_VIDEO);
......
...@@ -181,18 +181,18 @@ VideoView::showContextMenu(const QPoint& pos) ...@@ -181,18 +181,18 @@ VideoView::showContextMenu(const QPoint& pos)
menu.addSeparator(); menu.addSeparator();
auto shareAction = new QAction("Share entire screen", this); auto shareAction = new QAction(tr("Share entire screen"), this);
menu.addAction(shareAction); menu.addAction(shareAction);
connect(shareAction, &QAction::triggered, [=]() { connect(shareAction, &QAction::triggered, [=]() {
Video::SourceModel::instance()->setDisplay(0, QApplication::desktop()->rect()); 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); menu.addAction(shareAreaAction);
connect(shareAreaAction, &QAction::triggered, [=]() { connect(shareAreaAction, &QAction::triggered, [=]() {
SelectAreaDialog selec; SelectAreaDialog selec;
selec.exec(); selec.exec();
}); });
auto shareFileAction = new QAction("Share file", this); auto shareFileAction = new QAction(tr("Share file"), this);
menu.addAction(shareFileAction); menu.addAction(shareFileAction);
connect(shareFileAction, &QAction::triggered, [=]() { connect(shareFileAction, &QAction::triggered, [=]() {
QFileDialog dialog(this); QFileDialog dialog(this);
......
...@@ -58,7 +58,7 @@ void ...@@ -58,7 +58,7 @@ void
WizardDialog::accept() WizardDialog::accept()
{ {
//ui->spinnerLabel->show(); //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->buttonBox->setEnabled(false);
ui->usernameEdit->setEnabled(false); ui->usernameEdit->setEnabled(false);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment