Lang.purs 887 Bytes
Newer Older
1
module Gargantext.Components.Lang where
2

3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
import Data.Argonaut (class EncodeJson, encodeJson)
import Data.Maybe (Maybe(..))

import Gargantext.Prelude (class Eq, class Show, show)

-- Language used for search
allLangs :: Array Lang
allLangs = [ EN
           , FR
           , Universal
           , No_extraction
           ]

data Lang = FR | EN | Universal | No_extraction

instance showLang :: Show Lang where
  show FR = "FR"
  show EN = "EN"
  show Universal = "All"
  show No_extraction = "Nothing"

derive instance eqLang :: Eq Lang

readLang :: String -> Maybe Lang
readLang "FR"  = Just FR
readLang "EN"  = Just EN
readLang "All" = Just Universal
readLang "Nothing" = Just No_extraction
readLang _           = Nothing

instance encodeJsonLang :: EncodeJson Lang where
  encodeJson a = encodeJson (show a)


-- Language used for the landing page
data LandingLang = LL_EN | LL_FR