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: Thu, 23 Nov 2017 14:23:08 +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> <87mv3fzbn9.fsf@jacob-sparre.dk> <87efopz77r.fsf@jacob-sparre.dk> <87a7zdz4zt.fsf@jacob-sparre.dk> <8760a1yyxp.fsf@jacob-sparre.dk> NNTP-Posting-Host: MyFhHs417jM9AgzRpXn7yg.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 6.1; 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:49112 Date: 2017-11-23T14:23:08+01:00 List-Id: On 23/11/2017 13:14, Jacob Sparre Andersen wrote: > Dmitry A. Kazakov wrote: > >> Put (Image (n) & Image (Verb) & ' ' & Image ("Tail")); >> >> Image (0) would return empty string. But first I would avoid sentences >> difficult to translate without having AI. Anyway a format string would >> have more problems with inflections. >> >> BTW, for a right to left languages you could define "+" for strings >> that reorders arguments: >> >> Put (A + B + C); --> Put (C & B & A); > > I can't see how you can do that without having a programmer sit down > with a translator for each language, and implement an "Image" function > for each parametrised, user-visible sentence in the application. That > sounds quite costly to me. No. You do everything in English. When you run your program, each time an Image is called it creates or modifies an entry in the translation table backed by a single-file DB maybe with source file and line reference attached to the entry. Once you decide to deploy your project, you walk through the DB entries and provide translations to the languages you want to support. The source line reference helps to understand the meaning of the sentence as a whole. The DB is deployed together with the application. > Do you have an idea (or experience) doing it in an efficient way, which > doesn't make it prohibitively costly to add more languages? (Or to > change the user interface for that matter?) I don't do text messages translations, it is IMO pointless. If a user does not know English enough to understand a text message, he should walk away. However I used the schema described above once. A GUI is a different thing. There is little choice because frameworks like GTK already implement one or another translation schema. GTK has an official method which I don't like and a semi-official one I prefer to use. I have all texts (button names, tool-tip texts etc) coming as a string widget style property with the default value to serve as the English fallback. GTK widget styles are defined/overridden using CSS and can be reloaded using GtkCssProvider any time. The DB I described above is not necessary because in GTK you can walk all properties of a widget (and its children for containers). This how you can get a full list of all texts and devise some localized CSS' to deploy. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de