[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: x-scheme fails to parse multiline strings
From: |
Bruno Haible |
Subject: |
Re: x-scheme fails to parse multiline strings |
Date: |
Fri, 21 Apr 2006 12:21:03 +0200 |
User-agent: |
KMail/1.5 |
Tim Janik wrote:
> hi Bruno.
>
> looks like you're the last person who hacked on x-scheme.c in gettext,
> so i'm emailing you.
That's ok, but the normal address for bug reports regarding xgettext is still
the address mentioned in the "xgettext --help" output.
> i'm maitaining a project with a couple scheme
> files (beast.gtk.org) and need proper translation support for them.
> similar to what i can do in my .c, .cc and .idl files.
> i'm currently using a hacked up version of intltool to achive this,
> because xgettext has some problems in extracting strings from my
> scheme files. here's an excerpt:
>
> (bse-script-register 'mixer-splitup-by-track
> ""
> (N_ "/Song/Assign Tracks to individual Mixer
> Busses") (N_ "This script creates a new Mixer Bus for each track in the "
> "song that is currently using the Master Bus as output.") "Stefan
> Westerfeld"
> "GNU General Public License"
> (bse-param-song (N_ "Song")))
> [...]
> (if (not (bse-is-song song))
> (bse-exit-error 'text1 (_ "No valid song supplied")))
>
> this yields when parsed with xgettext like this:
> xgettext --add-comments --keyword=_ --keyword=N_ -o -
> these messages:
>
> #: /usr/src/beast/library/scripts/mixer-splitup-by-track.scm:25
> msgid "/Song/Assign Tracks to individual Mixer Busses"
> msgstr ""
>
> #: /usr/src/beast/library/scripts/mixer-splitup-by-track.scm:26
> msgid "This script creates a new Mixer Bus for each track in the "
> msgstr ""
>
> #: /usr/src/beast/library/scripts/mixer-splitup-by-track.scm:30
> #: /usr/src/beast/library/scripts/song-parts-operations.scm:30
> #: /usr/src/beast/library/scripts/song-parts-operations.scm:39
> msgid "Song"
> msgstr ""
>
> #: /usr/src/beast/library/scripts/mixer-splitup-by-track.scm:57
> #: /usr/src/beast/library/scripts/song-parts-operations.scm:45
> msgid "No valid song supplied"
> msgstr ""
>
> while it should yield (excerpt from beasts de.po):
>
> #: ../library/scripts/mixer-splitup-by-track.scm.h:25
> msgid "/Song/Assign Tracks to individual Mixer Busses"
> msgstr ""
>
> #: ../library/scripts/mixer-splitup-by-track.scm.h:26
> msgid ""
> "This script creates a new Mixer Bus for each track in the song that is
> " "currently using the Master Bus as output."
> msgstr ""
>
> #: ../library/scripts/mixer-splitup-by-track.scm.h:30
> #: ../library/scripts/song-parts-operations.scm.h:30
> #: ../library/scripts/song-parts-operations.scm.h:39
> msgid "Song"
> msgstr "Titel"
>
> #: ../library/scripts/mixer-splitup-by-track.scm.h:57
> #: ../library/scripts/song-parts-operations.scm.h:45
> #, fuzzy
> msgid "No valid song supplied"
> msgstr "Synthesemodule"
>
>
> i.e. it looks like multiline strings are not treated correctly by
> xgettext. this is using xgettext from debian stable, i.e.:
> xgettext (GNU gettext-tools) 0.14.4.
This is normal. The code that you wrote doesn't use multiline strings;
instead your N_ appears to be a function that receives 1 or 2 (or more?)
strings and concatenates them.
By multiline strings, I understand strings with embedded newlines (these
are allowed in Scheme, see
http://www.schemers.org/Documents/Standards/R5RS/HTML/r5rs-Z-H-10.html#%_sec_7.1.1)
xgettext extracts them correctly, preserving the newlines correctly:
======================= foo.scm ===========================
(bse-script-register 'mixer-splitup-by-track
""
(N_ "/Song/Assign Tracks to individual Mixer Busses")
(N_ "This script creates a new Mixer Bus for each track
in the
song that is currently using the Master Bus as output.")
"Stefan Westerfeld"
"GNU General Public License"
(bse-param-song (N_ "Song")))
[...]
(if (not (bse-is-song song))
(bse-exit-error 'text1 (_ "No valid song supplied")))
=============================================================
$ xgettext --keyword=_ --keyword=N_ -o - foo.scm
...
#: foo.scm:4
msgid ""
"This script creates a new Mixer Bus for each track in the\n"
"song that is currently using the Master Bus as output."
msgstr ""
> is there anything i can help with to get this fixed?
xgettext does not support automatic concatenation of strings, because this
is a feature rarely found in languages of the Lisp family.
You can of course modify xgettext so that it concatenates all arguments to
a particular function. But IMO it would be easier to just concatenate the
two strings in the Scheme source code.
Bruno
- Re: x-scheme fails to parse multiline strings,
Bruno Haible <=