From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.6 Path: eternal-september.org!reader02.eternal-september.org!aioe.org!Hx95GBhnJb0Xc8StPhH8AA.user.46.165.242.91.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: =?UTF-8?B?UmU6IEd0a0FkYSBhbmQg4oKs?= Date: Sat, 11 Sep 2021 12:04:40 +0200 Organization: Aioe.org NNTP Server Message-ID: References: <06dbbe8e-737e-44c2-9e9c-40e8f8aade2fn@googlegroups.com> <234ee351-3abb-445e-9d34-d5abd7a8a9b6n@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: gioia.aioe.org; logging-data="62036"; posting-host="Hx95GBhnJb0Xc8StPhH8AA.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org"; User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 Content-Language: en-US X-Notice: Filtered by postfilter v. 0.9.2 Xref: reader02.eternal-september.org comp.lang.ada:62701 List-Id: On 2021-09-11 11:20, AdaMagica wrote: > Is there no way to use the character € directly? Imagine, you want to write cyrillc on label of a gui? Would you use hex values or would you write > Я говорю по-русски. I would never use Cyrillic in the source code. Anyway, this is a question regarding the encoding of literals in Ada. Ada 2X supports Unicode and GNAT supports Unicode sources. I never tried it but I suppose the following should work: Strings_Edit.UTF8.Handling.To_UTF8 ('€'); Here '€' should be resolved to Wide_Character'('€') and then converted to a UTF-8 encoded String. As for labels, icons etc, I use GTK style properties. I.e. let I have a label with a text on it. Usually this label would be packed in some larger container widget, e.g. Gtk_Grid_Record. I derive a custom widget from Gtk_Grid_Record. Then I call Initialize_Class_Record once to create the new widget "type" (used G_New). There I add style properties like this: Class_Record : aliased Ada_GObject_Class := Uninitialized_Class; ... procedure Initialize ( Widget : not null access My_Widget_Record'Class ) is begin G_New (Widget, Get_Type); -- Get_Type will register class ... function Get_Type return GType is begin if Initialize_Class_Record ( Ancestor => Gtk.Grid.Get_Type, -- Parent class Class_Record => Class_Record'Access, Type_Name => "mywidget" ) then -- Not yet registerd Install_Style_Property ( GLib.Types.Class_Ref (Class_Record.The_Type), Gnew_String ( Name => "label", Nick => "Label", Blurb => "Label text I want to be able to change", Default => "I speak English" ) ); ... end if; return Class_Record.The_Type; end Get_Type; The widget must handle "style-updated" from where it would use Style_Get to get the label text and set it into the label. So, a Russian localization would be a CSS sheet file defining the property "label": --------------------------- mywidget { -mywidget-label: "Я говорю по-русски"; } --------------------------- P.S. Inventors of GTK CSS sheets apparently misspelled the word "sheet", they should have used the letter 'i'! (:-)) -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de