Use externalized strings for edit label

This commit is contained in:
Eike Kettner 2021-04-14 00:11:10 +02:00
parent 9070f69c93
commit 9d6e26efb4
19 changed files with 59 additions and 58 deletions

View File

@ -1,7 +1,6 @@
module Comp.Basic exposing module Comp.Basic exposing
( editLinkLabel ( editLinkLabel
, editLinkTableCell , editLinkTableCell
, editLinkTableCell2
, genericButton , genericButton
, horizontalDivider , horizontalDivider
, inputRequired , inputRequired
@ -17,7 +16,6 @@ module Comp.Basic exposing
import Html exposing (..) import Html exposing (..)
import Html.Attributes exposing (..) import Html.Attributes exposing (..)
import Html.Events exposing (onClick) import Html.Events exposing (onClick)
import Messages.Basics
import Styles as S import Styles as S
@ -192,32 +190,20 @@ loadingDimmer cfg =
] ]
editLinkLabel : msg -> Html msg editLinkLabel : String -> msg -> Html msg
editLinkLabel = editLinkLabel label click =
editLinkLabel2 Messages.Basics.gb
editLinkLabel2 : Messages.Basics.Texts -> msg -> Html msg
editLinkLabel2 texts click =
linkLabel linkLabel
{ label = texts.edit { label = label
, icon = "fa fa-edit" , icon = "fa fa-edit"
, handler = click , handler = click
, disabled = False , disabled = False
} }
editLinkTableCell : msg -> Html msg editLinkTableCell : String -> msg -> Html msg
editLinkTableCell m = editLinkTableCell label m =
td [ class S.editLinkTableCellStyle ] td [ class S.editLinkTableCellStyle ]
[ editLinkLabel2 Messages.Basics.gb m [ editLinkLabel label m
]
editLinkTableCell2 : Messages.Basics.Texts -> msg -> Html msg
editLinkTableCell2 texts m =
td [ class S.editLinkTableCellStyle ]
[ editLinkLabel2 texts m
] ]

View File

