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 module Gargantext.Core
15 import Gargantext.Prelude
16 import GHC.Generics (Generic)
18 import Data.Either(Either(Left))
21 ------------------------------------------------------------------------
22 -- | Language of a Text
23 -- For simplicity, we suppose text has an homogenous language
25 -- Next steps: | DE | IT | SP
29 -- - DE == deutch (not implemented yet)
30 -- - IT == italian (not implemented yet)
31 -- - SP == spanish (not implemented yet)
33 -- ... add your language and help us to implement it (:
35 -- | All languages supported
36 -- TODO : DE | SP | CH
37 data Lang = EN | FR | All
38 deriving (Show, Eq, Ord, Bounded, Enum, Generic)
41 instance FromJSON Lang
42 instance ToSchema Lang
43 instance FromHttpApiData Lang
45 parseUrlPiece "EN" = pure EN
46 parseUrlPiece "FR" = pure FR
47 parseUrlPiece "All" = pure All
48 parseUrlPiece _ = Left "Unexpected value of OrderBy"
50 allLangs = [minBound ..]