%D \module
%D   [       file=sort-lan,
%D        version=2005.08.08,
%D          title=\CONTEXT\ Sort Macros,
%D       subtitle=Language Definitions,
%D         author=Hans Hagen,
%D           date=\currentdate,
%D      copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.

% for testing:

\startmode[sortorder-en]
    \exportsortexpansion{aacute}{a+1}
    \exportsortexpansion{Aacute}{A+2}
    \exportsortexpansion{agrave}{a+1}
    \exportsortexpansion{Agrave}{A+2}
\stopmode

%D This module replaces existing sort key handling and is meant to be
%D used with the new texutil functionality. Here we define the language
%D specific sort rules.

% slovenian
%
% a-c, ccaron, cacute, d, dstroke, e-s, scaron, t-z, zcaron

% \enableregime[utf]
% \mainlanguage[sl]
% \starttext
%     \ccaron\index{\ccaron\space 1}
%     \Ccaron\index{\Ccaron\space 1}
%     č\index{č 2}
%     Č\index{Č 2}
%     \v c\index{\v c 3}
%     \v C\index{\v C 3}
%     \placeindex
% \stoptext

% \startmode[sortorder-sl]
%     \exportsortexpansion {ccaron}  {cz}
%     \exportsortexpansion {cacute}  {czz}
%     \exportsortexpansion {dstroke} {dz}
%     \exportsortexpansion {scaron}  {sz}
%     \exportsortexpansion {zcaron}  {zz}

%     \exportsortdivision  {cz}  {ccaron}
%     \exportsortdivision  {czz} {cacute}
%     \exportsortdivision  {dz}  {dstroke}
%     \exportsortdivision  {sz}  {scaron}
%     \exportsortdivision  {zz}  {zcaron}
% \stopmode
%
% \startmode[sortorder-sl]
%     \exportsortexpansion {ccaron}  {c+1}
%     \exportsortexpansion {cacute}  {c+2}
%     \exportsortexpansion {dstroke} {d+1}
%     \exportsortexpansion {scaron}  {s+1}
%     \exportsortexpansion {zcaron}  {z+1}
%
%     \exportsortdivision  {c+1} {ccaron}
%     \exportsortdivision  {c+2} {cacute}
%     \exportsortdivision  {d+1} {dstroke}
%     \exportsortdivision  {s+1} {scaron}
%     \exportsortdivision  {z+1} {zcaron}
% \stopmode

\startmode[sortorder-sl]
    \exportsortrule {ccaron}  {c+1}
    \exportsortrule {cacute}  {c+2}
    \exportsortrule {dstroke} {d+1}
    \exportsortrule {scaron}  {s+1}
    \exportsortrule {zcaron}  {z+1}
\stopmode

% finnish
%
% a-u, v+w sorted together, x-z, aring, adiaeresis, odiaeresis

\startmode[sortorder-fi]
    \exportsortrule {v}          {w}
    \exportsortrule {aring}      {z+1}
    \exportsortrule {adiaeresis} {z+2}
    \exportsortrule {odiaeresis} {z+3}
\stopmode

% swedish
%
% a-z, aring, adiaeresis, odiaeresis

% \mainlanguage[sv]
% \starttext
%     a\index{a}
%     a\index{a}
%     z\index{z}
%     z\index{z}
%     q\index{q}
%     q\index{q}
%     \index{}
%     \index{}
%     \index{}
%     \index{}
%     \index{}
%     \index{}
%     \index{}
%     \index{}
%     \index{}
%     \aring\index{\aring}
%     \adiaeresis\index{\adiaeresis}
%     \odiaeresis\index{\odiaeresis}
%     A\index{A}
%     \index{}
%     \index{}
%     \index{}
%     \Aring\index{\Aring}
%     \Adiaeresis\index{\Adiaeresis}
%     \Odiaeresis\index{\Odiaeresis}
%     \placeindex
% \stoptext

\startmode[sortorder-sv]
    \exportsortrule {aring}      {z+1}
    \exportsortrule {adiaeresis} {z+2}
    \exportsortrule {odiaeresis} {z+3}
\stopmode

% norwegian, danish
%
% a-z, aeligature, oslash, aring

\startmode[sortorder-no,sortorder-da]
    \exportsortrule {aeligature} {z+1}
    \exportsortrule {oslash}     {z+2}
    \exportsortrule {aring}      {z+3}
\stopmode

% islandic
%
% a, aacute, b, c, d, eth, e, eacute, f-i, iacute, j-o, oacute, p-u, uacute, v, w (?), x, y, yacute, z, aeligature, oslash, thorn

% estonian
%
% a-s, scaron, z, zcaron, t-w, otilde, adiaeresis, odiaeresis, udiaeresis, x, y

% czech
%
% a) make a single group for: "a", "", "A", ""
% b) make a different two groups for: "c", "C" and "c", "C"
% c) sorting rule: "A" < "" < "a" < "" < "C" < "c" < "C" < "c"
% d) sorting rule: "h" < "ch" < "i" ("c" < "h")

