<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: Gettext and QT4?</title>
	<atom:link href="http://blog.venthur.de/2008/09/14/gettext-and-qt4/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.venthur.de/2008/09/14/gettext-and-qt4/</link>
	<description>and no tagline either</description>
	<pubDate>Mon, 06 Sep 2010 10:23:32 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
		<item>
		<title>By: Davlet</title>
		<link>http://blog.venthur.de/2008/09/14/gettext-and-qt4/#comment-146210</link>
		<dc:creator>Davlet</dc:creator>
		<pubDate>Thu, 04 Jun 2009 19:16:48 +0000</pubDate>
		<guid isPermaLink="false">http://blog.venthur.de/2008/09/14/gettext-and-qt4/#comment-146210</guid>
		<description>Qt l18n framework sucks ass. It has no equivalent of "dgettext" function, so it's impossible to associate a string with a translation file. Instead it has a global list of "catalogs" (message files) that it searches in order. You have to install the catalogs explicitly at program startup. This is difficult to do in libraries since they have no entry point. And this whole idea of searching multiple files for translations is just bad because the results of the search depends on what catalogs are currently installed, which may be determined what libraries you are linked with (depending on how you do this).

KDE is only marginally better -- it uses Qt API, but overloads its message lookup functions to search .mo (from gettext) files, rather than .qm (Qt Translator) files.

KDE's translation project is a big mess in no small part due to the design of Qt API -- it's not granular, instead *all* translations for *all* KDE programs are stored/managed in one separate source package (kde-l10n or some such). So to update anything (i.e., sync PO files with source code) using their tools you have to run them on the entire KDE source tree and there's no easy way of telling what PO file belongs to what project, etc.

