From owner-freebsd-libh Sat Jun 8 9:51: 7 2002 Delivered-To: freebsd-libh@freebsd.org Received: from tomts9-srv.bellnexxia.net (tomts9.bellnexxia.net [209.226.175.53]) by hub.freebsd.org (Postfix) with ESMTP id 33AC037B404 for ; Sat, 8 Jun 2002 09:51:03 -0700 (PDT) Received: from shall.anarcat.ath.cx ([65.94.178.175]) by tomts9-srv.bellnexxia.net (InterMail vM.5.01.04.19 201-253-122-122-119-20020516) with ESMTP id <20020608165102.ESLM21842.tomts9-srv.bellnexxia.net@shall.anarcat.ath.cx> for ; Sat, 8 Jun 2002 12:51:02 -0400 Received: from lenny.anarcat.ath.cx (lenny.anarcat.ath.cx [192.168.0.4]) by shall.anarcat.ath.cx (Postfix) with SMTP id 15EE15 for ; Sat, 8 Jun 2002 12:55:30 -0400 (EDT) Received: by lenny.anarcat.ath.cx (sSMTP sendmail emulation); Sat, 8 Jun 2002 12:49:15 -0400 Date: Sat, 8 Jun 2002 12:49:15 -0400 From: The Anarcat To: Libh Subject: i18n tools Message-ID: <20020608164915.GA292@lenny.anarcat.ath.cx> Mail-Followup-To: The Anarcat , Libh Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="/9DWx/yDrRhgMJTb" Content-Disposition: inline User-Agent: Mutt/1.3.99i Sender: owner-freebsd-libh@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG --/9DWx/yDrRhgMJTb Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi. I've read through the man pages of cat*(3) stuff and, well, I'm not sure it's suitable for libh. The reason is this: contrary to gettext, catgets(3) doesn't index the messages per string, but per a single msg_id (int): char * catgets(nl_catd catd, int set_id, int msg_id, const char *s); That would mean that translation calls would be made like this: catgets(catd, 0, x, "Monkey"); where x is an arbitrary number defined in the catalog file generated via gencat. So this would mean having either (a) arbitrary numbers for messages all around the place, or (b) making a header file containing macros to give proper names to these numbers. (a) is out of the question, of course, because of the size of the project. (b) is realizable, but still hard to manage anyhow. I thought at first that the -h option of gencat could do (b), but it seems it just generates 2 odd macros I didn't figure out yet: /* Use these Macros to compose and decompose setId's and msgId's */ #ifndef MCMakeId # define MCMakeId(s,m) (unsigned long)(((unsigned short)s<<(sizeof(short)*8= ))\ |(unsigned short)m) # define MCSetId(id) (unsigned int) (id >> (sizeof(short) * 8)) # define MCMsgId(id) (unsigned int) ((id << (sizeof(short) * 8))\ >> (sizeof(short) * 8)) #endif I guess those could be used to generate msg_ids from strings, but that doesn't make a lot of sense. So we have 3 alternatives to the system's i18n facilities: 1- use GNU gettext: one more dependency, and a GNU one, but tried-and-tested software that's easily scalable to our needs. 2- use Citrus project's BSD gettext replacement: not fully implemented, seems we would still need GNU gettext to generate the catalogs 3- make our own wrappers to catgets(3): would take time and create problems I'm open to suggestions. I'm not sure that going the catgets(3) direction is the easiest one, but it's a portable one, and we limit our dependencies this way. But we'll have a hell of a time implementing this one. I'm putting this thing back on hold until we have figured this out. A. --=20 The idea that Bill Gates has appeared like a knight in shining armour to lead all customers out of a mire of technological chaos neatly ignores the fact that it was he who, by peddling second-rate technology, led them into it in the first place. - Douglas Adams (1952-2001) --/9DWx/yDrRhgMJTb Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (FreeBSD) iD8DBQE9AjWKttcWHAnWiGcRAuZSAJ9VqbFWAE0NmFt6WrfzRsXhkEfkEwCeJ+1r Pz72GQBhYBRAc0CU8WmKxX0= =GxRR -----END PGP SIGNATURE----- --/9DWx/yDrRhgMJTb-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-libh" in the body of the message