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.224.180.205 with SMTP id bv13mr14619584qab.8.1343920822610; Thu, 02 Aug 2012 08:20:22 -0700 (PDT) Received: by 10.66.89.196 with SMTP id bq4mr4290291pab.26.1343848563182; Wed, 01 Aug 2012 12:16:03 -0700 (PDT) Path: c6ni1680qas.0!nntp.google.com!r1no7986994qas.0!news-out.google.com!g9ni7594066pbo.0!nntp.google.com!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail From: Michael Rohan Newsgroups: comp.lang.ada Subject: Re: Formatted IO - Fortran style or similar. Date: Wed, 1 Aug 2012 12:14:00 -0700 (PDT) Organization: http://groups.google.com Message-ID: <4eea8d29-3ef7-4053-afc3-140a866cc552@googlegroups.com> References: <50164ad8$0$1156$5b6aafb4@news.zen.co.uk> <501706ca$0$1151$5b6aafb4@news.zen.co.uk> <87lii06t5t.fsf@adaheads.sparre-andersen.dk> <87boivrq3a.fsf@adaheads.sparre-andersen.dk> NNTP-Posting-Host: 208.91.2.1 Mime-Version: 1.0 X-Trace: posting.google.com 1343848563 14896 127.0.0.1 (1 Aug 2012 19:16:03 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Wed, 1 Aug 2012 19:16:03 +0000 (UTC) In-Reply-To: <87boivrq3a.fsf@adaheads.sparre-andersen.dk> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=208.91.2.1; posting-account=1YPeQwoAAACAk-xhKPD32B0GIDdsFFtk User-Agent: G2/1.0 X-Received-Bytes: 3977 Content-Type: text/plain; charset=ISO-8859-1 Date: 2012-08-01T12:14:00-07:00 List-Id: On Wednesday, August 1, 2012 1:09:13 AM UTC-7, Jacob Sparre Andersen wrote: > stefan-lucks@see-the.signature writes: > > > On Tue, 31 Jul 2012, Jacob Sparre Andersen wrote: > > > > >> How would you handle translatable user visible strings - such as > > >> "Parsing '${file_name}' failed on line ${line_number}." (where > > >> "${...}" identifies parameter substitutions) - in Ada? > > > > > > Why do you need to *substitute* the parameters in the string at all? > > > > > > Without substitution, the following seems to work fine: > > > > > > Ada.Text_IO.Put_Line("Parsing " & File_Name & > > > " failed on line " & To_String(Line_Number) & > > > "."); > > > > Yes. But how do you translate that text without having to recompile > > the whole application? > > > > My question was related to _translatable_ user visible strings. If I > > just want to make an all-American program, your proposed solution is > > fine, but when I want to make it easy to translate the user visible > > strings in an application you proposed solution is unacceptable. > > > > Greetings, > > > > Jacob > > -- > > "Those who will not reason, are bigots, > > those who cannot, are fools, and > > those who dare not, are slaves." Hi, The standard way to do this is to externalize all localizable strings. Since message snippets are not generally localizable (there's no real context), the messages must be defined as complete sentences with embedded references to the application arguments that substituted at run-time. Using my previous example, the message Summary=Vector norm is {0,real,10.2f} with rank of {1,integer} would be defined in a properties file, e.g., myapp.properties, with localizations in locale specific files, e.g., if folks in GB want to see the rank first Summary=Vector rank is {1,integer} with norm of {0,real,10.2f} in a myapp_en_GB.properties file. The underlying source code remains the same Print_Summary (+Norm, +Rank); The ZB compiler, zbmcompile, would generate a package containing the myapp.properties and myapp_en_GB.properties strings, and accessor routines for all the message keys defined. Depending on the run-time locale, the value of the LANG variable on Unix, the correct localized message is displayed. (see http://zanyblue.sourceforge.net). If you want a globalized application, you need to get the message strings out of the application and you need to allow localization folks the freedom to move message arguments around in the localized text. Take care, Michael.