unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* i18n, gettext support?
@ 2004-08-16  8:21 Jan Nieuwenhuizen
  2004-08-16 18:47 ` Rob Browning
  2004-08-17 14:16 ` Andreas Rottmann
  0 siblings, 2 replies; 13+ messages in thread
From: Jan Nieuwenhuizen @ 2004-08-16  8:21 UTC (permalink / raw)


Hi,

What's the preferred way to internationalise GUILE code?

I found a short two year old thread on guile-user, that stops short
with a patch that fails.

For the upcoming LilyPond 3.0, we have moved even more functionality
from C++ to guile, and along with this messages that are exposed to
the user.  These need to be ornamented and translated.

I'm wondering whether we should duplicate a list of all messages in C
code for xgettext to find, and do all printing of user messages
through a C gettext wrapper?

Greetings,
Jan.

-- 
Jan Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond - The music typesetter
http://www.xs4all.nl/~jantien       | http://www.lilypond.org


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: i18n, gettext support?
  2004-08-16  8:21 i18n, gettext support? Jan Nieuwenhuizen
@ 2004-08-16 18:47 ` Rob Browning
  2004-08-17  1:49   ` Kevin Ryde
  2004-08-17 14:16 ` Andreas Rottmann
  1 sibling, 1 reply; 13+ messages in thread
From: Rob Browning @ 2004-08-16 18:47 UTC (permalink / raw)
  Cc: guile-devel

Jan Nieuwenhuizen <janneke@gnu.org> writes:

> What's the preferred way to internationalise GUILE code?

I don't think there is one yet.

> I'm wondering whether we should duplicate a list of all messages in C
> code for xgettext to find, and do all printing of user messages
> through a C gettext wrapper?

You might want to take a look at gnucash.  I forget how it was done
there, but it *was* done.  My recollection is that we had something
like (_ foo) on the scheme side and it handled interfacing with
gettext, but I didn't work on that myself.

-- 
Rob Browning
rlb @defaultvalue.org and @debian.org; previously @cs.utexas.edu
GPG starting 2002-11-03 = 14DD 432F AE39 534D B592  F9A0 25C8 D377 8C7E 73A4


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: i18n, gettext support?
  2004-08-16 18:47 ` Rob Browning
@ 2004-08-17  1:49   ` Kevin Ryde
  2004-08-18 14:40     ` Jan Nieuwenhuizen
  0 siblings, 1 reply; 13+ messages in thread
From: Kevin Ryde @ 2004-08-17  1:49 UTC (permalink / raw)
  Cc: guile-devel, Jan Nieuwenhuizen

Rob Browning <rlb@defaultvalue.org> writes:
>
> something like (_ foo) on the scheme side

Yes, xgettext recognises that, I tinkered with it for some messages to
be shown by gtk.

gtk uses utf8, and it worked fine to translate and pass strings with
those bytes.  But without guile properly understanding multi-byte
strings it's a bit limited.

An interface to the gettext calls would be good now for 8-bit locales,
even if something sophisticated for multibyte has to wait.


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: i18n, gettext support?
  2004-08-16  8:21 i18n, gettext support? Jan Nieuwenhuizen
  2004-08-16 18:47 ` Rob Browning
@ 2004-08-17 14:16 ` Andreas Rottmann
  2004-08-17 15:24   ` Matthias Koeppe
  2004-08-17 22:46   ` Kevin Ryde
  1 sibling, 2 replies; 13+ messages in thread
From: Andreas Rottmann @ 2004-08-17 14:16 UTC (permalink / raw)


Jan Nieuwenhuizen <janneke@gnu.org> writes:

> Hi,
>
> What's the preferred way to internationalise GUILE code?
>
> I found a short two year old thread on guile-user, that stops short
> with a patch that fails.
>
> For the upcoming LilyPond 3.0, we have moved even more functionality
> from C++ to guile, and along with this messages that are exposed to
> the user.  These need to be ornamented and translated.
>
> I'm wondering whether we should duplicate a list of all messages in C
> code for xgettext to find, and do all printing of user messages
> through a C gettext wrapper?
>
A related (to i18n) issue: it would be nice to have positional
argument support in (ice-9 format); e.g.:

