Qt4 GUI: localization bugs (linux and other platforms) fixed
Posted: 24.08.2011, 18:30
Hello,
I hope these were the last bugs I found
1. No localizations in Linux:
The directory "locale" contains no .mo files (maybe after a make install under Windows but not in Linux).
That leads into the next bug.
2. I found no translatable strings from the .ui.h files.
So I try to make an " make update-po" in the po directory and get the error message: "File src/celengine/asterism.cpp not found" .
With wo blanks after asterism.cpp?! It should be one.
The reason was the file POTFILES.in contains Windows/DOS line endings (the only file in the whole po directory, and the whole src tree).
After converting the file, "make update-po" works, but again no translatable strings from the .ui.h files.
So I created a Rules-qt file (based on Rules-kde):
The line "XGETTEXT_OPTIONS += --qt" is needed to mark format strings like "%L1" as qt format.
then I have to patch POTFILES.in to reflect the changes.
(don't forget to convert POTFILES.in to Unix/Linux format)
Now I get translatable strings and the next bug was rising
3. The EventFinder doesn't work anymore - this bug affects all platforms with localizations
I always got an "... is not a valid object" error message.
I found the use of the "simple" method of addItem in the planetSelect combobox was wrong.
Now it works again.
That's all for today
See you
I hope these were the last bugs I found
1. No localizations in Linux:
The directory "locale" contains no .mo files (maybe after a make install under Windows but not in Linux).
Code: Select all
diff -urN celestia.org/src/celestia/qt/qtmain.cpp celestia/src/celestia/qt/qtmain.cpp
--- celestia.org/src/celestia/qt/qtmain.cpp 2011-08-19 16:04:59.000000000 +0200
+++ celestia/src/celestia/qt/qtmain.cpp 2011-08-24 18:47:44.493630131 +0200
@@ -63,9 +63,11 @@
// Gettext integration
setlocale(LC_ALL, "");
setlocale(LC_NUMERIC, "C");
+#ifndef __linux
bindtextdomain("celestia","locale");
- bind_textdomain_codeset("celestia", "UTF-8");
bindtextdomain("celestia_constellations","locale");
+#endif
+ bind_textdomain_codeset("celestia", "UTF-8");
bind_textdomain_codeset("celestia_constellations", "UTF-8");
textdomain("celestia");
That leads into the next bug.
2. I found no translatable strings from the .ui.h files.
So I try to make an " make update-po" in the po directory and get the error message: "File src/celengine/asterism.cpp not found" .
With wo blanks after asterism.cpp?! It should be one.
The reason was the file POTFILES.in contains Windows/DOS line endings (the only file in the whole po directory, and the whole src tree).
After converting the file, "make update-po" works, but again no translatable strings from the .ui.h files.
So I created a Rules-qt file (based on Rules-kde):
Code: Select all
diff -urN celestia.org/po/Rules-qt celestia/po/Rules-qt
--- celestia.org/po/Rules-qt 1970-01-01 01:00:00.000000000 +0100
+++ celestia/po/Rules-qt 2011-08-24 18:43:02.447754472 +0200
@@ -0,0 +1,15 @@
+# Additional Makefile rule to extract strings from Qt ui files.
+
+Makefile: Rules-qt
+
+XGETTEXT_OPTIONS += --qt
+
+celestia.pot-update: ../src/celestia/qt/rc.cpp
+
+../src/celestia/qt/rc.cpp:
+ extractrc ../src/celestia/qt/*.ui > ../src/celestia/qt/rc.cpp
+
+clean: clean-qt
+
+clean-qt:
+ rm -f ../src/celestia/qt/rc.cpp
The line "XGETTEXT_OPTIONS += --qt" is needed to mark format strings like "%L1" as qt format.
then I have to patch POTFILES.in to reflect the changes.
(don't forget to convert POTFILES.in to Unix/Linux format)
Code: Select all
diff -urN celestia.org/po/POTFILES.in celestia/po/POTFILES.in
--- celestia.org/po/POTFILES.in 2011-08-19 16:05:45.000000000 +0200
+++ celestia/po/POTFILES.in 2011-08-24 18:45:37.089629689 +0200
@@ -123,10 +123,6 @@
src/celestia/qt/qtsettimedialog.cpp
src/celestia/qt/qtsolarsystembrowser.cpp
src/celestia/qt/qttimetoolbar.cpp
+src/celestia/qt/rc.cpp
src/celestia/qt/xbel.cpp
-# Qt headers generated from reading UI files
-src/celestia/qt/ui/ui_addbookmark.h
-src/celestia/qt/ui/ui_newbookmarkfolder.h
-src/celestia/qt/ui/ui_organizebookmarks.h
-src/celestia/qt/ui/ui_preferences.h
Now I get translatable strings and the next bug was rising
3. The EventFinder doesn't work anymore - this bug affects all platforms with localizations
I always got an "... is not a valid object" error message.
I found the use of the "simple" method of addItem in the planetSelect combobox was wrong.
Code: Select all
--- celestia.org/src/celestia/qt/qteventfinder.cpp 2011-08-19 16:04:59.000000000 +0200
+++ celestia/src/celestia/qt/qteventfinder.cpp 2011-08-24 18:47:18.330628794 +0200
@@ -598,12 +598,12 @@
layout->addWidget(subgroup);
planetSelect = new QComboBox();
- planetSelect->addItem(_("Earth"));
- planetSelect->addItem(_("Jupiter"));
- planetSelect->addItem(_("Saturn"));
- planetSelect->addItem(_("Uranus"));
- planetSelect->addItem(_("Neptune"));
- planetSelect->addItem(_("Pluto"));
+ planetSelect->addItem(_("Earth"), "Earth");
+ planetSelect->addItem(_("Jupiter"), "Jupiter");
+ planetSelect->addItem(_("Saturn"), "Saturn");
+ planetSelect->addItem(_("Uranus"), "Uranus");
+ planetSelect->addItem(_("Neptune"), "Neptune");
+ planetSelect->addItem(_("Pluto"), "Pluto");
layout->addWidget(planetSelect);
QPushButton* findButton = new QPushButton(_("Find eclipses"));
Now it works again.
That's all for today
See you