mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-23 10:58:26 +00:00
Prepare translating dates
This commit is contained in:
@ -1,6 +1,8 @@
|
||||
module Messages.Comp.AttachmentMeta exposing (Texts, gb)
|
||||
|
||||
import Messages.Basics
|
||||
import Messages.DateFormat as DF
|
||||
import Messages.UiLanguage
|
||||
|
||||
|
||||
type alias Texts =
|
||||
@ -15,6 +17,7 @@ type alias Texts =
|
||||
, concerningEquipment : String
|
||||
, itemDate : String
|
||||
, itemDueDate : String
|
||||
, formatDateShort : Int -> String
|
||||
}
|
||||
|
||||
|
||||
@ -31,4 +34,5 @@ gb =
|
||||
, concerningEquipment = "Concerning Equipment"
|
||||
, itemDate = "Item Date"
|
||||
, itemDueDate = "Item Due Date"
|
||||
, formatDateShort = DF.formatDateShort Messages.UiLanguage.English
|
||||
}
|
||||
|
@ -1,5 +1,8 @@
|
||||
module Messages.Comp.CalEventInput exposing (Texts, gb)
|
||||
|
||||
import Messages.DateFormat as DF
|
||||
import Messages.UiLanguage
|
||||
|
||||
|
||||
type alias Texts =
|
||||
{ weekday : String
|
||||
@ -11,6 +14,7 @@ type alias Texts =
|
||||
, error : String
|
||||
, schedule : String
|
||||
, next : String
|
||||
, formatDateTime : Int -> String
|
||||
}
|
||||
|
||||
|
||||
@ -25,4 +29,5 @@ gb =
|
||||
, error = "Error"
|
||||
, schedule = "Schedule"
|
||||
, next = "Next"
|
||||
, formatDateTime = DF.formatDateTimeLong Messages.UiLanguage.English
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
module Messages.Comp.CustomFieldTable exposing (Texts, gb)
|
||||
|
||||
import Messages.Basics
|
||||
import Messages.DateFormat as DF
|
||||
import Messages.UiLanguage
|
||||
|
||||
|
||||
type alias Texts =
|
||||
@ -8,6 +10,7 @@ type alias Texts =
|
||||
, nameLabel : String
|
||||
, format : String
|
||||
, usageCount : String
|
||||
, formatDateShort : Int -> String
|
||||
}
|
||||
|
||||
|
||||
@ -17,4 +20,5 @@ gb =
|
||||
, nameLabel = "Name/Label"
|
||||
, format = "Format"
|
||||
, usageCount = "#Usage"
|
||||
, formatDateShort = DF.formatDateShort Messages.UiLanguage.English
|
||||
}
|
||||
|
@ -1,11 +1,14 @@
|
||||
module Messages.Comp.FolderTable exposing (Texts, gb)
|
||||
|
||||
import Messages.Basics
|
||||
import Messages.DateFormat as DF
|
||||
import Messages.UiLanguage
|
||||
|
||||
|
||||
type alias Texts =
|
||||
{ basics : Messages.Basics.Texts
|
||||
, memberCount : String
|
||||
, formatDateShort : Int -> String
|
||||
}
|
||||
|
||||
|
||||
@ -13,4 +16,5 @@ gb : Texts
|
||||
gb =
|
||||
{ basics = Messages.Basics.gb
|
||||
, memberCount = "#Member"
|
||||
, formatDateShort = DF.formatDateShort Messages.UiLanguage.English
|
||||
}
|
||||
|
@ -1,6 +1,10 @@
|
||||
module Messages.Comp.ItemCard exposing (Texts, gb)
|
||||
|
||||
import Data.Direction exposing (Direction)
|
||||
import Messages.Basics
|
||||
import Messages.Data.Direction
|
||||
import Messages.DateFormat
|
||||
import Messages.UiLanguage
|
||||
|
||||
|
||||
type alias Texts =
|
||||
@ -10,6 +14,9 @@ type alias Texts =
|
||||
, openAttachmentFile : String
|
||||
, gotoDetail : String
|
||||
, cycleAttachments : String
|
||||
, formatDateLong : Int -> String
|
||||
, formatDateShort : Int -> String
|
||||
, directionLabel : Direction -> String
|
||||
}
|
||||
|
||||
|
||||
@ -21,4 +28,7 @@ gb =
|
||||
, openAttachmentFile = "Open attachment file"
|
||||
, gotoDetail = "Go to detail view"
|
||||
, cycleAttachments = "Cycle attachments"
|
||||
, formatDateLong = Messages.DateFormat.formatDateLong Messages.UiLanguage.English
|
||||
, formatDateShort = Messages.DateFormat.formatDateShort Messages.UiLanguage.English
|
||||
, directionLabel = Messages.Data.Direction.gb
|
||||
}
|
||||
|
@ -7,6 +7,8 @@ import Messages.Comp.ItemDetail.Notes
|
||||
import Messages.Comp.ItemDetail.SingleAttachment
|
||||
import Messages.Comp.ItemMail
|
||||
import Messages.Comp.SentMails
|
||||
import Messages.DateFormat as DF
|
||||
import Messages.UiLanguage
|
||||
|
||||
|
||||
type alias Texts =
|
||||
@ -34,6 +36,7 @@ type alias Texts =
|
||||
, createdOn : String
|
||||
, lastUpdateOn : String
|
||||
, sendingMailNow : String
|
||||
, formatDateTime : Int -> String
|
||||
}
|
||||
|
||||
|
||||
@ -63,4 +66,5 @@ gb =
|
||||
, createdOn = "Created on"
|
||||
, lastUpdateOn = "Last update on"
|
||||
, sendingMailNow = "Sending e-mail…"
|
||||
, formatDateTime = DF.formatDateTimeLong Messages.UiLanguage.English
|
||||
}
|
||||
|
@ -2,6 +2,8 @@ module Messages.Comp.ItemDetail.EditForm exposing (Texts, gb)
|
||||
|
||||
import Messages.Basics
|
||||
import Messages.Comp.CustomFieldMultiInput
|
||||
import Messages.DateFormat as DF
|
||||
import Messages.UiLanguage
|
||||
|
||||
|
||||
type alias Texts =
|
||||
@ -21,6 +23,7 @@ type alias Texts =
|
||||
, addNewEquipment : String
|
||||
, editEquipment : String
|
||||
, suggestions : String
|
||||
, formatDate : Int -> String
|
||||
}
|
||||
|
||||
|
||||
@ -47,4 +50,5 @@ item visible. This message will disappear then.
|
||||
, addNewEquipment = "Add new equipment"
|
||||
, editEquipment = "Edit equipment"
|
||||
, suggestions = "Suggestions"
|
||||
, formatDate = DF.formatDateLong Messages.UiLanguage.English
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
module Messages.Comp.ItemDetail.ItemInfoHeader exposing (Texts, gb)
|
||||
|
||||
import Messages.Basics
|
||||
import Messages.DateFormat as DF
|
||||
import Messages.UiLanguage
|
||||
|
||||
|
||||
type alias Texts =
|
||||
@ -9,6 +11,7 @@ type alias Texts =
|
||||
, dueDate : String
|
||||
, source : String
|
||||
, new : String
|
||||
, formatDate : Int -> String
|
||||
}
|
||||
|
||||
|
||||
@ -19,4 +22,5 @@ gb =
|
||||
, dueDate = "Due Date"
|
||||
, source = "Source"
|
||||
, new = "New"
|
||||
, formatDate = DF.formatDateLong Messages.UiLanguage.English
|
||||
}
|
||||
|
@ -1,5 +1,8 @@
|
||||
module Messages.Comp.SentMails exposing (Texts, gb)
|
||||
|
||||
import Messages.DateFormat as DF
|
||||
import Messages.UiLanguage
|
||||
|
||||
|
||||
type alias Texts =
|
||||
{ from : String
|
||||
@ -8,6 +11,7 @@ type alias Texts =
|
||||
, subject : String
|
||||
, sent : String
|
||||
, sender : String
|
||||
, formatDateTime : Int -> String
|
||||
}
|
||||
|
||||
|
||||
@ -19,4 +23,5 @@ gb =
|
||||
, subject = "Subject"
|
||||
, sent = "Sent"
|
||||
, sender = "Sender"
|
||||
, formatDateTime = DF.formatDateTimeLong Messages.UiLanguage.English
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
module Messages.Comp.UserTable exposing (Texts, gb)
|
||||
|
||||
import Messages.Basics
|
||||
import Messages.DateFormat as DF
|
||||
import Messages.UiLanguage
|
||||
|
||||
|
||||
type alias Texts =
|
||||
@ -10,6 +12,7 @@ type alias Texts =
|
||||
, email : String
|
||||
, logins : String
|
||||
, lastLogin : String
|
||||
, formatDateTime : Int -> String
|
||||
}
|
||||
|
||||
|
||||
@ -21,4 +24,5 @@ gb =
|
||||
, email = "E-Mail"
|
||||
, logins = "Logins"
|
||||
, lastLogin = "Last Login"
|
||||
, formatDateTime = DF.formatDateTimeLong Messages.UiLanguage.English
|
||||
}
|
||||
|
13
modules/webapp/src/main/elm/Messages/Data/Direction.elm
Normal file
13
modules/webapp/src/main/elm/Messages/Data/Direction.elm
Normal file
@ -0,0 +1,13 @@
|
||||
module Messages.Data.Direction exposing (gb)
|
||||
|
||||
import Data.Direction exposing (Direction(..))
|
||||
|
||||
|
||||
gb : Direction -> String
|
||||
gb dir =
|
||||
case dir of
|
||||
Incoming ->
|
||||
"Incoming"
|
||||
|
||||
Outgoing ->
|
||||
"Outgoing"
|
433
modules/webapp/src/main/elm/Messages/DateFormat.elm
Normal file
433
modules/webapp/src/main/elm/Messages/DateFormat.elm
Normal file
@ -0,0 +1,433 @@
|
||||
module Messages.DateFormat exposing
|
||||
( format
|
||||
, formatDateLong
|
||||
, formatDateShort
|
||||
, formatDateTimeLong
|
||||
)
|
||||
|
||||
import DateFormat exposing (Token)
|
||||
import DateFormat.Language as DL
|
||||
import Messages.UiLanguage exposing (UiLanguage(..))
|
||||
import Time
|
||||
exposing
|
||||
( Month(..)
|
||||
, Weekday(..)
|
||||
)
|
||||
|
||||
|
||||
type alias DateTimeMsg =
|
||||
{ dateLong : List Token
|
||||
, dateShort : List Token
|
||||
, dateTimeLong : List Token
|
||||
, dateTimeShort : List Token
|
||||
, lang : DL.Language
|
||||
}
|
||||
|
||||
|
||||
get : UiLanguage -> DateTimeMsg
|
||||
get lang =
|
||||
case lang of
|
||||
English ->
|
||||
gb
|
||||
|
||||
|
||||
format : UiLanguage -> (DateTimeMsg -> List Token) -> Int -> String
|
||||
format lang pattern millis =
|
||||
let
|
||||
msg =
|
||||
get lang
|
||||
|
||||
fmt =
|
||||
DateFormat.formatWithLanguage msg.lang (pattern msg)
|
||||
in
|
||||
fmt Time.utc (Time.millisToPosix millis)
|
||||
|
||||
|
||||
formatDateTimeLong : UiLanguage -> Int -> String
|
||||
formatDateTimeLong lang millis =
|
||||
format lang .dateTimeLong millis
|
||||
|
||||
|
||||
formatDateLong : UiLanguage -> Int -> String
|
||||
formatDateLong lang millis =
|
||||
format lang .dateLong millis
|
||||
|
||||
|
||||
formatDateShort : UiLanguage -> Int -> String
|
||||
formatDateShort lang millis =
|
||||
format lang .dateShort millis
|
||||
|
||||
|
||||
|
||||
--- Language Definitions
|
||||
|
||||
|
||||
gb : DateTimeMsg
|
||||
gb =
|
||||
{ dateLong =
|
||||
[ DateFormat.dayOfWeekNameAbbreviated
|
||||
, DateFormat.text ", "
|
||||
, DateFormat.monthNameFull
|
||||
, DateFormat.text " "
|
||||
, DateFormat.dayOfMonthSuffix
|
||||
, DateFormat.text ", "
|
||||
, DateFormat.yearNumber
|
||||
]
|
||||
, dateShort =
|
||||
[ DateFormat.yearNumber
|
||||
, DateFormat.text "/"
|
||||
, DateFormat.monthFixed
|
||||
, DateFormat.text "/"
|
||||
, DateFormat.dayOfMonthFixed
|
||||
]
|
||||
, dateTimeLong =
|
||||
[ DateFormat.dayOfWeekNameAbbreviated
|
||||
, DateFormat.text ", "
|
||||
, DateFormat.monthNameFull
|
||||
, DateFormat.text " "
|
||||
, DateFormat.dayOfMonthSuffix
|
||||
, DateFormat.text ", "
|
||||
, DateFormat.yearNumber
|
||||
, DateFormat.text ", "
|
||||
, DateFormat.hourMilitaryNumber
|
||||
, DateFormat.text ":"
|
||||
, DateFormat.minuteFixed
|
||||
]
|
||||
, dateTimeShort =
|
||||
[ DateFormat.yearNumber
|
||||
, DateFormat.text "/"
|
||||
, DateFormat.monthFixed
|
||||
, DateFormat.text "/"
|
||||
, DateFormat.dayOfMonthFixed
|
||||
, DateFormat.text " "
|
||||
, DateFormat.hourMilitaryNumber
|
||||
, DateFormat.text ":"
|
||||
, DateFormat.minuteFixed
|
||||
]
|
||||
, lang = DL.english
|
||||
}
|
||||
|
||||
|
||||
de : DateTimeMsg
|
||||
de =
|
||||
{ dateLong =
|
||||
[ DateFormat.dayOfWeekNameAbbreviated
|
||||
, DateFormat.text ", "
|
||||
, DateFormat.dayOfMonthSuffix
|
||||
, DateFormat.text " "
|
||||
, DateFormat.monthNameFull
|
||||
, DateFormat.text " "
|
||||
, DateFormat.yearNumber
|
||||
]
|
||||
, dateShort =
|
||||
[ DateFormat.dayOfMonthFixed
|
||||
, DateFormat.text "."
|
||||
, DateFormat.monthFixed
|
||||
, DateFormat.text "."
|
||||
, DateFormat.yearNumber
|
||||
]
|
||||
, dateTimeLong =
|
||||
[ DateFormat.dayOfWeekNameAbbreviated
|
||||
, DateFormat.text ". "
|
||||
, DateFormat.dayOfMonthSuffix
|
||||
, DateFormat.text " "
|
||||
, DateFormat.monthNameFull
|
||||
, DateFormat.text " "
|
||||
, DateFormat.yearNumber
|
||||
, DateFormat.text ", "
|
||||
, DateFormat.hourMilitaryNumber
|
||||
, DateFormat.text ":"
|
||||
, DateFormat.minuteFixed
|
||||
]
|
||||
, dateTimeShort =
|
||||
[ DateFormat.dayOfMonthFixed
|
||||
, DateFormat.text "."
|
||||
, DateFormat.monthFixed
|
||||
, DateFormat.text "."
|
||||
, DateFormat.yearNumber
|
||||
, DateFormat.text " "
|
||||
, DateFormat.hourMilitaryNumber
|
||||
, DateFormat.text ":"
|
||||
, DateFormat.minuteFixed
|
||||
]
|
||||
, lang = german
|
||||
}
|
||||
|
||||
|
||||
{-| French date formats; must be reviewed!
|
||||
-}
|
||||
fr : DateTimeMsg
|
||||
fr =
|
||||
{ dateLong =
|
||||
[ DateFormat.dayOfWeekNameAbbreviated
|
||||
, DateFormat.text ", "
|
||||
, DateFormat.dayOfMonthSuffix
|
||||
, DateFormat.text " "
|
||||
, DateFormat.monthNameFull
|
||||
, DateFormat.text " "
|
||||
, DateFormat.yearNumber
|
||||
]
|
||||
, dateShort =
|
||||
[ DateFormat.dayOfMonthFixed
|
||||
, DateFormat.text "."
|
||||
, DateFormat.monthFixed
|
||||
, DateFormat.text "."
|
||||
, DateFormat.yearNumber
|
||||
]
|
||||
, dateTimeLong =
|
||||
[ DateFormat.dayOfWeekNameAbbreviated
|
||||
, DateFormat.text ". "
|
||||
, DateFormat.dayOfMonthSuffix
|
||||
, DateFormat.text " "
|
||||
, DateFormat.monthNameFull
|
||||
, DateFormat.text " "
|
||||
, DateFormat.yearNumber
|
||||
, DateFormat.text ", "
|
||||
, DateFormat.hourMilitaryNumber
|
||||
, DateFormat.text ":"
|
||||
, DateFormat.minuteFixed
|
||||
]
|
||||
, dateTimeShort =
|
||||
[ DateFormat.dayOfMonthFixed
|
||||
, DateFormat.text "."
|
||||
, DateFormat.monthFixed
|
||||
, DateFormat.text "."
|
||||
, DateFormat.yearNumber
|
||||
, DateFormat.text " "
|
||||
, DateFormat.hourMilitaryNumber
|
||||
, DateFormat.text ":"
|
||||
, DateFormat.minuteFixed
|
||||
]
|
||||
, lang = french
|
||||
}
|
||||
|
||||
|
||||
|
||||
--- Languages for the DateFormat module
|
||||
-- French
|
||||
|
||||
|
||||
{-| The French language!
|
||||
-}
|
||||
french : DL.Language
|
||||
french =
|
||||
DL.Language
|
||||
toFrenchMonthName
|
||||
toFrenchMonthAbbreviation
|
||||
toFrenchWeekdayName
|
||||
(toFrenchWeekdayName >> String.left 3)
|
||||
toEnglishAmPm
|
||||
toFrenchOrdinalSuffix
|
||||
|
||||
|
||||
toFrenchMonthName : Month -> String
|
||||
toFrenchMonthName month =
|
||||
case month of
|
||||
Jan ->
|
||||
"janvier"
|
||||
|
||||
Feb ->
|
||||
"février"
|
||||
|
||||
Mar ->
|
||||
"mars"
|
||||
|
||||
Apr ->
|
||||
"avril"
|
||||
|
||||
May ->
|
||||
"mai"
|
||||
|
||||
Jun ->
|
||||
"juin"
|
||||
|
||||
Jul ->
|
||||
"juillet"
|
||||
|
||||
Aug ->
|
||||
"août"
|
||||
|
||||
Sep ->
|
||||
"septembre"
|
||||
|
||||
Oct ->
|
||||
"octobre"
|
||||
|
||||
Nov ->
|
||||
"novembre"
|
||||
|
||||
Dec ->
|
||||
"décembre"
|
||||
|
||||
|
||||
toFrenchMonthAbbreviation : Month -> String
|
||||
toFrenchMonthAbbreviation month =
|
||||
case month of
|
||||
Jan ->
|
||||
"janv"
|
||||
|
||||
Feb ->
|
||||
"févr"
|
||||
|
||||
Mar ->
|
||||
"mars"
|
||||
|
||||
Apr ->
|
||||
"avr"
|
||||
|
||||
May ->
|
||||
"mai"
|
||||
|
||||
Jun ->
|
||||
"juin"
|
||||
|
||||
Jul ->
|
||||
"juil"
|
||||
|
||||
Aug ->
|
||||
"août"
|
||||
|
||||
Sep ->
|
||||
"sept"
|
||||
|
||||
Oct ->
|
||||
"oct"
|
||||
|
||||
Nov ->
|
||||
"nov"
|
||||
|
||||
Dec ->
|
||||
"déc"
|
||||
|
||||
|
||||
toFrenchWeekdayName : Weekday -> String
|
||||
toFrenchWeekdayName weekday =
|
||||
case weekday of
|
||||
Mon ->
|
||||
"lundi"
|
||||
|
||||
Tue ->
|
||||
"mardi"
|
||||
|
||||
Wed ->
|
||||
"mercredi"
|
||||
|
||||
Thu ->
|
||||
"jeudi"
|
||||
|
||||
Fri ->
|
||||
"vendredi"
|
||||
|
||||
Sat ->
|
||||
"samedi"
|
||||
|
||||
Sun ->
|
||||
"dimanche"
|
||||
|
||||
|
||||
toFrenchOrdinalSuffix : Int -> String
|
||||
toFrenchOrdinalSuffix n =
|
||||
if n == 1 then
|
||||
"er"
|
||||
|
||||
else
|
||||
""
|
||||
|
||||
|
||||
|
||||
-- German
|
||||
|
||||
|
||||
{-| The German language!
|
||||
-}
|
||||
german : DL.Language
|
||||
german =
|
||||
let
|
||||
withDot str =
|
||||
str ++ "."
|
||||
in
|
||||
DL.Language
|
||||
toGermanMonthName
|
||||
(toGermanMonthName >> String.left 3 >> withDot)
|
||||
toGermanWeekdayName
|
||||
(toGermanWeekdayName >> String.left 2 >> withDot)
|
||||
toEnglishAmPm
|
||||
(\_ -> ".")
|
||||
|
||||
|
||||
toGermanMonthName : Month -> String
|
||||
toGermanMonthName month =
|
||||
case month of
|
||||
Jan ->
|
||||
"Januar"
|
||||
|
||||
Feb ->
|
||||
"Februar"
|
||||
|
||||
Mar ->
|
||||
"März"
|
||||
|
||||
Apr ->
|
||||
"April"
|
||||
|
||||
May ->
|
||||
"Mai"
|
||||
|
||||
Jun ->
|
||||
"Juni"
|
||||
|
||||
Jul ->
|
||||
"Juli"
|
||||
|
||||
Aug ->
|
||||
"August"
|
||||
|
||||
Sep ->
|
||||
"September"
|
||||
|
||||
Oct ->
|
||||
"Oktober"
|
||||
|
||||
Nov ->
|
||||
"November"
|
||||
|
||||
Dec ->
|
||||
"Dezember"
|
||||
|
||||
|
||||
toGermanWeekdayName : Weekday -> String
|
||||
toGermanWeekdayName weekday =
|
||||
case weekday of
|
||||
Mon ->
|
||||
"Montag"
|
||||
|
||||
Tue ->
|
||||
"Dienstag"
|
||||
|
||||
Wed ->
|
||||
"Mittwoch"
|
||||
|
||||
Thu ->
|
||||
"Donnerstag"
|
||||
|
||||
Fri ->
|
||||
"Freitag"
|
||||
|
||||
Sat ->
|
||||
"Samstag"
|
||||
|
||||
Sun ->
|
||||
"Sonntag"
|
||||
|
||||
|
||||
|
||||
--- Copy from DateFormat.Language
|
||||
|
||||
|
||||
toEnglishAmPm : Int -> String
|
||||
toEnglishAmPm hour =
|
||||
if hour > 11 then
|
||||
"pm"
|
||||
|
||||
else
|
||||
"am"
|
@ -1,6 +1,8 @@
|
||||
module Messages.Page.Queue exposing (Texts, gb)
|
||||
|
||||
import Messages.Basics
|
||||
import Messages.DateFormat as DF
|
||||
import Messages.UiLanguage
|
||||
|
||||
|
||||
type alias Texts =
|
||||
@ -23,6 +25,7 @@ type alias Texts =
|
||||
, retries : String
|
||||
, changePriority : String
|
||||
, prio : String
|
||||
, formatDateTime : Int -> String
|
||||
}
|
||||
|
||||
|
||||
@ -47,4 +50,5 @@ gb =
|
||||
, retries = "Retries"
|
||||
, changePriority = "Change priority of this job"
|
||||
, prio = "Prio"
|
||||
, formatDateTime = DF.formatDateTimeLong Messages.UiLanguage.English
|
||||
}
|
||||
|
Reference in New Issue
Block a user