UTF-8 strings; plurals; qt-format



Hey all,

first, thanks to Gabor Kelemen for clarifying the .pot file issue.
I've got three more questions, however (please bear with me).

I'm planning to change the regexxer source code to use UTF-8 directly in
message strings.  Christian Rose recommended to do this a while ago (now
that's an understatement), which would enable regexxer to wish the en.po
"translation" good riddance.

Shall I do so?  This would require changes to each and every .po file,
of course.  Would it be alright if I do a mass search/replace on all .po
files myself?  (Of course using regexxer itself for the job!)  Come to
think of it, if I do the mass search replace I might as well commit the
results of intltool-update, no?  Please advise, I really don't want to
disrupt anybody's work.

Now to the second question.  Right now I'm not using ngettext() in
regexxer, but will happily do so if it turns out to be necessary.  The
problem is, I'm not sure what to do about a string like this:

    #: ../src/mainwindow.cc:476
    #, qt-format
    msgid ""
    "Error in regular expression at \"%1\" (index %2):\n"
    "%3"

%1 and %2 are placeholders for numbers.  The way this message is
phrased, I know of no language that requires different wording depending
on the value of the numbers.  But as you probably have already guessed,
I don't know an awful lot of languages -- to put it mildly.

So, is ngettext() required here?  If it is, I'll probably have to move
the "(index %2)" to a separate string as well, in order to avoid
quadratic explosion.  What's your stance?

The third issue I'd like to bring up is actually more of an
informational notice than a question.  In regexxer, I use qt-format for
placeholders in message strings.  Actually I didn't realize that the
notation matches qt-format until after I implemented it, but it's great
to know that it's some sort of standard and is specifically supported by
xgettext, too.

In a nutshell, qt-format uses only numeric placeholders like %1, %2, %3,
and so on, with %% denoting a literal %.  The qt-format is more suited
to the C++ language than printf-style formatting, and has some other
advantages beside type-safety, too:

        You can't make it crash.  With my implementation, the most
        critical thing that can happen is a runtime warning if the index
        following "%" is out of bounds or not a digit at all.

        You can reorder substitutions!  This isn't possible with
        standard C89 printf without implementation-specific extensions.
        You could even reference an index more than once or not at all,
        but that probably isn't useful.

Looking through the .po files for regexxer, I noticed that as of yet no
translation actually makes use of the reordering feature.  Of course
this could be because the default order happened to be just fine for all
translations currently available for regexxer.  But it might also be the
case that the translators are simply not aware of the possibility, and
that's why I'm writing this notice.

Sorry for the looong mail.  I do hope that's about all I need to know
for a while.

Thanks and cheers,
--Daniel




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]