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) {
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
}
......@@ -31,10 +31,9 @@ AboutDialog::AboutDialog(QWidget *parent) :
this->setFixedSize(this->width(),this->height());
ui->creditsWidget->hide();
ui->clientVersionLabel->setText(
QString("<html><head/><body><p><span style=\" font-weight:600;\">Windows Ring v")
+ VERSION
+ "</span></p></body></html>");
ui->gitVersionLabel->setText(QString("version: ") + GIT_VERSION);
QString("<html><head/><body><p><span style=\" font-weight:600;\">"
"%1 v%2</span></p></body></html>").arg(tr("Windows Ring"), VERSION));
ui->gitVersionLabel->setText(QString("%1: %2").arg(tr("version"), GIT_VERSION));
}
AboutDialog::~AboutDialog()
......
......@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>674</width>
<height>534</height>
<height>565</height>
</rect>
</property>
<property name="sizePolicy">
......
......@@ -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);
......
......@@ -120,13 +120,13 @@ CallWidget::CallWidget(QWidget *parent) :
ContactMethod* contactMethod = ui->historyList->currentIndex()
.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);
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<int> vec
if ((Account::Protocol)protocol.toUInt() == Account::Protocol::RING) {
auto username = idx.data(static_cast<int>(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
......
......@@ -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();
......
......@@ -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, "<Multiple contact methods>");
opt.displayAlignment, tr("<Multiple contact methods>"));
break;
}
}
......
......@@ -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 = [=](){
......
......@@ -28,6 +28,8 @@
#include <iostream>
#include <QThread>
#include <QTranslator>
#include <QLibraryInfo>
#ifdef Q_OS_WIN32
#include <windows.h>
......@@ -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);
......
......@@ -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()));
......
......@@ -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
......
......@@ -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);
......
......@@ -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);
......
......@@ -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);
......
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