Using gettext in Qt projects is problematic, too, when your project contains UI files. The code generated by UI compiler "likes" to call Qt's translation functions for message lookups. OTOH UIC's "-tr" parameter omits contexts in generated code. I have yet to find a good way to do this.</description>
		<content:encoded><![CDATA[<p>Qt l18n framework sucks ass. It has no equivalent of &#8220;dgettext&#8221; function, so it&#8217;s impossible to associate a string with a translation file. Instead it has a global list of &#8220;catalogs&#8221; (message files) that it searches in order. You have to install the catalogs explicitly at program startup. This is difficult to do in libraries since they have no entry point. And this whole idea of searching multiple files for translations is just bad because the results of the search depends on what catalogs are currently installed, which may be determined what libraries you are linked with (depending on how you do this).</p>
<p>KDE is only marginally better &#8212; it uses Qt API, but overloads its message lookup functions to search .mo (from gettext) files, rather than .qm (Qt Translator) files.</p>
<p>KDE&#8217;s translation project is a big mess in no small part due to the design of Qt API &#8212; it&#8217;s not granular, instead *all* translations for *all* KDE programs are stored/managed in one separate source package (kde-l10n or some such). So to update anything (i.e., sync PO files with source code) using their tools you have to run them on the entire KDE source tree and there&#8217;s no easy way of telling what PO file belongs to what project, etc.</p>
<p>Using gettext in Qt projects is problematic, too, when your project contains UI files. The code generated by UI compiler &#8220;likes&#8221; to call Qt&#8217;s translation functions for message lookups. OTOH UIC&#8217;s &#8220;-tr&#8221; parameter omits contexts in generated code. I have yet to find a good way to do this.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Boris</title>
		<link>http://blog.venthur.de/2008/09/14/gettext-and-qt4/#comment-141604</link>
		<dc:creator>Boris</dc:creator>
		<pubDate>Sat, 25 Apr 2009 11:01:15 +0000</pubDate>
		<guid isPermaLink="false">http://blog.venthur.de/2008/09/14/gettext-and-qt4/#comment-141604</guid>
		<description>gettext is better than Qt's system - for one reason: perfect support for plural forms. I have yet to find any other translation system othet than gettext that supports plural in such perfect way (some languages have more than one plural form - so having 2 strings - singular and plural variant - to workaround this in Qt's (and other's) system does not work).</description>
		<content:encoded><![CDATA[<p>gettext is better than Qt&#8217;s system - for one reason: perfect support for plural forms. I have yet to find any other translation system othet than gettext that supports plural in such perfect way (some languages have more than one plural form - so having 2 strings - singular and plural variant - to workaround this in Qt&#8217;s (and other&#8217;s) system does not work).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sebastian</title>
		<link>http://blog.venthur.de/2008/09/14/gettext-and-qt4/#comment-109326</link>
		<dc:creator>Sebastian</dc:creator>
		<pubDate>Sun, 21 Sep 2008 03:51:26 +0000</pubDate>
		<guid isPermaLink="false">http://blog.venthur.de/2008/09/14/gettext-and-qt4/#comment-109326</guid>
		<description>"QT" is Quicktime by Apple, "Qt" is Qt by Trolltech.</description>
		<content:encoded><![CDATA[<p>&#8220;QT&#8221; is Quicktime by Apple, &#8220;Qt&#8221; is Qt by Trolltech.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: fabo</title>
		<link>http://blog.venthur.de/2008/09/14/gettext-and-qt4/#comment-108730</link>
		<dc:creator>fabo</dc:creator>
		<pubDate>Mon, 15 Sep 2008 08:11:12 +0000</pubDate>
		<guid isPermaLink="false">http://blog.venthur.de/2008/09/14/gettext-and-qt4/#comment-108730</guid>
		<description>My 2cts: sse Qt translation mechanism for a GUI application.</description>
		<content:encoded><![CDATA[<p>My 2cts: sse Qt translation mechanism for a GUI application.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jan Hudec</title>
		<link>http://blog.venthur.de/2008/09/14/gettext-and-qt4/#comment-108710</link>
		<dc:creator>Jan Hudec</dc:creator>
		<pubDate>Sun, 14 Sep 2008 15:48:43 +0000</pubDate>
		<guid isPermaLink="false">http://blog.venthur.de/2008/09/14/gettext-and-qt4/#comment-108710</guid>
		<description>On the other hand, the Qt localization system works basically the same way as gettext. It has a function used to mark translatable strings in code, tool to extract the strings and a tool to manipulate the catalogs. The difference is format of the catalogs, but it would be easy to write a convertor if it does not exist already and the fact, that all translatable strings get name of the class they appear in as context by default (contexts are supported in newest gettext, but there is no implict context).

So if you are programming with pure Qt (rather than KDE, where you would have gettext) and aim for portability to Windows or Mac, you can consider to use the Qt system to reduce dependencies.</description>
		<content:encoded><![CDATA[<p>On the other hand, the Qt localization system works basically the same way as gettext. It has a function used to mark translatable strings in code, tool to extract the strings and a tool to manipulate the catalogs. The difference is format of the catalogs, but it would be easy to write a convertor if it does not exist already and the fact, that all translatable strings get name of the class they appear in as context by default (contexts are supported in newest gettext, but there is no implict context).</p>
<p>So if you are programming with pure Qt (rather than KDE, where you would have gettext) and aim for portability to Windows or Mac, you can consider to use the Qt system to reduce dependencies.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jan Hudec</title>
		<link>http://blog.venthur.de/2008/09/14/gettext-and-qt4/#comment-108709</link>
		<dc:creator>Jan Hudec</dc:creator>
		<pubDate>Sun, 14 Sep 2008 15:32:58 +0000</pubDate>
		<guid isPermaLink="false">http://blog.venthur.de/2008/09/14/gettext-and-qt4/#comment-108709</guid>
		<description>The system is in Qt for quite some time - Qt3 certainly already had it. Nevertheless KDE 3 did use gettext and I believe still does. So I suggest looking what KDE does and doing the same.

Basically it boils down to using an option to uic (-tr) to call your method instead of tr for translating and than implementing that method on your base classes.</description>
		<content:encoded><![CDATA[<p>The system is in Qt for quite some time - Qt3 certainly already had it. Nevertheless KDE 3 did use gettext and I believe still does. So I suggest looking what KDE does and doing the same.</p>
<p>Basically it boils down to using an option to uic (-tr) to call your method instead of tr for translating and than implementing that method on your base classes.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Xtophe</title>
		<link>http://blog.venthur.de/2008/09/14/gettext-and-qt4/#comment-108708</link>
		<dc:creator>Xtophe</dc:creator>
		<pubDate>Sun, 14 Sep 2008 15:30:38 +0000</pubDate>
		<guid isPermaLink="false">http://blog.venthur.de/2008/09/14/gettext-and-qt4/#comment-108708</guid>
		<description>If your application is only on Qt4, I think it'll make sense to be wholly with the qt system.
If Qt is only a part of the app, it's doable. For example in VLC, we translate the qt gui with gettext. You'll still need to load the qt4_*.qm to have the dialogs provided by qt translated.</description>
		<content:encoded><![CDATA[<p>If your application is only on Qt4, I think it&#8217;ll make sense to be wholly with the qt system.<br />
If Qt is only a part of the app, it&#8217;s doable. For example in VLC, we translate the qt gui with gettext. You&#8217;ll still need to load the qt4_*.qm to have the dialogs provided by qt translated.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: foo</title>
		<link>http://blog.venthur.de/2008/09/14/gettext-and-qt4/#comment-108706</link>
		<dc:creator>foo</dc:creator>
		<pubDate>Sun, 14 Sep 2008 14:13:13 +0000</pubDate>
		<guid isPermaLink="false">http://blog.venthur.de/2008/09/14/gettext-and-qt4/#comment-108706</guid>
		<description>WTH are Qt devs smoking. I agree with pinotree though, take that bonghit too.</description>
		<content:encoded><![CDATA[<p>WTH are Qt devs smoking. I agree with pinotree though, take that bonghit too.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: pinotree</title>
		<link>http://blog.venthur.de/2008/09/14/gettext-and-qt4/#comment-108705</link>
		<dc:creator>pinotree</dc:creator>
		<pubDate>Sun, 14 Sep 2008 13:45:50 +0000</pubDate>
		<guid isPermaLink="false">http://blog.venthur.de/2008/09/14/gettext-and-qt4/#comment-108705</guid>
		<description>I then suggest you to switch to the Qt4 translation system. I know, it is not gettext (thus could look "weird"), but at least the application can be translated as a whole.

QObject.tr() is your friend :)</description>
		<content:encoded><![CDATA[<p>I then suggest you to switch to the Qt4 translation system. I know, it is not gettext (thus could look &#8220;weird&#8221;), but at least the application can be translated as a whole.</p>
<p>QObject.tr() is your friend <img src='http://blog.venthur.de/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p>
]]></content:encoded>
	</item>
</channel>
</rss>
