aboutsummaryrefslogtreecommitdiffstats
path: root/ui/qt
diff options
context:
space:
mode:
authorAlexis La Goutte <alexis.lagoutte@gmail.com>2012-03-07 10:16:33 +0000
committerAlexis La Goutte <alexis.lagoutte@gmail.com>2012-03-07 10:16:33 +0000
commitfe840481ec6960030e46562f8176f01065c90e4b (patch)
tree3f2ee3f8d3716afd6ea9b596aa932f22221d7f76 /ui/qt
parent9581065b3fa4ea94e0a6fe189cb471a93c6e4d79 (diff)
Add i18n to QtShark
The goal is only to translate the Gui (Not dissector) Actually, there is only a french translation. To try, (if you are not French) launch qtshark with LANG=fr ./qtshark (in ui/qt folder) Missing some feature : * Add preference to select (force) your language * Some Gui Text, it no available for translation * Documentation about how to translate (Coming soon...) * Your translation ! svn path=/trunk/; revision=41389
Diffstat (limited to 'ui/qt')
-rw-r--r--ui/qt/QtShark.pro6
-rw-r--r--ui/qt/byte_view_tab.cpp2
-rw-r--r--ui/qt/display_filter_combo.cpp2
-rw-r--r--ui/qt/display_filter_edit.cpp4
-rw-r--r--ui/qt/i18n.qrc5
-rw-r--r--ui/qt/interface_tree.cpp4
-rw-r--r--ui/qt/main.cpp12
-rw-r--r--ui/qt/main_status_bar.cpp12
-rw-r--r--ui/qt/main_welcome.cpp12
-rw-r--r--ui/qt/main_window.cpp3
-rw-r--r--ui/qt/proto_tree.cpp6
-rw-r--r--ui/qt/qtshark_fr.qmbin0 -> 3399 bytes
-rw-r--r--ui/qt/qtshark_fr.ts239
13 files changed, 284 insertions, 23 deletions
diff --git a/ui/qt/QtShark.pro b/ui/qt/QtShark.pro
index 3be3dbfdaf..68f5f4c9d3 100644
--- a/ui/qt/QtShark.pro
+++ b/ui/qt/QtShark.pro
@@ -290,7 +290,11 @@ win32 {
RESOURCES += \
toolbar.qrc \
welcome.qrc \
- display_filter.qrc
+ display_filter.qrc \
+ i18n.qrc
+
+TRANSLATIONS = \
+ qtshark_fr.ts
ICON = ../../packaging/macosx/Resources/Wireshark.icns
diff --git a/ui/qt/byte_view_tab.cpp b/ui/qt/byte_view_tab.cpp
index e876d47e97..1134c997f9 100644
--- a/ui/qt/byte_view_tab.cpp
+++ b/ui/qt/byte_view_tab.cpp
@@ -29,7 +29,7 @@
ByteViewTab::ByteViewTab(QWidget *parent) :
QTabWidget(parent)
{
- setAccessibleName("Packet bytes");
+ setAccessibleName(tr("Packet bytes"));
addTab();
}
diff --git a/ui/qt/display_filter_combo.cpp b/ui/qt/display_filter_combo.cpp
index f6c0c718c4..2e1fd9c58a 100644
--- a/ui/qt/display_filter_combo.cpp
+++ b/ui/qt/display_filter_combo.cpp
@@ -39,7 +39,7 @@ DisplayFilterCombo::DisplayFilterCombo(QWidget *parent) :
setEditable(true);
setLineEdit(new DisplayFilterEdit());
setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
- setAccessibleName("Dispaly filter selector");
+ setAccessibleName(tr("Display filter selector"));
cur_display_filter_combo = this;
setStyleSheet(
"QComboBox {"
diff --git a/ui/qt/display_filter_edit.cpp b/ui/qt/display_filter_edit.cpp
index fd8c3a0cab..4f35fd31b6 100644
--- a/ui/qt/display_filter_edit.cpp
+++ b/ui/qt/display_filter_edit.cpp
@@ -88,7 +88,7 @@ DisplayFilterEdit::DisplayFilterEdit(QWidget *parent) :
m_syntaxState = Empty;
emptyFilterMessage = QString::fromUtf8("Apply a display filter" UTF8_HORIZONTAL_ELLIPSIS " <%1/>").arg(DEFAULT_MODIFIER);
- setAccessibleName("Dispaly filter entry");
+ setAccessibleName(tr("Display filter entry"));
// DFCombo
// Bookmark (star)
@@ -280,7 +280,7 @@ void DisplayFilterEdit::checkFilter(const QString& text)
dfilter_free(dfp);
} else {
m_syntaxState = Invalid;
- QString invalidMsg("Invalid filter");
+ QString invalidMsg(tr("Invalid filter"));
if (dfilter_error_msg) {
invalidMsg.append(QString().sprintf(": %s", dfilter_error_msg));
}
diff --git a/ui/qt/i18n.qrc b/ui/qt/i18n.qrc
new file mode 100644
index 0000000000..0c9a27cfc2
--- /dev/null
+++ b/ui/qt/i18n.qrc
@@ -0,0 +1,5 @@
+<RCC>
+ <qresource prefix="/i18n">
+ <file>qtshark_fr.qm</file>
+ </qresource>
+</RCC>
diff --git a/ui/qt/interface_tree.cpp b/ui/qt/interface_tree.cpp
index b6061bde34..b8866fe47d 100644
--- a/ui/qt/interface_tree.cpp
+++ b/ui/qt/interface_tree.cpp
@@ -46,7 +46,7 @@ InterfaceTree::InterfaceTree(QWidget *parent) :
header()->setVisible(false);
setRootIsDecorated(false);
setUniformRowHeights(true);
- setAccessibleName("Welcome screen list");
+ setAccessibleName(tr("Welcome screen list"));
setStyleSheet(
"QTreeWidget {"
@@ -60,7 +60,7 @@ InterfaceTree::InterfaceTree(QWidget *parent) :
if (if_list == NULL && err == CANT_GET_INTERFACE_LIST) {
ti = new QTreeWidgetItem();
- QLabel *label = new QLabel(QString("<h3>No interfaces found</h3>%1").arg(QString().fromUtf8(err_str)));
+ QLabel *label = new QLabel(QString(tr("<h3>No interfaces found</h3>%1")).arg(QString().fromUtf8(err_str)));
label->setWordWrap(true);
setDisabled(true);
diff --git a/ui/qt/main.cpp b/ui/qt/main.cpp
index 7f50f6525a..9cd9eeae4a 100644
--- a/ui/qt/main.cpp
+++ b/ui/qt/main.cpp
@@ -117,6 +117,8 @@
#include <QDebug>
#include <QDateTime>
#include <QTextCodec>
+#include <qtranslator.h>
+#include <qlocale.h>
capture_file cfile;
@@ -655,6 +657,16 @@ int main(int argc, char *argv[])
int optind_initial;
int status;
+
+ //initialize language !
+
+ QString locale = QLocale::system().name();
+
+ g_log(NULL, G_LOG_LEVEL_DEBUG, "Translator %s", locale.toStdString().c_str());
+ QTranslator translator;
+ translator.load(QString(":/i18n/qtshark_") + locale);
+ a.installTranslator(&translator);
+
// Hopefully we won't have to use QString::fromUtf8() in as many places.
QTextCodec *utf8codec = QTextCodec::codecForName("UTF-8");
QTextCodec::setCodecForCStrings(utf8codec);
diff --git a/ui/qt/main_status_bar.cpp b/ui/qt/main_status_bar.cpp
index 58972d1de5..08db6e78ff 100644
--- a/ui/qt/main_status_bar.cpp
+++ b/ui/qt/main_status_bar.cpp
@@ -38,9 +38,9 @@
#include <QSplitter>
#ifdef HAVE_LIBPCAP
-#define DEF_READY_MESSAGE " Ready to load or capture"
+#define DEF_READY_MESSAGE QObject::tr(" Ready to load or capture")
#else
-#define DEF_READY_MESSAGE " Ready to load file"
+#define DEF_READY_MESSAGE QObject::tr(" Ready to load file")
#endif
// XXX - The GTK+ code assigns priorities to these and pushes/pops accordingly.
@@ -93,15 +93,15 @@ packets_bar_update(void)
/* Do we have any packets? */
if (cfile.count) {
- packetsStr.append(QString("Packets: %1 Displayed: %2 Marked: %3")
+ packetsStr.append(QString(QObject::tr("Packets: %1 Displayed: %2 Marked: %3"))
.arg(cfile.count)
.arg(cfile.displayed_count)
.arg(cfile.marked_count));
if(cfile.drops_known) {
- packetsStr.append(QString(" Dropped: %1").arg(cfile.drops));
+ packetsStr.append(QString(QObject::tr(" Dropped: %1")).arg(cfile.drops));
}
if(cfile.ignored_count > 0) {
- packetsStr.append(QString(" Ignored: %1").arg(cfile.ignored_count));
+ packetsStr.append(QString(QObject::tr(" Ignored: %1")).arg(cfile.ignored_count));
}
if(!cfile.is_tempfile) {
/* Loading an existing file */
@@ -112,7 +112,7 @@ packets_bar_update(void)
computed_elapsed%1000));
}
} else {
- packetsStr.append("No Packets");
+ packetsStr.append(QObject::tr("No Packets"));
}
cur_main_status_bar->pushPacketStatus(packetsStr);
diff --git a/ui/qt/main_welcome.cpp b/ui/qt/main_welcome.cpp
index 90e71b7888..85453c8907 100644
--- a/ui/qt/main_welcome.cpp
+++ b/ui/qt/main_welcome.cpp
@@ -93,7 +93,7 @@ MainWelcome::MainWelcome(QWidget *parent) :
grid->setColumnStretch(0, 60);
// Banner row, 3 column span
- QString banner = QString("Wireshark");
+ QString banner = QString(tr("Wireshark"));
heading = new QLabel(banner);
grid->addWidget(heading, 0, 0, 1, 3);
@@ -101,13 +101,13 @@ MainWelcome::MainWelcome(QWidget *parent) :
column = new QVBoxLayout();
grid->addLayout(column, 1, 0, Qt::AlignTop);
- heading = new QLabel("<h1>Capture</h1>");
+ heading = new QLabel(tr("<h1>Capture</h1>"));
column->addWidget(heading);
iface_tree = new InterfaceTree(this);
column->addWidget(iface_tree);
- heading = new QLabel("<h1>Capture Help</h1>");
+ heading = new QLabel(tr("<h1>Capture Help</h1>"));
column->addWidget(heading);
// Column 2: Files
@@ -115,7 +115,7 @@ MainWelcome::MainWelcome(QWidget *parent) :
grid->addLayout(column, 1, 1, Qt::AlignTop);
grid->setColumnStretch(1, 70);
- heading = new QLabel("<h1>Files</h1>");
+ heading = new QLabel(tr("<h1>Files</h1>"));
column->addWidget(heading);
m_recent_files.setStyleSheet(
@@ -133,7 +133,7 @@ MainWelcome::MainWelcome(QWidget *parent) :
grid->addLayout(column, 1, 2, Qt::AlignTop);
grid->setColumnStretch(2, 50);
- heading = new QLabel("<h1>Online</h1>");
+ heading = new QLabel(tr("<h1>Online</h1>"));
column->addWidget(heading);
// Sigh. This doesn't work in Qt 4.7 on OS X.
@@ -171,7 +171,7 @@ void MainWelcome::updateRecentFiles() {
itemLabel.append(QString("%1 Bytes").arg(ri->size));
}
} else {
- itemLabel.append("not found)");
+ itemLabel.append(tr("not found)"));
}
rfFont.setItalic(!ri->accessible);
rfItem = m_recent_files.item(rfRow);
diff --git a/ui/qt/main_window.cpp b/ui/qt/main_window.cpp
index c05d706fbd..631bc3e8ef 100644
--- a/ui/qt/main_window.cpp
+++ b/ui/qt/main_window.cpp
@@ -148,6 +148,7 @@ void MainWindow::captureFileReadStarted(const capture_file *cf) {
// main_set_for_capture_file(TRUE);
ui->statusBar->popFileStatus();
+ //TODO:i10n
QString msg = QString().sprintf("Loading: %s", get_basename(cf->filename));
ui->statusBar->pushFileStatus(msg);
}
@@ -379,7 +380,7 @@ void MainWindow::updateRecentFiles() {
recentMenu->insertAction(NULL, ra);
ra = new QAction(recentMenu);
- ra->setText("Clear Menu");
+ ra->setText(tr("Clear Menu"));
recentMenu->insertAction(NULL, ra);
connect(ra, SIGNAL(triggered()), wsApp, SLOT(clearRecentItems()));
} else {
diff --git a/ui/qt/proto_tree.cpp b/ui/qt/proto_tree.cpp
index 4d7b5d424e..ef8ed839da 100644
--- a/ui/qt/proto_tree.cpp
+++ b/ui/qt/proto_tree.cpp
@@ -142,7 +142,7 @@ proto_tree_draw_node(proto_node *node, gpointer data)
ProtoTree::ProtoTree(QWidget *parent) :
QTreeWidget(parent)
{
- setAccessibleName("Packet details");
+ setAccessibleName(tr("Packet details"));
setFont(get_monospace_font());
connect(this, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)),
@@ -184,9 +184,9 @@ void ProtoTree::updateSelectionStatus(QTreeWidgetItem* item) {
finfo_length = fi->length + fi->appendix_length;
if (finfo_length == 1) {
- itemInfo.append(", 1 byte");
+ itemInfo.append(tr(", 1 byte"));
} else if (finfo_length > 1) {
- itemInfo.append(QString(", %1 bytes").arg(finfo_length));
+ itemInfo.append(QString(tr(", %1 bytes")).arg(finfo_length));
}
emit protoItemUnselected();
diff --git a/ui/qt/qtshark_fr.qm b/ui/qt/qtshark_fr.qm
new file mode 100644
index 0000000000..9ec84992e1
--- /dev/null
+++ b/ui/qt/qtshark_fr.qm
Binary files differ
diff --git a/ui/qt/qtshark_fr.ts b/ui/qt/qtshark_fr.ts
new file mode 100644
index 0000000000..8932254c8a
--- /dev/null
+++ b/ui/qt/qtshark_fr.ts
@@ -0,0 +1,239 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0" language="fr_FR">
+<context>
+ <name>ByteViewTab</name>
+ <message>
+ <location filename="byte_view_tab.cpp" line="32"/>
+ <source>Packet bytes</source>
+ <translation>Taille du paquet</translation>
+ </message>
+</context>
+<context>
+ <name>DisplayFilterCombo</name>
+ <message>
+ <location filename="display_filter_combo.cpp" line="42"/>
+ <source>Display filter selector</source>
+ <translation>Le sélecteur de filtre</translation>
+ </message>
+</context>
+<context>
+ <name>DisplayFilterEdit</name>
+ <message>
+ <location filename="display_filter_edit.cpp" line="91"/>
+ <source>Display filter entry</source>
+ <oldsource>Dispaly filter entry</oldsource>
+ <translation>Filtre d&apos;entrée</translation>
+ </message>
+ <message>
+ <location filename="display_filter_edit.cpp" line="283"/>
+ <source>Invalid filter</source>
+ <translation>Filtre invalide</translation>
+ </message>
+</context>
+<context>
+ <name>InterfaceTree</name>
+ <message>
+ <location filename="interface_tree.cpp" line="49"/>
+ <source>Welcome screen list</source>
+ <translation>Page de bienvenue</translation>
+ </message>
+ <message>
+ <location filename="interface_tree.cpp" line="63"/>
+ <source>&lt;h3&gt;No interfaces found&lt;/h3&gt;%1</source>
+ <translation>&lt;h3&gt;Interface non trouvée&lt;/h3&gt;%1</translation>
+ </message>
+</context>
+<context>
+ <name>MainWelcome</name>
+ <message>
+ <location filename="main_welcome.cpp" line="96"/>
+ <source>Wireshark</source>
+ <translation></translation>
+ </message>
+ <message>
+ <location filename="main_welcome.cpp" line="104"/>
+ <source>&lt;h1&gt;Capture&lt;/h1&gt;</source>
+ <translation>&lt;h1&gt;Capture&lt;/h1&gt;</translation>
+ </message>
+ <message>
+ <location filename="main_welcome.cpp" line="110"/>
+ <source>&lt;h1&gt;Capture Help&lt;/h1&gt;</source>
+ <translation>&lt;h1&gt;Aide à la capture&lt;/h1&gt;</translation>
+ </message>
+ <message>
+ <location filename="main_welcome.cpp" line="118"/>
+ <source>&lt;h1&gt;Files&lt;/h1&gt;</source>
+ <translation>&lt;h1&gt;Fichiers&lt;/h1&gt;</translation>
+ </message>
+ <message>
+ <location filename="main_welcome.cpp" line="136"/>
+ <source>&lt;h1&gt;Online&lt;/h1&gt;</source>
+ <translation>&lt;h1&gt;En Ligne&lt;/h1&gt;</translation>
+ </message>
+ <message>
+ <location filename="main_welcome.cpp" line="174"/>
+ <source>not found)</source>
+ <translation>non trouvé)</translation>
+ </message>
+</context>
+<context>
+ <name>MainWindow</name>
+ <message>
+ <location filename="main_window.ui" line="14"/>
+ <source>Wireshark</source>
+ <translation></translation>
+ </message>
+ <message>
+ <location filename="main_window.ui" line="55"/>
+ <source>File</source>
+ <translation>Fichier</translation>
+ </message>
+ <message>
+ <location filename="main_window.ui" line="59"/>
+ <source>Open Recent</source>
+ <translation>Dernier fichier ouvert</translation>
+ </message>
+ <message>
+ <location filename="main_window.ui" line="71"/>
+ <source>Edit</source>
+ <translation>Editer</translation>
+ </message>
+ <message>
+ <location filename="main_window.ui" line="76"/>
+ <source>Capture</source>
+ <translation>Capture</translation>
+ </message>
+ <message>
+ <location filename="main_window.ui" line="121"/>
+ <source>toolBar</source>
+ <translation>Barre d&apos;outils</translation>
+ </message>
+ <message>
+ <location filename="main_window.ui" line="132"/>
+ <source>Open</source>
+ <translation>Ouvrir</translation>
+ </message>
+ <message>
+ <location filename="main_window.ui" line="135"/>
+ <source>Ctrl+O</source>
+ <translation></translation>
+ </message>
+ <message>
+ <location filename="main_window.ui" line="140"/>
+ <source>Quit</source>
+ <translation>Quitter</translation>
+ </message>
+ <message>
+ <location filename="main_window.ui" line="143"/>
+ <source>Ctrl+Q</source>
+ <translation></translation>
+ </message>
+ <message>
+ <location filename="main_window.ui" line="148"/>
+ <source>Interfaces</source>
+ <translation>Interfaces</translation>
+ </message>
+ <message>
+ <location filename="main_window.ui" line="161"/>
+ <source>Start</source>
+ <translation>Démarrer</translation>
+ </message>
+ <message>
+ <location filename="main_window.ui" line="164"/>
+ <source>Start capturing packets</source>
+ <translation>Démarrer la capture de paquet</translation>
+ </message>
+ <message>
+ <location filename="main_window.ui" line="167"/>
+ <source>Ctrl+K</source>
+ <translation></translation>
+ </message>
+ <message>
+ <location filename="main_window.ui" line="176"/>
+ <source>Stop</source>
+ <translation>Arrêter</translation>
+ </message>
+ <message>
+ <location filename="main_window.ui" line="179"/>
+ <source>Stop capturing packets</source>
+ <translation>Arrêter la capturer de paquet</translation>
+ </message>
+ <message>
+ <location filename="main_window.ui" line="184"/>
+ <source>Close</source>
+ <translation>Fermer</translation>
+ </message>
+ <message>
+ <location filename="main_window.ui" line="187"/>
+ <source>Ctrl+W</source>
+ <translation></translation>
+ </message>
+ <message>
+ <location filename="main_window.ui" line="195"/>
+ <source>No files found</source>
+ <translation>Pas de fichier trouvé</translation>
+ </message>
+ <message>
+ <location filename="main_window.cpp" line="293"/>
+ <source>Wireshark: Open Capture File</source>
+ <translation></translation>
+ </message>
+ <message>
+ <location filename="main_window.cpp" line="383"/>
+ <source>Clear Menu</source>
+ <translation>Effacer les fichiers récemment ouverts</translation>
+ </message>
+</context>
+<context>
+ <name>ProtoTree</name>
+ <message>
+ <location filename="proto_tree.cpp" line="145"/>
+ <source>Packet details</source>
+ <translation>Détail du paquet</translation>
+ </message>
+ <message>
+ <location filename="proto_tree.cpp" line="187"/>
+ <source>, 1 byte</source>
+ <translation>, 1 octet</translation>
+ </message>
+ <message>
+ <location filename="proto_tree.cpp" line="189"/>
+ <source>, %1 bytes</source>
+ <translation>, %1 octets</translation>
+ </message>
+</context>
+<context>
+ <name>QObject</name>
+ <message>
+ <location filename="main_status_bar.cpp" line="41"/>
+ <source> Ready to load or capture</source>
+ <translation>Prêt pour ouvrir ou capturer</translation>
+ </message>
+ <message>
+ <location filename="main_status_bar.cpp" line="43"/>
+ <source> Ready to load file</source>
+ <translation>Prêt pour ouvrir un fichier</translation>
+ </message>
+ <message>
+ <location filename="main_status_bar.cpp" line="96"/>
+ <source>Packets: %1 Displayed: %2 Marked: %3</source>
+ <translation>Paquets: %1 Affichés: %2 Marqués: %3</translation>
+ </message>
+ <message>
+ <location filename="main_status_bar.cpp" line="101"/>
+ <source> Dropped: %1</source>
+ <translation>Supprimé: %1</translation>
+ </message>
+ <message>
+ <location filename="main_status_bar.cpp" line="104"/>
+ <source> Ignored: %1</source>
+ <translation> Ignoré: %1</translation>
+ </message>
+ <message>
+ <location filename="main_status_bar.cpp" line="115"/>
+ <source>No Packets</source>
+ <translation>Pas de paquets</translation>
+ </message>
+</context>
+</TS>