1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

Makes toxgui translatable

This commit is contained in:
Tux3 / Mlkj / !Lev.uXFMLA 2014-07-03 21:42:23 +02:00
parent 9eca1784f7
commit 537d55bd7f
11 changed files with 45 additions and 45 deletions

View File

@ -142,8 +142,8 @@ bool Camera::isFormatSupported(const QVideoSurfaceFormat& format) const
}
else
{
QMessageBox::warning(0, "Camera eror",
QString("Camera format %1 not supported, can't use the camera")
QMessageBox::warning(0, tr("Camera eror"),
tr("Camera format %1 not supported, can't use the camera")
.arg(format.pixelFormat()));
return false;
}

View File

@ -228,7 +228,7 @@ void FileTransfertWidget::rejectRecvRequest()
void FileTransfertWidget::acceptRecvRequest()
{
QString path = QFileDialog::getSaveFileName(0,"Save a file",QDir::currentPath()+'/'+filename->text());
QString path = QFileDialog::getSaveFileName(0,tr("Save a file","Title of the file saving dialog"),QDir::currentPath()+'/'+filename->text());
if (path.isEmpty())
return;

View File

@ -12,12 +12,12 @@ AddFriendForm::AddFriendForm() : dns(this)
main = new QWidget(), head = new QWidget();
QFont bold;
bold.setBold(true);
headLabel.setText("Add Friends");
headLabel.setText(tr("Add Friends"));
headLabel.setFont(bold);
toxIdLabel.setText("Tox ID");
messageLabel.setText("Message");
sendButton.setText("Send friend request");
toxIdLabel.setText(tr("Tox ID","Tox ID of the person you're sending a friend request to"));
messageLabel.setText(tr("Message","The message you send in friend requests"));
sendButton.setText(tr("Send friend request"));
main->setLayout(&layout);
layout.addWidget(&toxIdLabel);
@ -64,7 +64,7 @@ void AddFriendForm::showWarning(const QString &message) const
QString AddFriendForm::getMessage() const
{
const QString msg = message.toPlainText();
return !msg.isEmpty() ? msg : "Tox me maybe?";
return !msg.isEmpty() ? msg : tr("Tox me maybe?","Default message in friend requests if the field is left blank. Write something appropriate!");
}
void AddFriendForm::onSendTriggered()
@ -72,7 +72,7 @@ void AddFriendForm::onSendTriggered()
QString id = toxId.text().trimmed();
if (id.isEmpty()) {
showWarning("Please fill in a valid Tox ID");
showWarning(tr("Please fill in a valid Tox ID","Tox ID of the friend you're sending a friend request to"));
} else if (isToxId(id)) {
emit friendRequested(id, getMessage());
} else {
@ -87,38 +87,38 @@ void AddFriendForm::handleDnsLookup()
const QString idKeyWord("id=");
if (dns.error() != QDnsLookup::NoError) {
showWarning("Error while looking up DNS");
showWarning(tr("Error while looking up DNS","The DNS gives the Tox ID associated to toxme.se addresses"));
return;
}
const QList<QDnsTextRecord> textRecords = dns.textRecords();
if (textRecords.length() != 1) {
showWarning("Unexpected number of text records");
showWarning(tr("Unexpected number of text records", "Error with the DNS"));
return;
}
const QList<QByteArray> textRecordValues = textRecords.first().values();
if (textRecordValues.length() != 1) {
showWarning("Unexpected number of values in text record");
showWarning(tr("Unexpected number of values in text record", "Error with the DNS"));
return;
}
const QString entry(textRecordValues.first());
int idx = entry.indexOf(idKeyWord);
if (idx < 0) {
showWarning("The DNS lookup does not contain any Tox ID");
showWarning(tr("The DNS lookup does not contain any Tox ID", "Error with the DNS"));
return;
}
idx += idKeyWord.length();
if (entry.length() < idx + static_cast<int>(TOX_ID_SIZE)) {
showWarning("The DNS lookup does not contain a valid Tox ID");
showWarning(tr("The DNS lookup does not contain a valid Tox ID", "Error with the DNS"));
return;
}
const QString friendAdress = entry.mid(idx, TOX_ID_SIZE);
if (!isToxId(friendAdress)) {
showWarning("The DNS lookup does not contain a valid Tox ID");
showWarning(tr("The DNS lookup does not contain a valid Tox ID", "Error with the DNS"));
return;
}

View File

@ -258,7 +258,7 @@ void ChatForm::addMessage(QLabel* author, QLabel* message, QLabel* date)
void ChatForm::onAttachClicked()
{
QString path = QFileDialog::getOpenFileName(0,"Send a file");
QString path = QFileDialog::getOpenFileName(0,tr("Send a file"));
if (path.isEmpty())
return;
@ -583,13 +583,13 @@ void ChatForm::onChatContextMenuRequested(QPoint pos)
QWidget* sender = (QWidget*)QObject::sender();
pos = sender->mapToGlobal(pos);
QMenu menu;
menu.addAction("Save chat log", this, SLOT(onSaveLogClicked()));
menu.addAction(tr("Save chat log"), this, SLOT(onSaveLogClicked()));
menu.exec(pos);
}
void ChatForm::onSaveLogClicked()
{
QString path = QFileDialog::getSaveFileName(0,"Save chat log");
QString path = QFileDialog::getSaveFileName(0,tr("Save chat log"));
if (path.isEmpty())
return;

View File

@ -29,7 +29,7 @@ GroupChatForm::GroupChatForm(Group* chatGroup)
name->setText(group->widget->name.text());
name->setFont(bold);
nusers->setFont(small);
nusers->setText(QString("%1 users in chat").arg(group->peers.size()));
nusers->setText(tr("%1 users in chat").arg(group->peers.size()));
avatar->setPixmap(QPixmap(":/img/group.png"));
QString names;
for (QString& s : group->peers)
@ -152,7 +152,7 @@ void GroupChatForm::addGroupMessage(QString message, int peerId)
if (group->peers.contains(peerId))
msgAuthor = new QLabel(group->peers[peerId]);
else
msgAuthor = new QLabel("<Unknown>");
msgAuthor = new QLabel(tr("<Unknown>"));
QLabel *msgText = new QLabel(message);
QLabel *msgDate = new QLabel(QTime::currentTime().toString("hh:mm"));
@ -217,7 +217,7 @@ void GroupChatForm::onSliderRangeChanged()
void GroupChatForm::onUserListChanged()
{
nusers->setText(QString("%1 users in chat").arg(group->nPeers));
nusers->setText(tr("%1 users in chat").arg(group->nPeers));
QString names;
for (QString& s : group->peers)
names.append(s+", ");
@ -236,7 +236,7 @@ void GroupChatForm::onChatContextMenuRequested(QPoint pos)
void GroupChatForm::onSaveLogClicked()
{
QString path = QFileDialog::getSaveFileName(0,"Save chat log");
QString path = QFileDialog::getSaveFileName(0,tr("Save chat log"));
if (path.isEmpty())
return;

View File

@ -10,17 +10,17 @@ SettingsForm::SettingsForm()
QFont bold, small;
bold.setBold(true);
small.setPixelSize(7);
headLabel.setText("User Settings");
headLabel.setText(tr("User Settings","\"Headline\" of the window"));
headLabel.setFont(bold);
nameLabel.setText("Name");
statusTextLabel.setText("Status");
nameLabel.setText(tr("Name","Username/nick"));
statusTextLabel.setText(tr("Status","Status message"));
idLabel.setText("Tox ID");
id.setFont(small);
id.setTextInteractionFlags(Qt::TextSelectableByMouse);
videoTest.setText("Test video");
enableIPv6.setText("Enable IPv6 (recommended)");
videoTest.setText(tr("Test video","Text on a button to test the video/webcam"));
enableIPv6.setText(tr("Enable IPv6 (recommended)","Text on a checkbox to enable IPv6"));
enableIPv6.setChecked(Settings::getInstance().getEnableIPv6());
main->setLayout(&layout);

View File

@ -62,8 +62,8 @@ void FriendWidget::contextMenuEvent(QContextMenuEvent * event)
{
QPoint pos = event->globalPos();
QMenu menu;
menu.addAction("Copy friend ID");
QMenu* inviteMenu = menu.addMenu("Invite in group");
menu.addAction(tr("Copy friend ID","Menu to copy the Tox ID of that friend"));
QMenu* inviteMenu = menu.addMenu(tr("Invite in group","Menu to invite a friend in a groupchat"));
QMap<QAction*, Group*> groupActions;
for (Group* group : GroupList::groupList)
{
@ -73,7 +73,7 @@ void FriendWidget::contextMenuEvent(QContextMenuEvent * event)
if (groupActions.isEmpty())
inviteMenu->setEnabled(false);
menu.addSeparator();
menu.addAction("Remove friend");
menu.addAction(tr("Remove friend", "Menu to remove the friend from our friendlist"));
QAction* selectedItem = menu.exec(pos);
if (selectedItem)

View File

@ -35,9 +35,9 @@ GroupWidget::GroupWidget(int GroupId, QString Name)
this->setPalette(pal3);
Group* g = GroupList::findGroup(groupId);
if (g)
nusers.setText(QString("%1 users in chat").arg(g->peers.size()));
nusers.setText(QString(tr("%1 users in chat")).arg(g->peers.size()));
else
nusers.setText("0 users in chat");
nusers.setText(tr("0 users in chat"));
textLayout.addStretch();
textLayout.addWidget(&name);
@ -65,7 +65,7 @@ void GroupWidget::contextMenuEvent(QContextMenuEvent * event)
{
QPoint pos = event->globalPos();
QMenu menu;
menu.addAction("Quit group");
menu.addAction(tr("Quit group","Menu to quit a groupchat"));
QAction* selectedItem = menu.exec(pos);
if (selectedItem)
@ -123,9 +123,9 @@ void GroupWidget::onUserListChanged()
{
Group* g = GroupList::findGroup(groupId);
if (g)
nusers.setText(QString("%1 users in chat").arg(g->nPeers));
nusers.setText(tr("%1 users in chat").arg(g->nPeers));
else
nusers.setText("0 users in chat");
nusers.setText(tr("0 users in chat"));
}
void GroupWidget::setAsActiveChatroom()

View File

@ -13,7 +13,7 @@ SelfCamView::SelfCamView(Camera* Cam, QWidget* parent)
mainLayout{new QHBoxLayout()}, cam(Cam)
{
setLayout(mainLayout);
setWindowTitle("Tox video test");
setWindowTitle(tr("Tox video test","Title of the window to test the video/webcam"));
setMinimumSize(320,240);
updateDisplayTimer.setInterval(5);

View File

@ -27,22 +27,22 @@ FriendRequestDialog::FriendRequestDialog(QWidget *parent, const QString &userId,
QDialog(parent)
{
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
setWindowTitle("Friend request");
setWindowTitle(tr("Friend request","Title of the window to aceept/deny a friend request"));
QLabel *friendsLabel = new QLabel("Someone wants to make friends with you.", this);
QLabel *userIdLabel = new QLabel("User ID:", this);
QLabel *friendsLabel = new QLabel(tr("Someone wants to make friends with you"), this);
QLabel *userIdLabel = new QLabel(tr("User ID:"), this);
QLineEdit *userIdEdit = new QLineEdit(userId, this);
userIdEdit->setCursorPosition(0);
userIdEdit->setReadOnly(true);
QLabel *messageLabel = new QLabel("Friend request message:", this);
QLabel *messageLabel = new QLabel(tr("Friend request message:"), this);
QPlainTextEdit *messageEdit = new QPlainTextEdit(message, this);
messageEdit->setReadOnly(true);
QDialogButtonBox *buttonBox = new QDialogButtonBox(Qt::Horizontal, this);
buttonBox->addButton("Accept", QDialogButtonBox::AcceptRole);
buttonBox->addButton("Reject", QDialogButtonBox::RejectRole);
buttonBox->addButton(tr("Accept","Accept a friend request"), QDialogButtonBox::AcceptRole);
buttonBox->addButton(tr("Reject","Reject a friend request"), QDialogButtonBox::RejectRole);
connect(buttonBox, &QDialogButtonBox::accepted, this, &FriendRequestDialog::accept);
connect(buttonBox, &QDialogButtonBox::rejected, this, &FriendRequestDialog::reject);

View File

@ -1109,9 +1109,9 @@ void Widget::minimizeBtnClicked()
void Widget::onStatusImgClicked()
{
QMenu menu;
menu.addAction("Online");
menu.addAction("Away");
menu.addAction("Busy");
menu.addAction(tr("Online","Button to set your status to 'Online'"));
menu.addAction(tr("Away","Button to set your status to 'Away'"));
menu.addAction(tr("Busy","Button to set your status to 'Busy'"));
QPoint pos = QCursor::pos();
QAction* selectedItem = menu.exec(pos);