@ -118,6 +118,7 @@ update msg model =
type alias ViewSettings = type alias ViewSettings =
{ contactTypeLabel : ContactType -> String { contactTypeLabel : ContactType -> String
, editLabel : String
, mobile : Bool , mobile : Bool
, selectPlaceholder : String , selectPlaceholder : String
} }
@ -172,23 +173,23 @@ view2 cfg _ model =
] ]
, class "flex flex-col space-y-2 mt-2 px-2 border-0 border-l dark:border-bluegray-600 " , class "flex flex-col space-y-2 mt-2 px-2 border-0 border-l dark:border-bluegray-600 "
] ]
(List.map (renderItem2 cfg.mobile) model.items) (List.map (renderItem2 cfg) model.items)
] ]
renderItem2 : Bool -> Contact -> Html Msg renderItem2 : ViewSettings -> Contact -> Html Msg
renderItem2 mobile contact = renderItem2 cfg contact =
div div
[ class "flex flex-row space-x-2 items-center" [ class "flex flex-row space-x-2 items-center"
] ]
[ div [ class "mr-2 flex-nowrap" ] [ div [ class "mr-2 flex-nowrap" ]
[ B.editLinkLabel (Select contact) [ B.editLinkLabel cfg.editLabel (Select contact)
] ]
, div , div
[ class "inline-flex items-center" ] [ class "inline-flex items-center" ]
[ div [ div
[ class "label inline-block mr-2 hidden text-sm " [ class "label inline-block mr-2 hidden text-sm "
, classList [ ( " sm:inline-block", not mobile ) ] , classList [ ( " sm:inline-block", not cfg.mobile ) ]
] ]
[ text contact.kind [ text contact.kind
] ]

View File

@ -66,7 +66,7 @@ view2 texts _ items =
viewItem2 : Texts -> CustomField -> Html Msg viewItem2 : Texts -> CustomField -> Html Msg
viewItem2 texts item = viewItem2 texts item =
tr [ class S.tableRow ] tr [ class S.tableRow ]
[ B.editLinkTableCell (EditItem item) [ B.editLinkTableCell texts.basics.edit (EditItem item)
, td [ class "text-left py-4 md:py-2 pr-2" ] , td [ class "text-left py-4 md:py-2 pr-2" ]
[ text <| Maybe.withDefault item.name item.label [ text <| Maybe.withDefault item.name item.label
] ]

View File

@ -60,12 +60,12 @@ view2 texts model =
] ]
] ]
, tbody [] , tbody []
(List.map (renderLine2 model) model.emailSettings) (List.map (renderLine2 texts model) model.emailSettings)
] ]
renderLine2 : Model -> EmailSettings -> Html Msg renderLine2 : Texts -> Model -> EmailSettings -> Html Msg
renderLine2 _ ems = renderLine2 texts _ ems =
let let
hostport = hostport =
case ems.smtpPort of case ems.smtpPort of
@ -77,7 +77,7 @@ renderLine2 _ ems =
in in
tr tr
[ class S.tableRow ] [ class S.tableRow ]
[ B.editLinkTableCell (Select ems) [ B.editLinkTableCell texts.basics.edit (Select ems)
, td [ class "text-left mr-2" ] , td [ class "text-left mr-2" ]
[ text ems.name [ text ems.name
] ]

View File

@ -75,7 +75,7 @@ renderEquipmentLine2 texts model equip =
[ classList [ ( "active", model.selected == Just equip ) ] [ classList [ ( "active", model.selected == Just equip ) ]
, class S.tableRow , class S.tableRow
] ]
[ B.editLinkTableCell (Select equip) [ B.editLinkTableCell texts.basics.edit (Select equip)
, td [ class "text-left pr-1 md:px-2" ] , td [ class "text-left pr-1 md:px-2" ]
[ div [ class "label inline-flex text-sm" ] [ div [ class "label inline-flex text-sm" ]
[ Data.EquipmentUse.fromString equip.use [ Data.EquipmentUse.fromString equip.use

View File

@ -77,7 +77,7 @@ viewItem2 texts item =
tr tr
[ class S.tableRow [ class S.tableRow
] ]
[ B.editLinkTableCell (EditItem item) [ B.editLinkTableCell texts.basics.edit (EditItem item)
, td [ class " py-4 md:py-2" ] , td [ class " py-4 md:py-2" ]
[ text item.name [ text item.name
, span , span

View File

@ -59,12 +59,12 @@ view2 texts model =
] ]
] ]
, tbody [] , tbody []
(List.map (renderLine2 model) model.emailSettings) (List.map (renderLine2 texts model) model.emailSettings)
] ]
renderLine2 : Model -> ImapSettings -> Html Msg renderLine2 : Texts -> Model -> ImapSettings -> Html Msg
renderLine2 _ ems = renderLine2 texts _ ems =
let let
hostport = hostport =
case ems.imapPort of case ems.imapPort of
@ -76,7 +76,7 @@ renderLine2 _ ems =
in in
tr tr
[ class S.tableRow ] [ class S.tableRow ]
[ B.editLinkTableCell (Select ems) [ B.editLinkTableCell texts.basics.edit (Select ems)
, td [ class "text-left mr-2" ] [ text ems.name ] , td [ class "text-left mr-2" ] [ text ems.name ]
, td [ class "text-left" ] [ text hostport ] , td [ class "text-left" ] [ text hostport ]
] ]

View File

@ -65,15 +65,15 @@ view2 texts _ items =
] ]
] ]
, tbody [] , tbody []
(List.map viewItem2 items) (List.map (viewItem2 texts) items)
] ]
] ]
viewItem2 : NotificationSettings -> Html Msg viewItem2 : Texts -> NotificationSettings -> Html Msg
viewItem2 item = viewItem2 texts item =
tr [] tr []
[ B.editLinkTableCell (EditSettings item) [ B.editLinkTableCell texts.basics.edit (EditSettings item)
, td [ class "w-px whitespace-nowrap px-2 text-center" ] , td [ class "w-px whitespace-nowrap px-2 text-center" ]
[ Util.Html.checkbox2 item.enabled [ Util.Html.checkbox2 item.enabled
] ]

View File

@ -160,6 +160,7 @@ view2 texts mobile settings model =
contactTypeCfg = contactTypeCfg =
{ mobile = mobile { mobile = mobile
, contactTypeLabel = texts.contactTypeLabel , contactTypeLabel = texts.contactTypeLabel
, editLabel = texts.basics.edit
, selectPlaceholder = texts.basics.selectPlaceholder , selectPlaceholder = texts.basics.selectPlaceholder
} }
in in

View File

@ -85,7 +85,7 @@ renderOrgLine2 texts model org =
[ classList [ ( "active", model.selected == Just org ) ] [ classList [ ( "active", model.selected == Just org ) ]
, class S.tableRow , class S.tableRow
] ]
[ B.editLinkTableCell (Select org) [ B.editLinkTableCell texts.basics.edit (Select org)
, td [ class "text-left pr-1 md:px-2" ] , td [ class "text-left pr-1 md:px-2" ]
[ div [ class "label inline-flex text-sm" ] [ div [ class "label inline-flex text-sm" ]
[ Data.OrgUse.fromString org.use [ Data.OrgUse.fromString org.use

View File

@ -192,6 +192,7 @@ view2 texts mobile settings model =
contactCfg = contactCfg =
{ mobile = mobile { mobile = mobile
, contactTypeLabel = texts.contactTypeLabel , contactTypeLabel = texts.contactTypeLabel
, editLabel = texts.basics.edit
, selectPlaceholder = texts.basics.selectPlaceholder , selectPlaceholder = texts.basics.selectPlaceholder
} }
in in

View File

@ -78,7 +78,7 @@ renderPersonLine2 texts model person =
[ classList [ ( "active", model.selected == Just person ) ] [ classList [ ( "active", model.selected == Just person ) ]
, class S.tableRow , class S.tableRow
] ]
[ B.editLinkTableCell (Select person) [ B.editLinkTableCell texts.basics.edit (Select person)
, td [ class "text-left pr-1 md:px-2" ] , td [ class "text-left pr-1 md:px-2" ]
[ div [ class "label inline-flex text-sm" ] [ div [ class "label inline-flex text-sm" ]
[ Data.PersonUse.fromString person.use [ Data.PersonUse.fromString person.use

View File

@ -63,15 +63,15 @@ view2 texts _ items =
] ]
] ]
, tbody [] , tbody []
(List.map viewItem2 items) (List.map (viewItem2 texts) items)
] ]
] ]
viewItem2 : ScanMailboxSettings -> Html Msg viewItem2 : Texts -> ScanMailboxSettings -> Html Msg
viewItem2 item = viewItem2 texts item =
tr [ class S.tableRow ] tr [ class S.tableRow ]
[ B.editLinkTableCell (EditSettings item) [ B.editLinkTableCell texts.basics.edit (EditSettings item)
, td [ class "w-px px-2" ] , td [ class "w-px px-2" ]
[ Util.Html.checkbox2 item.enabled [ Util.Html.checkbox2 item.enabled
] ]

View File

@ -81,7 +81,7 @@ renderSourceLine2 texts source =
[ div [ div
[ class "inline-flex space-x-2" [ class "inline-flex space-x-2"
] ]
[ B.editLinkLabel (Select source) [ B.editLinkLabel texts.basics.edit (Select source)
, B.linkLabel , B.linkLabel
{ label = texts.show { label = texts.show
, icon = "fa fa-eye" , icon = "fa fa-eye"

View File

@ -62,17 +62,17 @@ view2 texts model =
] ]
] ]
, tbody [] , tbody []
(List.map (renderTagLine2 model) model.tags) (List.map (renderTagLine2 texts model) model.tags)
] ]
renderTagLine2 : Model -> Tag -> Html Msg renderTagLine2 : Texts -> Model -> Tag -> Html Msg
renderTagLine2 model tag = renderTagLine2 texts model tag =
tr tr
[ classList [ ( "active", model.selected == Just tag ) ] [ classList [ ( "active", model.selected == Just tag ) ]
, class S.tableRow , class S.tableRow
] ]
[ B.editLinkTableCell (Select tag) [ B.editLinkTableCell texts.basics.edit (Select tag)
, td [ class "text-left py-4 md:py-2" ] , td [ class "text-left py-4 md:py-2" ]
[ text tag.name [ text tag.name
] ]

View File

@ -78,7 +78,7 @@ renderUserLine2 texts model user =
[ classList [ ( "active", model.selected == Just user ) ] [ classList [ ( "active", model.selected == Just user ) ]
, class S.tableRow , class S.tableRow
] ]
[ B.editLinkTableCell2 texts.basics (Select user) [ B.editLinkTableCell texts.basics.edit (Select user)
, td [ class "text-left" ] , td [ class "text-left" ]
[ text user.login [ text user.login
] ]

View File

@ -1,8 +1,11 @@
module Messages.Comp.NotificationTable exposing (Texts, gb) module Messages.Comp.NotificationTable exposing (Texts, gb)
import Messages.Basics
type alias Texts = type alias Texts =
{ summary : String { basics : Messages.Basics.Texts
, summary : String
, schedule : String , schedule : String
, connection : String , connection : String
, recipients : String , recipients : String
@ -11,7 +14,8 @@ type alias Texts =
gb : Texts gb : Texts
gb = gb =
{ summary = "Summary" { basics = Messages.Basics.gb
, summary = "Summary"
, schedule = "Schedule" , schedule = "Schedule"
, connection = "Connection" , connection = "Connection"
, recipients = "Recipients" , recipients = "Recipients"

View File

@ -1,8 +1,11 @@
module Messages.Comp.ScanMailboxTable exposing (Texts, gb) module Messages.Comp.ScanMailboxTable exposing (Texts, gb)
import Messages.Basics
type alias Texts = type alias Texts =
{ summary : String { basics : Messages.Basics.Texts
, summary : String
, connection : String , connection : String
, folders : String , folders : String
, receivedSince : String , receivedSince : String
@ -11,7 +14,8 @@ type alias Texts =
gb : Texts gb : Texts
gb = gb =
{ summary = "Summary" { basics = Messages.Basics.gb
, summary = "Summary"
, connection = "Connection" , connection = "Connection"
, folders = "Folders" , folders = "Folders"
, receivedSince = "Received Since" , receivedSince = "Received Since"

View File

@ -1,8 +1,11 @@
module Messages.Comp.SourceTable exposing (Texts, gb) module Messages.Comp.SourceTable exposing (Texts, gb)
import Messages.Basics
type alias Texts = type alias Texts =
{ abbrev : String { basics : Messages.Basics.Texts
, abbrev : String
, enabled : String , enabled : String
, counter : String , counter : String
, priority : String , priority : String
@ -13,7 +16,8 @@ type alias Texts =
gb : Texts gb : Texts
gb = gb =
{ abbrev = "Abbrev" { basics = Messages.Basics.gb
, abbrev = "Abbrev"
, enabled = "Enabled" , enabled = "Enabled"
, counter = "Counter" , counter = "Counter"
, priority = "Priority" , priority = "Priority"