"Fossies" - the Fresh Open Source Software Archive

Member "pp-2.14.3/src/Localization.hs" (24 Nov 2021, 4992 Bytes) of package /linux/privat/pp-2.14.3.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Haskell source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "Localization.hs": 2.14.2_vs_2.14.3.

    1 {- PP
    2 
    3 Copyright (C) 2015-2021 Christophe Delord
    4 
    5 http://cdelord.fr/pp
    6 
    7 This file is part of PP.
    8 
    9 PP is free software: you can redistribute it and/or modify
   10 it under the terms of the GNU General Public License as published by
   11 the Free Software Foundation, either version 3 of the License, or
   12 (at your option) any later version.
   13 
   14 PP is distributed in the hope that it will be useful,
   15 but WITHOUT ANY WARRANTY; without even the implied warranty of
   16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   17 GNU General Public License for more details.
   18 
   19 You should have received a copy of the GNU General Public License
   20 along with PP.  If not, see <http://www.gnu.org/licenses/>.
   21 -}
   22 
   23 module Localization ( Lang, langs
   24                     , myLocale
   25                     )
   26 where
   27 
   28 import Data.Time
   29 
   30 -- language list
   31 data Lang = En | Fr | It | Es
   32           deriving (Show, Read, Eq, Enum, Bounded)
   33 
   34 langs :: [Lang]
   35 langs = [(minBound :: Lang) ..]
   36 
   37 -- "myLocale lang" returns the date format description for a given language.
   38 myLocale :: Lang -> TimeLocale
   39 
   40 -- french locale date format
   41 myLocale Fr = TimeLocale {
   42                     wDays = [("Dimanche","Dim")
   43                             ,("Lundi","Lun")
   44                             ,("Mardi","Mar")
   45                             ,("Mercredi","mer")
   46                             ,("Jeudi","Jeu")
   47                             ,("Vendredi","Ven")
   48                             ,("Samedi","Sam")],
   49                     months = [("Janvier","Jan")
   50                              ,("Février","Fev")
   51                              ,("Mars","Mar")
   52                              ,("Avril","Avr")
   53                              ,("Mai","Mai")
   54                              ,("Juin","Jui")
   55                              ,("Juillet","Jul")
   56                              ,("Août","Aou")
   57                              ,("Septembre","Sep")
   58                              ,("Octobre","Oct")
   59                              ,("Novembre","Nov")
   60                              ,("Décembre","Déc")],
   61                     amPm = ("AM","PM"),
   62                     knownTimeZones = [],
   63                     dateTimeFmt = "%a %b %e %H:%M:%S %Z %Y",
   64                     dateFmt = "%d/%m/%y",
   65                     timeFmt = "%H:%M:%S",
   66                     time12Fmt = "%I:%M:%S %p"
   67               }
   68 
   69 -- italian locale date format
   70 -- contributed by tajmone (https://github.com/tajmone)
   71 myLocale It = TimeLocale {
   72                     wDays = [("domenica","dom")
   73                             ,("lunedì","lun")
   74                             ,("martedì","mar")
   75                             ,("mercoledì","mer")
   76                             ,("giovedì","gio")
   77                             ,("venerdì","ven")
   78                             ,("sabato","sab")],
   79                     months = [("gennaio","gen")
   80                              ,("febbraio","feb")
   81                              ,("marzo","mar")
   82                              ,("aprile","apr")
   83                              ,("maggio","mag")
   84                              ,("giugno","giu")
   85                              ,("luglio","lug")
   86                              ,("agosto","ago")
   87                              ,("settembre","set")
   88                              ,("ottobre","ott")
   89                              ,("novembre","nov")
   90                              ,("dicembre","dic")],
   91                     amPm = ("AM","PM"),
   92                     knownTimeZones = [],
   93                     dateTimeFmt = "%a %e %b %Y, %H:%M:%S %Z",
   94                     dateFmt = "%d/%m/%y",
   95                     timeFmt = "%H:%M:%S",
   96                     time12Fmt = "%I:%M:%S %p"
   97               }
   98 
   99 -- spanish locale date format
  100 -- contributed by conradolandia (https://github.com/conradolandia)
  101 myLocale Es = TimeLocale {
  102                     wDays = [("domingo","dom")
  103                             ,("lunes","lun")
  104                             ,("martes","mar")
  105                             ,("miércoles","mie")
  106                             ,("jueves","jue")
  107                             ,("viernes","vie")
  108                             ,("sábado","sab")],
  109                     months = [("enero","ene")
  110                              ,("febrero","feb")
  111                              ,("marzo","mar")
  112                              ,("abril","abr")
  113                              ,("mayo","may")
  114                              ,("junio","jun")
  115                              ,("julio","jul")
  116                              ,("agosto","ago")
  117                              ,("septiembre","sep")
  118                              ,("octubre","oct")
  119                              ,("noviembre","nov")
  120                              ,("diciembre","dic")],
  121                     amPm = ("AM","PM"),
  122                     knownTimeZones = [],
  123                     dateTimeFmt = "%a %e %b %Y, %H:%M:%S %Z",
  124                     dateFmt = "%d/%m/%y",
  125                     timeFmt = "%H:%M:%S",
  126                     time12Fmt = "%I:%M:%S %p"
  127               }
  128 
  129 -- English is the default locale
  130 myLocale En = defaultTimeLocale
  131