<?xml version='1.0' encoding='utf-8' ?>
<!--  If you are running a bot please visit this policy page outlining rules you must respect. http://www.livejournal.com/bots/  -->
<rss version='2.0' xmlns:lj='http://www.livejournal.org/rss/lj/1.0/' xmlns:media='http://search.yahoo.com/mrss/'>
<channel>
  <title>Theppitak Karoonboonyanan</title>
  <link>http://theppitak.livejournal.com/</link>
  <description>Theppitak Karoonboonyanan - LiveJournal.com</description>
  <lastBuildDate>Fri, 22 Aug 2008 07:24:51 GMT</lastBuildDate>
  <generator>LiveJournal / LiveJournal.com</generator>
  <lj:journal>theppitak</lj:journal>
  <lj:journalid>6399850</lj:journalid>
  <lj:journaltype>personal</lj:journaltype>
  <image>
    <url>http://l-userpic.livejournal.com/68159662/6399850</url>
    <title>Theppitak Karoonboonyanan</title>
    <link>http://theppitak.livejournal.com/</link>
    <width>100</width>
    <height>100</height>
  </image>

<item>
  <guid isPermaLink='true'>http://theppitak.livejournal.com/851.html</guid>
  <pubDate>Fri, 22 Aug 2008 07:24:51 GMT</pubDate>
  <title>iostream String Formatting Considered Harmful</title>
  <link>http://theppitak.livejournal.com/851.html</link>
  <description>&lt;p&gt;When learning to code in C++, I was convinced by the advantage of iostream over C printf, such as better type checking. C++ syntactic features have been used to devise the stream operators and manipulators to match what printf provides. But one important thing is missing: format string localization.&lt;/p&gt;

&lt;p&gt;Some examples are shown in &lt;a href=&quot;http://bugzilla.gnome.org/show_bug.cgi?id=548950&quot;&gt;GNOME #548950&lt;/a&gt; for Ekiga trunk.&lt;/p&gt;

&lt;p&gt;For example, to print how many users are found online, with printf and gettext we get (plural form is omitted here for simplicity):&lt;/p&gt;

&lt;pre&gt;
  printf (_(&quot;%d users found\n&quot;), nUsers);
&lt;/pre&gt;

&lt;p&gt;But with iostream we get:&lt;/p&gt;

&lt;pre&gt;
  std::cout &amp;lt;&amp;lt; nUsers &amp;lt;&amp;lt; &quot; &quot; &amp;lt;&amp;lt; _(&quot;users found&quot;) &amp;lt;&amp;lt; std::endl;
&lt;/pre&gt;

&lt;p&gt;In printf case, translators are free to reorder words according to different grammars. For example, in case of Thai, it can be translated like:&lt;/p&gt;

&lt;pre&gt;
  msgid &quot;%d users found\n&quot;
  msgstr &quot;พบผู้ใช้ %d คน\n&quot;
&lt;/pre&gt;

&lt;p&gt;(Literally, the Thai msgstr reads &quot;found users %d persons&quot;.)&lt;/p&gt;

&lt;p&gt;But this is impossible for iostream case. One must end up with very weird language usage like:

&lt;pre&gt;
  msgid &quot;users found&quot;
  msgstr &quot;ผู้ใช้ถูกพบ&quot;
&lt;/pre&gt;

&lt;p&gt;(Thai msgstr here literally reads &quot;users are found&quot;.)&lt;/p&gt;

&lt;p&gt;And &quot;3 ผู้ใช้ถูกพบ&quot; sounds weird and unnatural to Thai readers. That is, with iostream, word orders in messages are tied to English.&lt;/p&gt;

&lt;p&gt;I don&apos;t know how to solve this with iostream. It seems beyond what C++ syntax can achieve.&lt;/p&gt;

&lt;p&gt;When combined with &lt;a href=&quot;http://lists.debian.org/debian-mentors/2008/03/msg00265.html&quot;&gt;another case&lt;/a&gt; I found when working with POSIX file descriptor, for which fstream constructor has been dropped from C++ standard library, using iostream is simply a wrong decision in the first place. And the solution is to migrate the file manipulating codes to plain stdio C library.&lt;/p&gt;

