From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,c75fd3043cfdcb58 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.66.85.136 with SMTP id h8mr1736415paz.46.1344321721829; Mon, 06 Aug 2012 23:42:01 -0700 (PDT) Path: g9ni142284pbo.0!nntp.google.com!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!ctu-peer!ctu-gate!news.nctu.edu.tw!usenet.stanford.edu!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail From: Adam Beneschan Newsgroups: comp.lang.ada Subject: Re: Formatted IO - Fortran style or similar. Date: Tue, 31 Jul 2012 10:34:44 -0700 (PDT) Organization: http://groups.google.com Message-ID: References: <50164ad8$0$1156$5b6aafb4@news.zen.co.uk> <501706ca$0$1151$5b6aafb4@news.zen.co.uk> <87lii06t5t.fsf@adaheads.sparre-andersen.dk> NNTP-Posting-Host: 66.126.103.122 Mime-Version: 1.0 X-Trace: posting.google.com 1343756084 5875 127.0.0.1 (31 Jul 2012 17:34:44 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 31 Jul 2012 17:34:44 +0000 (UTC) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=66.126.103.122; posting-account=duW0ogkAAABjRdnxgLGXDfna0Gc6XqmQ User-Agent: G2/1.0 X-Received-Bytes: 3432 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Date: 2012-07-31T10:34:44-07:00 List-Id: On Tuesday, July 31, 2012 8:12:37 AM UTC-7, (unknown) wrote: > On Tue, 31 Jul 2012, Jacob Sparre Andersen wrote: >=20 >=20 >=20 > > How would you handle translatable user visible strings - such as > > "Parsing '${file_name}' failed on line ${line_number}." (where "${...}" > > identifies parameter substitutions) - in Ada? >=20 > Why do you need to *substitute* the parameters in the string at all?=20 >=20 > Without substitution, the following seems to work fine: It's not a question of what anyone "needs" or what "works". Yes, this work= s, but I can understand why, for some people, it makes things more readable= to have the string that represents what the output is going to look like a= ll in once nice place, rather than split up into fragments with expressions= in between. I find that sometimes doing it that way is a bit more readabl= e, although I don't have a strong preference. In addition, having a "format" specified as a single entity, with something= to indicate where other values will be substituted, makes it easier and cl= eaner to select between different formats--say you have a table of formats = where each format pertains to a different error message but many of them ha= ve the same types of information substituted in, or a table where each form= at represents the same message but in a different language. Representing a= format as a string constant with some special characters in it isn't the o= nly way to do this, but it's an easy way that is readable and produces good= results if the substitution syntax is simple enough. -- Adam =20 > Ada.Text_IO.Put_Line("Parsing " & File_Name & =20 > " failed on line " & To_String(Line_Number) &=20 > "."); > > Of course, you still have to write your =20 >=20 > function To_String(Line_Number: Line_Number_Type) return String;=20 >=20 > ... or you just use Line_Number'Image.=20