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
This commit is contained in:
parent
9581065b3f
commit
fe840481ec
@ -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
|
||||
|
||||
|
@ -29,7 +29,7 @@
|
||||
ByteViewTab::ByteViewTab(QWidget *parent) :
|
||||
QTabWidget(parent)
|
||||
{
|
||||
setAccessibleName("Packet bytes");
|
||||
setAccessibleName(tr("Packet bytes"));
|
||||
addTab();
|
||||
}
|
||||
|
||||
|
@ -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 {"
|
||||
|
@ -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));
|
||||
}
|
||||
|
5
ui/qt/i18n.qrc
Normal file
5
ui/qt/i18n.qrc
Normal file
@ -0,0 +1,5 @@
|
||||
<RCC>
|
||||
<qresource prefix="/i18n">
|
||||
<file>qtshark_fr.qm</file>
|
||||
</qresource>
|
||||
</RCC>
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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 {
|
||||
|
@ -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();
|
||||
|
BIN
ui/qt/qtshark_fr.qm
Normal file
BIN
ui/qt/qtshark_fr.qm
Normal file
Binary file not shown.
239
ui/qt/qtshark_fr.ts
Normal file
239
ui/qt/qtshark_fr.ts
Normal file
@ -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'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><h3>No interfaces found</h3>%1</source>
|
||||
<translation><h3>Interface non trouvée</h3>%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><h1>Capture</h1></source>
|
||||
<translation><h1>Capture</h1></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_welcome.cpp" line="110"/>
|
||||
<source><h1>Capture Help</h1></source>
|
||||
<translation><h1>Aide à la capture</h1></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_welcome.cpp" line="118"/>
|
||||
<source><h1>Files</h1></source>
|
||||
<translation><h1>Fichiers</h1></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_welcome.cpp" line="136"/>
|
||||
<source><h1>Online</h1></source>
|
||||
<translation><h1>En Ligne</h1></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'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>
|
Loading…
x
Reference in New Issue
Block a user