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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,78e9bd49c9ce255c X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!feeder.news-service.com!news2.euro.net!newsfeed.freenet.de!news.teledata-fn.de!newsfeed.arcor.de!newsspool4.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Internationalization for Ada Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <7cdd6689-077e-4438-a493-428823bb1ee2@k19g2000yqc.googlegroups.com> Date: Sat, 12 Dec 2009 12:51:35 +0100 Message-ID: NNTP-Posting-Date: 12 Dec 2009 12:52:03 CET NNTP-Posting-Host: cc2fbcf4.newsspool3.arcor-online.net X-Trace: DXC=le?j3FfWQgg]BlmkiiU@BiMcF=Q^Z^V3h4Fo<]lROoRa8kFk0b6F0BVoaGUYUdgjF;0j X-Complaints-To: usenet-abuse@arcor.de Xref: g2news1.google.com comp.lang.ada:8372 Date: 2009-12-12T12:52:03+01:00 List-Id: On Sat, 12 Dec 2009 01:23:07 -0800 (PST), Ludovic Brenta wrote: > vlc wrote on comp.lang.ada: >> >> Is there a preferred way for internationalization in Ada 2005 - like >> GNU gettext for GNU/Linux? If anyone has experience with this topic, I >> would be glad for a link which directs me into the right direction, >> also if there is something special for GtkAda. >> >> Thanks a lot in advance! > > See the package GtkAda.Intl in GtkAda. Yes, but there is also other way based on widget style properties, which I prefer. Each variable text is made a style property of its container widget. When the widget is initialized, its class record is initialized as well. Here the necessary style properties are added: if then Class_Install_Style_Property ( Class_Record, -- Freshly initialized class record Gnew_String ( Name => "fancy text", Nick => "hey", Default => "hey", Blurb => "The text to appear in the label" ) ); In the widget's "style_set" event handler the texts are actually set. E.g. procedure Style_Set (Widget : access Gtk_Fancy_Widget_Record'Class) is begin Set_Text (Widget.Label, Style_Get Widget, "fancy text"); ... The texts and other styles are then defined in the GTK resource file. That need to be done only if necessary, because there is a default for any property. Only in order to change the texts you provide and load another resource file. This can be done several times, if you properly handle the event "style_set". The advantage of this method is that it does not require any tools or any additional files to work. It does not depend on the OS and its settings. (E.g. when I use German locale, I still don't want texts in German). Style properties can be more than only texts. For example you can have images there. The way properties are matched are very elaborated, you can define quite complex rules (by class name, by widget name etc), instead of simple equality in the case of locales. A more detailed description how to deal with GTK style properties in GtkAda: http://www.dmitry-kazakov.de/ada/gtkada_contributions.htm#4 On GTK resource files see: http://library.gnome.org/devel/gtk/unstable/gtk-Resource-Files.html -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de