From: Ethan B. <ebl...@cs...> - 2006-11-05 02:06:17
|
Javier Fern=E1ndez-Sanguino Pe=F1a spake unto us the following wisdom: > In Debian (well, in the Debian Installer) we have used brackets in the PO > strings to disambiguate strings. The po-debconf tool (which is > Debian-specific) strips the brackets from PO strings so that they are not > used on program output). So, you could have this: >=20 > msgid "none[Refers to a man]" > msgstr "ninguno" >=20 > msgid "none[Refers to a woman]" > msgstr "ninguna" >=20 > [ Note: this is an example of a word which refers to a gender ] >=20 > Brackets are, however, currently used in some msgid's in Gaim. Maybe you > could use a different bracket (maybe {} ?) that would get removed somehow? This is similar to the best proposal I've seen. What if we set up some sort of extremely unlikely delineation (e.g., [NB: <string>]), and then insert a pre-gettext function to be used for such strings, which strips that marker if it exists afater calling gettext? That is to say[1]: const char *gaim_annotated_string(const char *str) { static char *buf; static int blen; const char *tstr; const char *f, *t, *note; int len; tstr =3D _(str); if ((note =3D strstr(tstr, "[NB: ")) =3D=3D NULL) return tstr; len =3D strlen(tstr); if (buf =3D=3D NULL || blen < len) { buf =3D realloc(buf, len); blen =3D len; } f =3D tstr; t =3D buf; do { strncpy(t, f, note - f); t +=3D note - f; if ((f =3D strstr(f, "]") !=3D NULL) f++; } while (f && *f); t =3D '\0'; return t; } Then: gaim_annotated_string("Foo[NB: Adjective]"); > > If we switch, are we going to break lots of translations? It seems like > > we could fix things up with some careful sed'ing of the .po files, > > though. >=20 > I wouldn't mind if some strings got fuzzy because of this, that would mak= e me > review if I translated them correctly. I agree -- we're actually lucky that Ambrose caught such a thing. There could be lurking errors in there, already. Ethan [1] Completely untested, of course -- I didn't even try to compile it. --=20 The laws that forbid the carrying of arms are laws [that have no remedy for evils]. They disarm only those who are neither inclined nor determined to commit crimes. -- Cesare Beccaria, "On Crimes and Punishments", 1764 |