&lt;p&gt;Lesson learned: Don&apos;t use C++ iostream unless you really have limited use cases.&lt;/p&gt;</description>
  <comments>http://theppitak.livejournal.com/851.html</comments>
  <category>localization</category>
  <category>c++</category>
  <category>programming</category>
  <lj:security>public</lj:security>
  <lj:reply-count>5</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://theppitak.livejournal.com/748.html</guid>
  <pubDate>Mon, 14 Mar 2005 07:03:14 GMT</pubDate>
  <title>What aspects to consider if a language is &quot;supported&quot;?</title>
  <link>http://theppitak.livejournal.com/748.html</link>
  <description>&lt;p&gt;FOSS is great. It allows any interested party to join and modify software to serve their needs, including local language supports.&lt;/p&gt;

&lt;p&gt;In many cultures, including Thai, people are happy reading English messages in applications, but require applications to allow creating and editing &quot;contents&quot; in their own languages. For these cultures, language supports in infrastructure for text input, text rendering and printing, and some internal operations like sorting and text analysis, are essential, while message translation is optional.&lt;/p&gt;

&lt;p&gt;So, when asked if Thai is supported by GNOME, I&apos;d answer yes, because, through many development efforts in the past, you can now:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt; Type Thai text in GNOME applications, with input sequence checking, and even
      correction (with &lt;a href=&quot;http://linux.thai.net/~thep/th-xim/&quot;&gt;Thai XIM&lt;/a&gt; and GTK+ im-xim
      bridge). &lt;/li&gt;
  &lt;li&gt; See Thai text with quality rendering, with even OpenType font support (thanks to the 
      &lt;a href=&quot;http://www.pango.org/&quot;&gt;Pango&lt;/a&gt; project). &lt;/li&gt;
  &lt;li&gt; Read Thai text with proper line wrapping, or even word selection, despite the fact that
      Thai words are not delimited by spaces nor any punctuation marks (thanks to the
      &lt;a href=&quot;http://libthai.sourceforge.net/&quot;&gt;LibThai&lt;/a&gt; project, with the wise API provision
      by &lt;a href=&quot;http://www.pango.org/&quot;&gt;Pango&lt;/a&gt; itself). &lt;/li&gt;
  &lt;li&gt; Sort Thai words in applications according to the standard dictionary, as well as other
      cultural conventions such as date/time format (thanks to the
      &lt;a href=&quot;http://linux.thai.net/~thep/th-locale/&quot;&gt;Thai Locale&lt;/a&gt; project). &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Unfortunately, &lt;a href=&quot;http://l10n-status.gnome.org/gnome-2.10/th/index.html&quot;&gt;Thai message
translation&lt;/a&gt; in GNOME 2.10 is still far from complete. So, it&apos;s not listed as a
&quot;&lt;a href=&quot;http://www.gnome.org/start/2.10/notes/rni18.html&quot;&gt;supported&lt;/a&gt;&quot; language.
But the fact is that many Thai people just don&apos;t care about message translation.&lt;/p&gt;

&lt;p&gt;Nothing to complain here. Just a notice that my definition of &quot;language support&quot; might be
different from the official one. :-)&lt;/p&gt;</description>
  <comments>http://theppitak.livejournal.com/748.html</comments>
  <lj:security>public</lj:security>
  <lj:reply-count>0</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://theppitak.livejournal.com/288.html</guid>
  <pubDate>Fri, 11 Mar 2005 16:23:08 GMT</pubDate>
  <title>Welcome to my blog</title>
  <link>http://theppitak.livejournal.com/288.html</link>
  <description>Welcome to my live journal. This is a first post.&lt;br /&gt;ยินดีต้อนรับสู่ blog ของผม นี่คือการทดสอบ (จาก drivel)</description>
  <comments>http://theppitak.livejournal.com/288.html</comments>
  <lj:mood>happy</lj:mood>
  <lj:security>public</lj:security>
  <lj:reply-count>1</lj:reply-count>
</item>
</channel>
</rss>
