Skip to content

Instantly share code, notes, and snippets.

@liangtai
Created October 4, 2010 21:10
Show Gist options
  • Select an option

  • Save liangtai/610441 to your computer and use it in GitHub Desktop.

Select an option

Save liangtai/610441 to your computer and use it in GitHub Desktop.
enable Qt4:qtconfig translation
--- tools/qtconfig/main.cpp.orig 2010-01-16 02:01:30.000000000 +0900
+++ tools/qtconfig/main.cpp 2010-04-29 19:23:25.000000000 +0900
@@ -42,6 +42,8 @@
#include "ui_previewwidgetbase.h"
#include "mainwindow.h"
#include <QApplication>
+#include <QLibraryInfo>
+#include <QTranslator>
QT_USE_NAMESPACE
@@ -50,6 +52,12 @@
Q_INIT_RESOURCE(qtconfig);
QApplication app(argc, argv);
+
+ QTranslator qtTranslator;
+ qtTranslator.load("qtconfig_" + QLocale::system().name(),
+ QLibraryInfo::location(QLibraryInfo::TranslationsPath));
+ app.installTranslator(&qtTranslator);
+
MainWindow mw;
mw.show();
return app.exec();
--- tools/qtconfig/mainwindow.cpp.orig 2010-01-16 02:01:30.000000000 +0900
+++ tools/qtconfig/mainwindow.cpp 2010-04-29 19:07:52.000000000 +0900
@@ -79,7 +79,7 @@
// external use ignore them
// extern bool Q_CORE_EXPORT qt_resolve_symlinks;
-static const char *appearance_text =
+static const char *appearance_text = QT_TRANSLATE_NOOP("MainWindow",
"<p><b><font size+=2>Appearance</font></b></p>"
"<hr>"
"<p>Use this tab to customize the appearance of your Qt applications.</p>"
@@ -93,9 +93,9 @@
"To customize colors further, press the Tune Palette button to open "
"the advanced palette editor."
"<p>The Preview Window shows what the selected Style and colors look "
-"like.";
+"like.");
-static const char *font_text =
+static const char *font_text = QT_TRANSLATE_NOOP("MainWindow",
"<p><b><font size+=2>Fonts</font></b></p>"
"<hr>"
"<p>Use this tab to select the default font for your Qt applications. "
@@ -112,9 +112,9 @@
"Korean characters that are not found in the Lucida font will be taken "
"from the Mincho font. Because the font substitutions are "
"lists, you can also select multiple families, such as Song Ti (for "
-"use with Chinese text).";
+"use with Chinese text).");
-static const char *interface_text =
+static const char *interface_text = QT_TRANSLATE_NOOP("MainWindow",
"<p><b><font size+=2>Interface</font></b></p>"
"<hr>"
"<p>Use this tab to customize the feel of your Qt applications.</p>"
@@ -129,28 +129,28 @@
"at 0 will disable the Global Strut feature</p>"
"<p>XIM (Extended Input Methods) are used for entering characters in "
"languages that have large character sets, for example, Chinese and "
-"Japanese.";
+"Japanese.");
// ### What does the 'Enhanced support for languages written R2L do?
-static const char *printer_text =
+static const char *printer_text = QT_TRANSLATE_NOOP("MainWindow",
"<p><b><font size+=2>Printer</font></b></p>"
"<hr>"
-"<p>Use this tab to configure the way Qt generates output for the printer."
-"You can specify if Qt should try to embed fonts into its generated output."
+"<p>Use this tab to configure the way Qt generates output for the printer. "
+"You can specify if Qt should try to embed fonts into its generated output. "
"If you enable font embedding, the resulting postscript will be more "
"portable and will more accurately reflect the "
"visual output on the screen; however the resulting postscript file "
"size will be bigger."
"<p>When using font embedding you can select additional directories where "
"Qt should search for embeddable font files. By default, the X "
-"server font path is used.";
+"server font path is used.");
-static const char *phonon_text =
+static const char *phonon_text = QT_TRANSLATE_NOOP("MainWindow",
"<p><b><font size+=2>Phonon</font></b></p>"
"<hr>"
"<p>Use this tab to configure the Phonon GStreamer multimedia backend. "
"<p>It is reccommended to leave all settings on \"Auto\" to let "
-"Phonon determine your settings automatically.";
+"Phonon determine your settings automatically.");
static QColorGroup::ColorRole centralFromItem( int item )
{
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment