{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE OverloadedStrings #-}
module Text.Collate.Tailorings
( ducetCollation
, tailorings )
where
import Text.Collate.Lang
import Text.Collate.TH
import Text.Collate.Collation (suppressContractions, insertElements,
Collation, CollationElement(..))
import Data.Binary (decode)
ducetCollation :: Collation
ducetCollation :: Collation
ducetCollation = ByteString -> Collation
forall a. Binary a => ByteString -> a
decode (ByteString -> Collation) -> ByteString -> Collation
forall a b. (a -> b) -> a -> b
$! $(genCollation "data/allkeys.txt")
applyCJKOverrides :: [Int] -> Collation -> Collation
applyCJKOverrides :: [Int] -> Collation -> Collation
applyCJKOverrides cps :: [Int]
cps coll :: Collation
coll = ((Int, Word16) -> Collation -> Collation)
-> Collation -> [(Int, Word16)] -> Collation
forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
foldr (Int, Word16) -> Collation -> Collation
addElt Collation
coll ([Int] -> [Word16] -> [(Int, Word16)]
forall a b. [a] -> [b] -> [(a, b)]
zip [Int]
cps [0x8000..])
where
addElt :: (Int, Word16) -> Collation -> Collation
addElt (cp :: Int
cp, weight :: Word16
weight) = [Int] -> [CollationElement] -> Collation -> Collation
insertElements [Int
cp]
[Bool -> Word16 -> Word16 -> Word16 -> Word16 -> CollationElement
CollationElement Bool
False Word16
weight 0x0020 0x0002 0x0000]
tailorings :: [(Lang, Collation)]
tailorings :: [(Lang, Collation)]
tailorings =
[("af", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/af.txt"))
,("ar", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/ar.txt"))
,("as", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/as.txt"))
,("az", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/az.txt"))
,("be", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/be.txt"))
,("bn", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/bn.txt"))
,("ca", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/ca.txt"))
,("cs", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/cs.txt"))
,("cu", [Int] -> Collation -> Collation
suppressContractions [0x0418, 0x0438] (Collation -> Collation) -> Collation -> Collation
forall a b. (a -> b) -> a -> b
$
ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/cu.txt"))
,("cy", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/cy.txt"))
,("da", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/da.txt"))
,("de_AT_u_co_phonebk", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/de_at_ph.txt"))
,("de_u_co_phonebk", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/de_phone.txt"))
,("dsb", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/dsb.txt"))
,("ee", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/ee.txt"))
,("eo", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/eo.txt"))
,("es", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/es.txt"))
,("es_u_co_trad", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/es_trad.txt"))
,("et", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/et.txt"))
,("fa", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/fa.txt"))
,("fi", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/fi.txt"))
,("fi_u_co_phonebk", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/fi_phone.txt"))
,("fil", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/fil.txt"))
,("fo", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/fo.txt"))
,("fr_CA", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/fr_ca.txt"))
,("gu", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/gu.txt"))
,("ha", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/ha.txt"))
,("haw", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/haw.txt"))
,("he", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/he.txt"))
,("hi", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/hi.txt"))
,("hr", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/hr.txt"))
,("hu", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/hu.txt"))
,("hy", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/hy.txt"))
,("ig", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/ig.txt"))
,("is", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/is.txt"))
,("ja", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/ja.txt"))
,("kk", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/kk.txt"))
,("kl", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/kl.txt"))
,("kn", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/kn.txt"))
,("ko", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/ko.txt"))
,("kok", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/kok.txt"))
,("lkt", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/lkt.txt"))
,("ln", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/ln.txt"))
,("lt", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/lt.txt"))
,("lv", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/lv.txt"))
,("mk", [Int] -> Collation -> Collation
suppressContractions [0x0418, 0x0438] (Collation -> Collation) -> Collation -> Collation
forall a b. (a -> b) -> a -> b
$
ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/mk.txt"))
,("ml", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/ml.txt"))
,("mr", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/mr.txt"))
,("mt", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/mt.txt"))
,("nb", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/nb.txt"))
,("nn", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/nn.txt"))
,("nso", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/nso.txt"))
,("om", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/om.txt"))
,("or", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/or.txt"))
,("pa", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/pa.txt"))
,("pl", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/pl.txt"))
,("ro", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/ro.txt"))
,("sa", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/sa.txt"))
,("se", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/se.txt"))
,("si", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/si.txt"))
,("si_u_co_dict", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/si_dict.txt"))
,("sk", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/sk.txt"))
,("sl", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/sl.txt"))
,("sq", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/sq.txt"))
,("sr", [Int] -> Collation -> Collation
suppressContractions [0x0418, 0x0438] (Collation -> Collation) -> Collation -> Collation
forall a b. (a -> b) -> a -> b
$
ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/sr.txt"))
,("sv", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/sv.txt"))
,("sv_u_co_reformed", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/sv_refo.txt"))
,("ta", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/ta.txt"))
,("te", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/te.txt"))
,("th", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/th.txt"))
,("tn", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/tn.txt"))
,("to", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/to.txt"))
,("tr", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/tr.txt"))
,("ug_Cyrl", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/ug_cyrl.txt"))
,("uk", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/uk.txt"))
,("ur", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/ur.txt"))
,("vi", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/vi.txt"))
,("vo", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/vo.txt"))
,("wae", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/wae.txt"))
,("wo", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/wo.txt"))
,("yo", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/yo.txt"))
,("zh", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/zh.txt"))
,("zh_u_co_big5han", [Int] -> Collation -> Collation
applyCJKOverrides
(ByteString -> [Int]
forall a. Binary a => ByteString -> a
decode $(genCJKOverrides "data/cjk/Big5.txt")) (Collation -> Collation) -> Collation -> Collation
forall a b. (a -> b) -> a -> b
$
ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/zh_big5.txt"))
,("zh_u_co_gb2312", [Int] -> Collation -> Collation
applyCJKOverrides
(ByteString -> [Int]
forall a. Binary a => ByteString -> a
decode $(genCJKOverrides "data/cjk/GB2312.txt")) (Collation -> Collation) -> Collation -> Collation
forall a b. (a -> b) -> a -> b
$
ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/zh_gb.txt"))
,("zh_u_co_pinyin", [Int] -> Collation -> Collation
applyCJKOverrides
(ByteString -> [Int]
forall a. Binary a => ByteString -> a
decode $(genCJKOverrides "data/cjk/Pinyin.txt")) (Collation -> Collation) -> Collation -> Collation
forall a b. (a -> b) -> a -> b
$
ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/zh_pin.txt"))
,("zh_u_co_stroke", [Int] -> Collation -> Collation
applyCJKOverrides
(ByteString -> [Int]
forall a. Binary a => ByteString -> a
decode $(genCJKOverrides "data/cjk/Stroke.txt")) (Collation -> Collation) -> Collation -> Collation
forall a b. (a -> b) -> a -> b
$
ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/zh_strk.txt"))
,("zh_u_co_zhuyin", [Int] -> Collation -> Collation
applyCJKOverrides
(ByteString -> [Int]
forall a. Binary a => ByteString -> a
decode $(genCJKOverrides "data/cjk/Zhuyin.txt")) (Collation -> Collation) -> Collation -> Collation
forall a b. (a -> b) -> a -> b
$
ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/zh_zhu.txt"))
]