\gdef\czsortdivisionch{ch}
\gdef\czsortdivisionCh{Ch}

\startmode[sortorder-cz]
    \exportsortexpansion {aacute} {a}
    \exportsortexpansion {Aacute} {A}
    \exportsortexpansion {ccaron} {c+1}
    \exportsortexpansion {Ccaron} {C+1}
    \exportsortdivision  {c+1}    {ccaron}
    \exportsortexpansion {dcaron} {d}
    \exportsortexpansion {Dcaron} {D}
    %\exportsortdivision  {d+1}    {dcaron}
    \exportsortexpansion {eacute} {e}
    \exportsortexpansion {Eacute} {E}
    \exportsortexpansion {ecaron} {e}
    \exportsortexpansion {Ecaron} {E}
    \exportsortreduction {ch}     {h+1}
    \exportsortexpansion {ch}     {h+1}
    \exportsortreduction {Ch}     {H+1}
    \exportsortexpansion {Ch}     {H+1}
    \exportsortdivision  {h+1}    {czsortdivisionch}
    \exportsortexpansion {iacute} {i}
    \exportsortexpansion {Iacute} {I}
    \exportsortexpansion {ncaron} {n}
    \exportsortexpansion {Ncaron} {N}
    %\exportsortdivision  {n+1}    {ncaron}
    \exportsortexpansion {oacute} {o}
    \exportsortexpansion {Oacute} {O}
    \exportsortexpansion {rcaron} {r+1}
    \exportsortexpansion {Rcaron} {R+1}
    \exportsortdivision  {r+1}    {rcaron}
    \exportsortexpansion {scaron} {s+1}
    \exportsortexpansion {Scaron} {S+1}
    \exportsortdivision  {s+1}    {scaron}
    \exportsortexpansion {tcaron} {t}
    \exportsortexpansion {Tcaron} {T}
    %\exportsortdivision  {t+1}    {tcaron}
    \exportsortexpansion {uacute} {u}
    \exportsortexpansion {Uacute} {U}
    \exportsortexpansion {uring}  {u}
    \exportsortexpansion {Uring}  {U}
    \exportsortexpansion {yacute} {y}
    \exportsortexpansion {Yacute} {Y}
    \exportsortexpansion {zcaron} {z+1}
    \exportsortexpansion {Zcaron} {Z+1}
    \exportsortdivision  {z+1}    {zcaron}
\stopmode

% Polish:

\startmode[sortorder-pl]
    \exportsortrule {aogonek}    {a+1}
    \exportsortrule {cacute}     {c+1}
    \exportsortrule {eogonek}    {e+1}
    \exportsortrule {lstroke}    {l+1}
    \exportsortrule {nacute}     {n+1}
    \exportsortrule {oacute}     {o+1}
    \exportsortrule {sacute}     {s+1}
    \exportsortrule {zacute}     {z+1}
    \exportsortrule {zdotaccent} {z+2}
\stopmode

\endinput
