From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id SAA12496; Thu, 2 May 2002 18:11:53 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id SAA12489 for ; Thu, 2 May 2002 18:11:52 +0200 (MET DST) Received: from leia.mandrakesoft.com (office.mandrakesoft.com [195.68.114.34]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id g42GBqX11779 for ; Thu, 2 May 2002 18:11:52 +0200 (MET DST) Received: by leia.mandrakesoft.com (Postfix, from userid 505) id 1DCFC5B13; Thu, 2 May 2002 18:11:24 +0200 (CEST) To: =?iso-8859-1?q?J=E9r=F4me?= Marant Cc: caml-list@inria.fr Subject: Re: [Caml-list] printf and scanf References: <20020501180052.GA13445@hell.mine.nu> <20020502102557.A1696@fr.thalesgroup.com> From: Pixel Date: 02 May 2002 18:11:24 +0200 In-Reply-To: <20020502102557.A1696@fr.thalesgroup.com> Message-ID: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Jérôme Marant writes: > I've been giving the following example for quite long now: languages > do not always order words the same way. So, sometimes, you need to > reorder parameters in translated strings in order to get a correct > syntax in the targeted language. With printf, you can do it this way: > > fr: " %s %d" > > string -> int > > de: " %2$s %1$d" > > int -> string > > This example shows that if you want a full featured internationalisation, > you cannot state that "you know the type you expect" since you will only > determine it at run-time. this only shows that " %2$s %1$d" is not a valid translation of " %s %d", since they do not have the same type, and would fail at runtime (using this in C would give you a segfault). " %2$d %1$s" with type "string -> int" is a valid translation of " %s %d" this means that not checking the translations could lead to a hole in the type system, and so printf must be prepared to detect type errors (which it currently does :) ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners