From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by c5ff346549e7 (Postfix) with ESMTP id DF4225D4 for ; Tue, 2 Jul 2019 16:20:29 +0000 (UTC) X-IronPort-AV: E=Sophos;i="5.63,443,1557180000"; d="asc'?scan'208";a="390094541" Received: from sympa.inria.fr ([193.51.193.213]) by mail2-relais-roc.national.inria.fr with ESMTP; 02 Jul 2019 18:20:28 +0200 Received: by sympa.inria.fr (Postfix, from userid 20132) id 48AD2826E3; Tue, 2 Jul 2019 18:20:28 +0200 (CEST) Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id A7E578247D for ; Tue, 2 Jul 2019 17:25:49 +0200 (CEST) Authentication-Results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=louis.gesbert@ocamlpro.com; spf=Pass smtp.mailfrom=louis.gesbert@ocamlpro.com; spf=None smtp.helo=postmaster@shimeji.antislash.info IronPort-PHdr: =?us-ascii?q?9a23=3Au1Xsch9cmx3KS/9uRHKL819IXTAuvvDPBiBQ8oAu?= =?us-ascii?q?0u4cda+q+pD6JkuZ7vJo3geQANfrrslcgu+TiJjOHGwN5ZHb7CIZcJ1JWh0Ez8?= =?us-ascii?q?wQgw07BMeeCQv6KvDtPXRjTZZyEWR99nT+CnB7XcP3ZlncuHq3tGJAHR72MA5t?= =?us-ascii?q?POOzEYnX3Z26?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0DRAAApdhtd/85JiU9mGgEBAQEBAgEBA?= =?us-ascii?q?QEHAgEBAQGBZ4FtgRRRIRIojReMCBKOUoJYiTEJAQMBBwUlBwECAQGBS4J1AoI?= =?us-ascii?q?0BwEENBMBAwEBBAEBAgECA22KNwyFSwEFeRALGAklDwFHBgESgyOCDgumSoh6g?= =?us-ascii?q?TcQgTSBUYtlP4ERgxI+gkgZAgKFG4ImBIwNnigHAoIYXQSFc4RqiFoMgh+HG4N?= =?us-ascii?q?WilGNMIc8kBiBZyGBWDMaI1CCbAmCRBeBAwEIgkKKVUAwgQYBAY4jAQE?= X-IPAS-Result: =?us-ascii?q?A0DRAAApdhtd/85JiU9mGgEBAQEBAgEBAQEHAgEBAQGBZ4F?= =?us-ascii?q?tgRRRIRIojReMCBKOUoJYiTEJAQMBBwUlBwECAQGBS4J1AoI0BwEENBMBAwEBB?= =?us-ascii?q?AEBAgECA22KNwyFSwEFeRALGAklDwFHBgESgyOCDgumSoh6gTcQgTSBUYtlP4E?= =?us-ascii?q?RgxI+gkgZAgKFG4ImBIwNnigHAoIYXQSFc4RqiFoMgh+HG4NWilGNMIc8kBiBZ?= =?us-ascii?q?yGBWDMaI1CCbAmCRBeBAwEIgkKKVUAwgQYBAY4jAQE?= X-IronPort-AV: E=Sophos;i="5.63,443,1557180000"; d="asc'?scan'208";a="390078586" X-MGA-submission: =?us-ascii?q?MDFE+ZqqZ32ezbwQMq4fMxZsOvA0HYgZ/ccZ59?= =?us-ascii?q?YcPqWsy32+uVMe71EEddDbgigc5C7xHkxd304/WhzuaKzNbzqOfo8buI?= =?us-ascii?q?5hySBIe0GQmbjPz/guz88rcWeadypminFsqj0Q7rnYqcfNYBQZCLunw8?= =?us-ascii?q?sgW4y1+Fp1JTzr/GLvzw2Yng=3D=3D?= Received: from antislash.info (HELO shimeji.antislash.info) ([79.137.73.206]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Jul 2019 16:31:05 +0200 Received: from localhost (localhost [127.0.0.1]) From: Louis Gesbert To: caml-list@inria.fr, "Richard W.M. Jones" Cc: Anil Madhavapeddy , sylvain@le-gall.net Date: Tue, 02 Jul 2019 16:30:39 +0200 Message-ID: <3729925.sQVOuqHuC6@agaric> Organization: OCamlPro User-Agent: KMail/5.2.3 (Linux/4.9.0-8-amd64; KDE/5.28.0; x86_64; ; ) In-Reply-To: <20190629094350.7mw6gif3vz2qxqwp@annexia.org> References: <20190627134517.hzhbmjkihidxlnkz@annexia.org> <45419C48-63D3-4981-B54C-3EEA1F4A6FE6@recoil.org> <20190629094350.7mw6gif3vz2qxqwp@annexia.org> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart1963979.vYYKcHiKKO"; micalg="pgp-sha256"; protocol="application/pgp-signature" X-Validation-by: louis.gesbert@ocamlpro.com Subject: Re: [Caml-list] camlp4 & OCaml 4.08 Reply-To: Louis Gesbert X-Loop: caml-list@inria.fr X-Sequence: 17667 Errors-to: caml-list-owner@inria.fr Precedence: list Precedence: bulk Sender: caml-list-request@inria.fr X-no-archive: yes List-Id: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: --nextPart1963979.vYYKcHiKKO Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" For what it's worth, Learn-OCaml [1] uses a rather straightfoward way to handle translations through PPX, based on the gettext format. It's a quick hack and the build-system around it could use some cleanup, though, which is the reason why it wasn't released as a library: please consider it a proof of concept that PPX can be used for gettext. - Translatable strings are introduced through [%i "Blah" ] (or [%if "Blah"] for format-strings; advanced uses like changing format parameters order are not supported) - The build extracts these to a separate file at build-time, based on an environment variable `DUMP_POT` [2]. Probably the most dirty part here, and it requires a clean build, but it works... - Then the standard GNU tools can be used to manage the translations [3] - There is a tiny library at runtime that allows choosing the locale; located strings are rewritten to arrays with a lookup based on it (but changing that to something more elaborate like using external resource files should be pretty straightforward) [4]. Louis Gesbert -- OCamlPro [1] https://github.com/ocaml-sf/learn-ocaml/ [2] https://github.com/ocaml-sf/learn-ocaml/blob/master/src/utils/ppx_ocplib_i18n.ml [3] https://github.com/ocaml-sf/learn-ocaml/blob/master/Makefile#L33 [4] https://github.com/ocaml-sf/learn-ocaml/blob/master/src/utils/ocplib_i18n.mli > - Richard W.M. Jones, 29/06/2019 10:43 - > On Sat, Jun 29, 2019 at 10:06:15AM +0100, Anil Madhavapeddy wrote: > > On 27 Jun 2019, at 14:45, Richard W.M. Jones wrote: > > > > > > > > > I know camlp4 is dead and all that, but we've got some software which > > > still uses it. I will probably port it to camlp5 when I have the > > > time, but has anyone got the patch to make camlp4 work with 4.08? > > > > > > To fork the thread slightly, how big are the camlp4 dependencies remaining > > in your codebase, and is there anything we can do to help migrate? > > The dependencies that I care about run through ocaml-gettext. Gettext > is a specific method to make code internationalized and by its nature > it involves deep changes throughout our codebase, so porting away from > ocaml-gettext isn't an option any time soon. However porting > ocaml-gettext to use something else might be. > > ocaml-gettext has a tool which runs over the OCaml source code and > extracts the magic translatable strings, and it's my understanding > that this is the only reason it uses camlp4. AIUI this cannot be done > using ppx's (maybe I'm wrong about that?) but could be done using > camlp5. In fact it was me who did the original port of ocaml-gettext > from old camlp4 (ie. camlp5) to camlp4(!) > > (see libgettext-ocaml/pr_gettext.ml in the OCaml sources) > > > It's pretty exhausting trying to keep camlp4 maintained with a skeleton > > crew, and there appears to be a stubborn tail of packages which aren't > > migrating despite it having been quite a few years since the deprecation. > > I agree, however also changing working code is always a pain and > there's never a good time. > > Rich. > --nextPart1963979.vYYKcHiKKO Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part. Content-Transfer-Encoding: 7Bit -----BEGIN PGP SIGNATURE----- iQEzBAABCAAdFiEEbvv1DIVPNISNNdcMGDmcR4apvJgFAl0bao8ACgkQGDmcR4ap vJg0Tgf/QQ5jnACg0N5DrpCGhN/ja/5yvHJdKcRt+fqkYcR984lSYJjV+ePRZtBW p7PTqQ+CSD5hfIgPHDV7rW88/XzKs1EddZTE5ZoGHTIUGxHY/Prx+8E6nMFXM1hv mYgZ9sdXduXBGk3+7XRdSr7GlQoye1yvQ3HpL1mo81VSWpfaxCgT5/jPK3W7ygYX K+vIszs9o1GhP9airfQaVRjE8devwvu86AJ4uZWCHLQQZWldamppGtYRuP8Rr94Z gUOk4uvS0IzXSvEDACQnGPbtgzw36lCk4q5KUw+Sw7shIdHMYhVk0ciQJBciL0Wu AcMLjkevhRaU9FeW0ira/1ilTKSQtw== =wIjr -----END PGP SIGNATURE----- --nextPart1963979.vYYKcHiKKO--