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 NoImplicitPrelude #-}
13 {-# LANGUAGE DeriveGeneric #-}
14 {-# LANGUAGE TemplateHaskell #-}
15 {-# LANGUAGE OverloadedStrings #-}
17 module Gargantext.Core
20 import Gargantext.Prelude
21 import GHC.Generics (Generic)
23 import Data.Either(Either(Left))
26 ------------------------------------------------------------------------
27 -- | Language of a Text
28 -- For simplicity, we suppose text has an homogenous language
30 -- Next steps: | DE | IT | SP
34 -- - DE == deutch (not implemented yet)
35 -- - IT == italian (not implemented yet)
36 -- - SP == spanish (not implemented yet)
38 -- ... add your language and help us to implement it (:
40 -- | All languages supported
41 -- TODO : DE | SP | CH
42 data Lang = EN | FR | All
43 deriving (Show, Eq, Ord, Bounded, Enum, Generic)
46 instance FromJSON Lang
47 instance ToSchema Lang
48 instance FromHttpApiData Lang
50 parseUrlPiece "EN" = pure EN
51 parseUrlPiece "FR" = pure FR
52 parseUrlPiece "All" = pure All
53 parseUrlPiece _ = Left "Unexpected value of OrderBy"
55 allLangs = [minBound ..]