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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.107.166.69 with SMTP id p66mr3160705ioe.85.1511365111315; Wed, 22 Nov 2017 07:38:31 -0800 (PST) X-Received: by 10.157.5.211 with SMTP id 77mr897584otd.0.1511365111224; Wed, 22 Nov 2017 07:38:31 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!news.kjsl.com!usenet.stanford.edu!d140no3693346itd.0!news-out.google.com!x87ni2401ita.0!nntp.google.com!i6no3696882itb.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Wed, 22 Nov 2017 07:38:30 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=155.148.6.150; posting-account=lJ3JNwoAAAAQfH3VV9vttJLkThaxtTfC NNTP-Posting-Host: 155.148.6.150 References: <2c5d0dff-bc12-4b37-b8e1-ac176c3e675f@googlegroups.com> <40dc6a79-9434-4b5a-bed0-50ee1dfb74c5@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: gettext for Ada From: Shark8 Injection-Date: Wed, 22 Nov 2017 15:38:31 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Xref: feeder.eternal-september.org comp.lang.ada:49056 Date: 2017-11-22T07:38:30-08:00 List-Id: On Tuesday, November 21, 2017 at 6:10:23 PM UTC-7, Randy Brukardt wrote: > "Shark8" wrote in message=20 > news:40dc6a79-9434-4b5a-bed0-50ee1dfb74c5... > > On Monday, November 20, 2017 at 3:43:21 PM UTC-7, Randy Brukardt wrote: > >> "Shark8" wrote in message > >> news:2c5d0dff-bc12-4b37-b8e1-ac176c3e675f... > >> On Sunday, November 19, 2017 at 1:40:55 PM UTC-7, Victor Porton wrote: > >> > Where can I get a gettext bindings for Ada? > >> > >> ... > >> >And then at compile-time select the proper language to build the > >> >application via > >> >GPR-projects, makefiles, or whatever paramaterizable build-system you= =20 > >> >wish > >> >to use. > >> > >> Or, use parallel packages and select the correct one to use at runtime= =20 > >> based > >> on Ada.Locales (A.19). That's the primary purpose of the Locales packa= ge, > >> after all. > > > > Parallel packages? I've not heard the term before, how are they used &= =20 > > selected > > at runtime? >=20 > I would make a set of parallel child packages with the same operations in= =20 > each. Then one could use an if (or maybe a case, if the proposed Ada 2020= =20 > extension comes to pass) to select them. Are you talking about a case-statement for selecting a child package, perha= ps something like: PACKAGE Actual_Messages RENAMES (CASE Language is WHEN English =3D> Messages.English, WHEN German =3D> Messages.German, WHEN French =3D> Messages.French, WHEN OTHERS =3D> Raise Program_Error) ?? -- or something like case-selection on strings? -- or something differen= t altogether?=20 >=20 > Or (perhaps better), use a full OOP design, with an abstract Root_Locale= =20 > type (with a set of dispatching operations), a series of specific Locale= =20 > types (English_Locale, French_Locale, etc.) giving implementations to tho= se=20 > types, and a map and factory to create objects of those types as needed.= =20 > (The Claw GUI Builder has an internal design much like this, other than t= he=20 > factory, which didn't exist in Ada 95, so I had to use a massive case=20 > statement instead. A factory would have been much better.) Do you still have the giant case, or did you opt to use the Generic_Dispatc= hing_Constructor when Ada 2005 added it? >=20 > > Also, shouldn't the stuff in Ada.Locales actually be proper > > enumerations rather than strings? >=20 > There's a near infinite number of possible Locales, so enumerating them i= s=20 > next to impossible. We decided against even giving names to the most comm= on=20 > ones, as that would have led to endless debates about which ones are the= =20 > most important. The strings come from a freely available ISO standard, so= =20 > they will never change and are easy to find out and are maintained by=20 > someone other than us Ada people (so no need for debates on our end on=20 > topics outside of our expertise). This is the same reason that we depend = on=20 > character set standards rather than rolling our own character set rules= =20 > (even though the latter would be easier to maintain, we wouldn't really k= now=20 > what we were doing). Er... "The strings come from a freely available ISO standard, so they will = never change" So why not enumerate the strings, that way proper cases can be done on eith= er languages and/or locales? -- ISO 3166-1 Country & Territory Codes -- See: https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes Type Locale is ( AF, -- Afghanistan AX, -- =C3=85land Islands AL, -- Albania DZ, -- Algeria AS, -- American Samoa AD, -- Andorra ... ZZ -- Unknown Country ); -- Enumeration of the ISO 639-3 alpha-3 code that identifies a language -- See: http://www-01.sil.org/iso639-3/codes.asp?order=3D639_3&letter=3D%25 Type Language is ( aaa, -- Ghotuo aab, -- Alumu-Tesu aac, -- Ari aad, -- Amal aae, -- Arb=C3=ABresh=C3=AB Albanian aaf, -- Aranadan aag, -- Ambrak aah, -- Abu' Arapesh=20 ... und, -- Undetermined ... zyp, -- Zyphe Chin zza, -- Zaza zzj -- Zuojiang Zhuang=20 ); And, perhaps a Image function for Language which returns the lower-cased-st= ring of the enumeration itself.