Nп/п : 33 из 87
 От   : Mild Shock                          2:5075/128        31 июл 23 10:06:17
 К    : Mild Shock                                            31 июл 23 11:12:11
 Тема : Re: Bringing Unicode to Prolog (Dogelog Runtime)
----------------------------------------------------------------------------------
                                                                                 
@MSGID: 1@solani.org> 3f52d87b
@REPLY:
<09b8853c-9da7-482f-b98a-2819fdd02a00n@googlegroups.com> 7957d82b
@REPLYADDR Mild Shock <janburse@fastmail.fm>
@REPLYTO 2:5075/128 Mild Shock
@CHRS: CP866 2
@RFC: 1 0
@RFC-Message-ID: 1@solani.org>
@RFC-References: 1@solani.org>
<4ca4a4d0-d91a-45b4-81b3-0bc46818f141n@googlegroups.com> <7a9e3b0d-0929-45e3-b7d2-318d9bd1f069n@googlegroups.com>
<09b8853c-9da7-482f-b98a-2819fdd02a00n@googlegroups.com>
@TZUTC: 0200
@PID: Mozilla/5.0 (Windows NT 10.0; Win64; x64;
rv:91.0) Gecko/20100101 Firefox/91.0 SeaMonkey/2.53.17
@TID: FIDOGATE-5.12-ge4e8b94
For locales, see also:

Creating global software: Text handling and localization
in Taligent`s CommonPoint application system
Mark Davis et al. - 1996
https://dev.antiguru.de/davis.pdf

I wasn`t sure whether the get_string/3 implementation
will perform. In Jekejeke Prolog, since it has
multi-argument indexing, each string/3 lookup with

mode (+,+,-) will be a little bit faster, whereas
Doglog Player, which has only first argument indexing
will use a little bit more time, since it needs

a scan, can only lookup the Key via an index,
but will scan for the Parent. If the text database
isn`t extremly large and/or if the locales do

not have extremly many segments, this is a
non-issue I guess. And Dogelog Player might get
multi-argument indexing in the future.

Mild Shock schrieb:
> Note: Do not confuse multillingual strings, as introduced
> by recent Dogelog Player, with Unicode encoding.
> I am using the phrase "multilingual strings" for a text

> database. Interestingly I managed to make the text
> database declarative. Means the strings/3 entries
> are not order dependent. You can place languages into
> the multifile predicate in any order,

> and it will pick the most specific string independent
> of the order of the strings/3 facts. I was replicating
> the Java Script Resource Bundle lookup on a finer
> grained level, by this simple Prolog code:

> get_string(Key, Locale, Value) :-
>     sys_locale_ancestor(Locale, Parent),
>     strings(Key, Parent, Res), !,
>     Value = Res.

> % sys_locale_ancestor(+Atom, -Atom)
> sys_locale_ancestor(L, L).
> sys_locale_ancestor(L, M) :-
>     last_sub_atom(L, P, _, _, `_`),
>     sub_atom(L, 0, P, _, M).
> sys_locale_ancestor(_, ``).

> The above assumes that locale identifiers use
> underscore separator. It also assumes the last_sub_atom/3
> predicate from Novacore, unfortunatel ISO Core has
> only sub_atom/3, but no last_sub_atom/3.


 --- Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Firefox/91.0 SeaMonkey/2.53.17
 * Origin: usenet.network (2:5075/128)
SEEN-BY: 5001/100 5005/49 5015/255 5019/40 5020/715
848 1042 4441 12000
SEEN-BY: 5030/49 1081 5058/104 5075/128
@PATH: 5075/128 5020/1042 4441



   GoldED+ VK   │                                                 │   09:55:30    
                                                                                
В этой области больше нет сообщений.

Остаться здесь
Перейти к списку сообщений
Перейти к списку эх