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: 103376,79c108d8d805d021 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news3.google.com!news2.volia.net!hwmnpeer01.ams!news.highwinds-media.com!news.astraweb.com!newsrouter-eu.astraweb.com!195.114.231.69.MISMATCH!feeder2!news2.euro.net!feeder1.cambrium.nl!feeder3.cambrium.nl!feed.tweaknews.nl!195.14.215.230.MISMATCH!news.netcologne.de!nhp.netcologne.de!newsfeed.arcor.de!news.arcor.de!not-for-mail Newsgroups: comp.lang.ada Subject: Re: Ada and Internationalization From: Georg Bauhaus In-Reply-To: <1149026932.554318.202570@i39g2000cwa.googlegroups.com> References: <1149026932.554318.202570@i39g2000cwa.googlegroups.com> Content-Type: text/plain Content-Transfer-Encoding: 7bit Organization: # Message-ID: <1149070281.9173.25.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.4.1 Date: Wed, 31 May 2006 12:11:22 +0200 NNTP-Posting-Date: 31 May 2006 12:11:22 MEST NNTP-Posting-Host: 41c13fb6.newsread4.arcor-online.net X-Trace: DXC=b]MAbFLL?o\D__2dTlB=E[:ejgIfPPldTjW\KbG]kaMX]kI_X=5KeaVF7XhP3YJKgE\j\R[>AD@cO[j_ X-Complaints-To: usenet-abuse@arcor.de Xref: g2news2.google.com comp.lang.ada:4616 Date: 2006-05-31T12:11:22+02:00 List-Id: On Tue, 2006-05-30 at 16:12 -0700, Michael Rohan wrote: > Hi Folks, > > I've checked Google and have not been able to find anything in Ada out > there for internationalized code. When I do this, I make message printing suitable for several languages right from the start, taking advantage of the Ada type system. Collect the messages in an enumeration type, i.e., name them. Then build an (abstract) Message type around this enumeration. Then derive (compose) one type for each natural language. Advantages: - Ada's coverage rules will make sure that translation won't miss a single message. - You can easily create an external messages collection for the translators in XML, Excel, plain text, even gettext if you must, because of the mentioned properties of the message type: You have it in your program, so just write another main unit that basically enumerates the values in the types made for the messages, using the desired output format. - No need to analyze the entire program using external tools, no need to touch sources. Disadvantage: - It's not gettext, only Ada, so maybe it's less fashionable. - It also requires that a programmer considers messages important enough to be worthy of a type that can be checked by the compiler. Using a Message type and the .properties approach are somewhat similar, except that with a type, you won't have to leave the Ada language: add the properties to a library package, e.g. in constants, roughly: (en_US => (got_foo => ..., no_bar_please => ..., argh => ...), (fr_CA => (got_foo => ..., no_bar_please => ..., arhg => ...), ... Georg