2 Module : Gargantext.Core
3 Description : Supported Natural language
4 Copyright : (c) CNRS, 2017-Present
5 License : AGPL + CECILL v3
6 Maintainer : team@gargantext.org
7 Stability : experimental
12 {-# LANGUAGE TemplateHaskell #-}
14 module Gargantext.Core
17 import Gargantext.Prelude
18 import GHC.Generics (Generic)
20 import Data.Either(Either(Left))
23 ------------------------------------------------------------------------
24 -- | Language of a Text
25 -- For simplicity, we suppose text has an homogenous language
27 -- Next steps: | DE | IT | SP
31 -- - DE == deutch (not implemented yet)
32 -- - IT == italian (not implemented yet)
33 -- - SP == spanish (not implemented yet)
35 -- ... add your language and help us to implement it (:
37 -- | All languages supported
38 -- TODO : DE | SP | CH
39 data Lang = EN | FR | All
40 deriving (Show, Eq, Ord, Bounded, Enum, Generic)
43 instance FromJSON Lang
44 instance ToSchema Lang
45 instance FromHttpApiData Lang
47 parseUrlPiece "EN" = pure EN
48 parseUrlPiece "FR" = pure FR
49 parseUrlPiece "All" = pure All
50 parseUrlPiece _ = Left "Unexpected value of OrderBy"
52 allLangs = [minBound ..]