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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: gettext for Ada Date: Mon, 20 Nov 2017 21:33:20 +0100 Organization: Aioe.org NNTP Server Message-ID: References: <2c5d0dff-bc12-4b37-b8e1-ac176c3e675f@googlegroups.com> <87r2sszr4f.fsf@jacob-sparre.dk> <0d02d48a-112f-4817-ab29-6dded00eb81f@googlegroups.com> NNTP-Posting-Host: MajGvm9MbNtGBKE7r8NgYA.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 Content-Language: en-US X-Notice: Filtered by postfilter v. 0.8.2 Xref: feeder.eternal-september.org comp.lang.ada:49020 Date: 2017-11-20T21:33:20+01:00 List-Id: On 2017-11-20 20:59, Shark8 wrote: > Well, that is one of the general problems of formatting strings: they > cannot be in-general guaranteed to be correct (at least w/o some > really good static analysis). > > It's also illustrative of why an actual structured approach to > messaging would be much better: simple string-formatting of "You have > %d meats." with 1 (one) yields "You have 1 meats." and thereby > violates subject-verb agreement (of [non-]plurality). That does not apply to Ada which is typed. In Ada I would do: X : Meats := 1; Put_Line ("You have" & Image (X)); and Image (Meats) will produce "1 meat". In my projects I customary add Image to many important types. I a lesser number of cases I also add Get, Put (from string) and Value. In some cases I add stream I/O operations as well. In GtkAda projects I also add an implementation of GtkCellRenderer in order to be able show values in tree views. Of I would never use gettext, not in a wildest nightmare. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de