(format #t "~@2A ~@1A" "World!" "Hello")

would print "Hello World!". I just took @ as a position 'prefix',
since according to the docs, it is not taken yet. Alternative syntax
suggestions welcome. Why do you need this? Say you have a help message
format string "This is ~A ~A". When translated to another language,
the order of the arguments in the help message might be reversed
(yeah, I'm too lame to come up with a real example, but this happens,
trust me ;). 

What do you think about adding such a feature?

Andy
-- 
Andreas Rottmann         | Rotty@ICQ      | 118634484@ICQ | a.rottmann@gmx.at
http://yi.org/rotty      | GnuPG Key: http://yi.org/rotty/gpg.asc
Fingerprint              | DFB4 4EB4 78A4 5EEE 6219  F228 F92F CFC5 01FD 5B62

Software Patents: Where do you want to stifle inovation today?



_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: i18n, gettext support?
  2004-08-17 14:16 ` Andreas Rottmann
@ 2004-08-17 15:24   ` Matthias Koeppe
  2004-08-18 12:54     ` Andreas Rottmann
  2004-08-17 22:46   ` Kevin Ryde
  1 sibling, 1 reply; 13+ messages in thread
From: Matthias Koeppe @ 2004-08-17 15:24 UTC (permalink / raw)
  Cc: guile-devel

Andreas Rottmann <a.rottmann@gmx.at> writes:

> A related (to i18n) issue: it would be nice to have positional
> argument support in (ice-9 format); e.g.:
>
> (format #t "~@2A ~@1A" "World!" "Hello")
>
> would print "Hello World!". I just took @ as a position 'prefix',
> since according to the docs, it is not taken yet. Alternative syntax
> suggestions welcome. 

This is already possible with the ~@* format directive, see
http://www.lispworks.com/reference/HyperSpec/Body/22_cga.htm 

     (format #t "~1@*~A ~0@*~A ~2@*" "World!" "Hello")

(The final ~2@* is necessary because Guile otherwise complains about
"1 superfluous argument". )

-- 
Matthias Koeppe -- http://www.math.uni-magdeburg.de/~mkoeppe


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: i18n, gettext support?
  2004-08-17 14:16 ` Andreas Rottmann
  2004-08-17 15:24   ` Matthias Koeppe
@ 2004-08-17 22:46   ` Kevin Ryde
  1 sibling, 0 replies; 13+ messages in thread
From: Kevin Ryde @ 2004-08-17 22:46 UTC (permalink / raw)
  Cc: guile-devel

Andreas Rottmann <a.rottmann@gmx.at> writes:
>
> I just took @ as a position 'prefix',
> since according to the docs, it is not taken yet.

Actually it is taken, see latest greatly expanded docs :-).


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: i18n, gettext support?
  2004-08-17 15:24   ` Matthias Koeppe
@ 2004-08-18 12:54     ` Andreas Rottmann
  2004-08-19  1:10       ` Kevin Ryde
  0 siblings, 1 reply; 13+ messages in thread
From: Andreas Rottmann @ 2004-08-18 12:54 UTC (permalink / raw)
  Cc: guile-devel

Matthias Koeppe <mkoeppe@mail.math.uni-magdeburg.de> writes:

> Andreas Rottmann <a.rottmann@gmx.at> writes:
>
>> A related (to i18n) issue: it would be nice to have positional
>> argument support in (ice-9 format); e.g.:
>>
>> (format #t "~@2A ~@1A" "World!" "Hello")
>>
>> would print "Hello World!". I just took @ as a position 'prefix',
>> since according to the docs, it is not taken yet. Alternative syntax
>> suggestions welcome. 
>
> This is already possible with the ~@* format directive, see
> http://www.lispworks.com/reference/HyperSpec/Body/22_cga.htm 
>
>      (format #t "~1@*~A ~0@*~A ~2@*" "World!" "Hello")
>
> (The final ~2@* is necessary because Guile otherwise complains about
> "1 superfluous argument". )
>
Thanks for pointing this out (I've misread the documentation). Maybe
the "superfluous argument" error should be disabled when you use @*?

Andi
-- 
Andreas Rottmann         | Rotty@ICQ      | 118634484@ICQ | a.rottmann@gmx.at
http://yi.org/rotty      | GnuPG Key: http://yi.org/rotty/gpg.asc
Fingerprint              | DFB4 4EB4 78A4 5EEE 6219  F228 F92F CFC5 01FD 5B62

Make free software, not war!


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: i18n, gettext support?
  2004-08-17  1:49   ` Kevin Ryde
@ 2004-08-18 14:40     ` Jan Nieuwenhuizen
  0 siblings, 0 replies; 13+ messages in thread
From: Jan Nieuwenhuizen @ 2004-08-18 14:40 UTC (permalink / raw)
  Cc: guile-devel

Kevin Ryde writes:

>> something like (_ foo) on the scheme side
>
> Yes, xgettext recognises that, I tinkered with it for some messages to
> be shown by gtk.

Thank you both.  I submitted a patch for xgettext to recognise .scm
and use the Lisp parser (no offence intended :-)

> An interface to the gettext calls would be good now for 8-bit locales,
> even if something sophisticated for multibyte has to wait.

Ok, I just wrapped the C gettext from LilyPond for now.

Jan.

-- 
Jan Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond - The music typesetter
http://www.xs4all.nl/~jantien       | http://www.lilypond.org


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: i18n, gettext support?
  2004-08-18 12:54     ` Andreas Rottmann
@ 2004-08-19  1:10       ` Kevin Ryde
  2004-08-19  8:07         ` Matthias Koeppe
  0 siblings, 1 reply; 13+ messages in thread
From: Kevin Ryde @ 2004-08-19  1:10 UTC (permalink / raw)
  Cc: Matthias Koeppe, guile-devel

Andreas Rottmann <a.rottmann@gmx.at> writes:
>
> Maybe
> the "superfluous argument" error should be disabled when you use @*?

Arguably that'd make sense, but I think common lisp says you have to
jump to the end.  (Which is why I put that in the docs, under "~*".)


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: i18n, gettext support?
  2004-08-19  1:10       ` Kevin Ryde
@ 2004-08-19  8:07         ` Matthias Koeppe
  2004-08-20  1:17           ` Kevin Ryde
  0 siblings, 1 reply; 13+ messages in thread
From: Matthias Koeppe @ 2004-08-19  8:07 UTC (permalink / raw)
  Cc: guile-devel

Kevin Ryde <user42@zip.com.au> writes:

> Andreas Rottmann <a.rottmann@gmx.at> writes:
>>
>> Maybe
>> the "superfluous argument" error should be disabled when you use @*?
>
> Arguably that'd make sense, but I think common lisp says you have to
> jump to the end.  (Which is why I put that in the docs, under "~*".)

Actually, from the Common Lisp HyperSpec:

| 22.3.10.2 Missing and Additional FORMAT Arguments
| 
| The consequences are undefined if no arg remains for a directive
| requiring an argument. However, it is permissible for one or more
| args to remain unprocessed by a directive; such args are ignored.

So maybe the check for superfluous arguments should be disabled in
Guile (whether ~@* is used or not).  It's not a very important issue,
though; I'd say it's OK do deviate from CL here if it's documented.

-- 
Matthias Koeppe -- http://www.math.uni-magdeburg.de/~mkoeppe


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: i18n, gettext support?
  2004-08-19  8:07         ` Matthias Koeppe
@ 2004-08-20  1:17           ` Kevin Ryde
  2004-08-24 17:12             ` Marius Vollmer
  0 siblings, 1 reply; 13+ messages in thread
From: Kevin Ryde @ 2004-08-20  1:17 UTC (permalink / raw)
  Cc: Andreas Rottmann, guile-devel

Matthias Koeppe <mkoeppe@merkur.math.uni-magdeburg.de> writes:
>
> | However, it is permissible for one or more
> | args to remain unprocessed by a directive; such args are ignored.

I must have misread that bit.  Or didn't read it properly and assumed
the code knew what it was doing.

> So maybe the check for superfluous arguments should be disabled in
> Guile (whether ~@* is used or not).

Sounds fair.  CL is the model for this stuff, there's nothing gained
by deviating from it for no particular reason.


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: i18n, gettext support?
  2004-08-20  1:17           ` Kevin Ryde
@ 2004-08-24 17:12             ` Marius Vollmer
  2004-09-01 23:31               ` Kevin Ryde
  0 siblings, 1 reply; 13+ messages in thread
From: Marius Vollmer @ 2004-08-24 17:12 UTC (permalink / raw)
  Cc: Andreas Rottmann, guile-devel

Kevin Ryde <user42@zip.com.au> writes:

>> So maybe the check for superfluous arguments should be disabled in
>> Guile (whether ~@* is used or not).
>
> Sounds fair.  CL is the model for this stuff, there's nothing gained
> by deviating from it for no particular reason.

I agree.


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: i18n, gettext support?
  2004-08-24 17:12             ` Marius Vollmer
@ 2004-09-01 23:31               ` Kevin Ryde
  0 siblings, 0 replies; 13+ messages in thread
From: Kevin Ryde @ 2004-09-01 23:31 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 69 bytes --]

I removed this bit to ignore excess arguments, I think it's enough.


[-- Attachment #2: format.scm.excess.diff --]
[-- Type: text/plain, Size: 517 bytes --]

--- format.scm.~1.23.~	2004-09-02 09:15:16.000000000 +1000
+++ format.scm	2004-09-02 09:27:37.000000000 +1000
@@ -194,10 +194,6 @@
 	  (let ((arg-pos (format:format-work fmt args))
 		(arg-len (length args)))
 	    (cond
-	     ((< arg-pos arg-len)
-	      (set! format:arg-pos (+ arg-pos 1))
-	      (set! format:pos (string-length fmt))
-	      (format:error "~a superfluous argument~:p" (- arg-len arg-pos)))
 	     ((> arg-pos arg-len)
 	      (set! format:arg-pos (+ arg-len 1))
 	      (display format:arg-pos)

[-- Attachment #3: Type: text/plain, Size: 143 bytes --]

_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2004-09-01 23:31 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-08-16  8:21 i18n, gettext support? Jan Nieuwenhuizen
2004-08-16 18:47 ` Rob Browning
2004-08-17  1:49   ` Kevin Ryde
2004-08-18 14:40     ` Jan Nieuwenhuizen
2004-08-17 14:16 ` Andreas Rottmann
2004-08-17 15:24   ` Matthias Koeppe
2004-08-18 12:54     ` Andreas Rottmann
2004-08-19  1:10       ` Kevin Ryde
2004-08-19  8:07         ` Matthias Koeppe
2004-08-20  1:17           ` Kevin Ryde
2004-08-24 17:12             ` Marius Vollmer
2004-09-01 23:31               ` Kevin Ryde
2004-08-17 22:46   ` Kevin Ryde

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).