Nп/п : 32 из 87
 От   : Mild Shock                          2:5075/128        31 июл 23 01:00:46
 К    : All                                                   31 июл 23 11:12:08
 Тема : Re: Bringing Unicode to Prolog (Dogelog Runtime)
----------------------------------------------------------------------------------
                                                                                 
@MSGID:
<09b8853c-9da7-482f-b98a-2819fdd02a00n@googlegroups.com> 7957d82b
@REPLY:
<7a9e3b0d-0929-45e3-b7d2-318d9bd1f069n@googlegroups.com> 7f45a3b0
@REPLYADDR Mild Shock <bursejan@gmail.com>
@REPLYTO 2:5075/128 Mild Shock
@CHRS: CP866 2
@RFC: 1 0
@RFC-References: 1@solani.org>
<4ca4a4d0-d91a-45b4-81b3-0bc46818f141n@googlegroups.com> <7a9e3b0d-0929-45e3-b7d2-318d9bd1f069n@googlegroups.com>
@RFC-Message-ID:
<09b8853c-9da7-482f-b98a-2819fdd02a00n@googlegroups.com>
@TZUTC: -0700
@PID: G2/1.0
@TID: FIDOGATE-5.12-ge4e8b94
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.
--- G2/1.0
 * 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    
                                                                                
В этой области больше нет сообщений.

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