Move ui language into messages

This commit is contained in:
Eike Kettner 2021-04-10 16:13:49 +02:00
parent 92ae22a68d
commit e630786104
6 changed files with 18 additions and 13 deletions

View File

@ -14,6 +14,7 @@ import Data.Flags exposing (Flags)
import Data.UiSettings exposing (UiSettings)
import Data.UiTheme exposing (UiTheme)
import Http
import Messages.UiLanguage exposing (UiLanguage)
import Page exposing (Page(..))
import Page.CollectiveSettings.Data
import Page.Home.Data
@ -25,7 +26,6 @@ import Page.Queue.Data
import Page.Register.Data
import Page.Upload.Data
import Page.UserSettings.Data
import UiLanguage exposing (UiLanguage)
import Url exposing (Url)
@ -101,7 +101,7 @@ init key url flags_ settings =
, uiSettings = settings
, sidebarVisible = settings.sideMenuVisible
, anonymousTheme = Data.UiTheme.Light
, anonymousUiLang = UiLanguage.English
, anonymousUiLang = Messages.UiLanguage.English
, langMenuOpen = False
}
, Cmd.batch
@ -163,7 +163,7 @@ type Msg
defaultPage : Flags -> Page
defaultPage flags =
defaultPage _ =
HomePage

View File

@ -9,6 +9,7 @@ import Html.Attributes exposing (..)
import Html.Events exposing (onClick)
import Messages exposing (Messages)
import Messages.App exposing (Texts)
import Messages.UiLanguage
import Page exposing (Page(..))
import Page.CollectiveSettings.View2 as CollectiveSettings
import Page.Home.Data
@ -22,7 +23,6 @@ import Page.Register.View2 as Register
import Page.Upload.View2 as Upload
import Page.UserSettings.View2 as UserSettings
import Styles as S
import UiLanguage
view : Model -> List (Html Msg)
@ -198,7 +198,7 @@ langMenu model =
[ class dropdownMenu
, classList [ ( "hidden", not model.langMenuOpen ) ]
]
(List.map langItem UiLanguage.all)
(List.map langItem Messages.UiLanguage.all)
]

View File

@ -30,9 +30,9 @@ import Http
import Markdown
import Messages
import Messages.Comp.UiSettingsForm exposing (Texts)
import Messages.UiLanguage exposing (UiLanguage)
import Set exposing (Set)
import Styles as S
import UiLanguage exposing (UiLanguage)
import Util.Maybe
import Util.Tag
@ -150,7 +150,7 @@ init flags settings =
, powerSearchEnabled = settings.powerSearchEnabled
, uiLang = settings.uiLang
, uiLangModel =
Comp.FixedDropdown.init UiLanguage.all
Comp.FixedDropdown.init Messages.UiLanguage.all
, openTabs = Set.empty
}
, Api.getTags flags "" GetTagsResp

View File

@ -31,7 +31,7 @@ import Dict exposing (Dict)
import Html exposing (Attribute)
import Html.Attributes as HA
import Messages
import UiLanguage exposing (UiLanguage)
import Messages.UiLanguage exposing (UiLanguage)
{-| Settings for the web ui. All fields should be optional, since it
@ -167,7 +167,7 @@ defaults =
, uiTheme = Data.UiTheme.Light
, sideMenuVisible = True
, powerSearchEnabled = False
, uiLang = UiLanguage.English
, uiLang = Messages.UiLanguage.English
}
@ -222,7 +222,7 @@ merge given fallback =
, powerSearchEnabled = given.powerSearchEnabled
, uiLang =
Maybe.map Messages.fromIso2 given.uiLang
|> Maybe.withDefault UiLanguage.English
|> Maybe.withDefault Messages.UiLanguage.English
}

View File

@ -16,7 +16,7 @@ import Messages.Page.Queue
import Messages.Page.Register
import Messages.Page.Upload
import Messages.Page.UserSettings
import UiLanguage exposing (UiLanguage(..))
import Messages.UiLanguage exposing (UiLanguage(..))
{-| The messages record contains all strings used in the application.
@ -66,7 +66,7 @@ readIso2 iso =
isIso lang =
iso == toIso2 lang
in
List.filter isIso UiLanguage.all
List.filter isIso Messages.UiLanguage.all
|> List.head
@ -81,6 +81,8 @@ fromIso2 iso =
--- Messages Definitions
-- for flag icons, see https://github.com/lipis/flag-icon-css
-- use two classes: flag-icon flag-icon-xx where xx is the two-letter country code
gb : Messages

View File

@ -1,8 +1,11 @@
module UiLanguage exposing
module Messages.UiLanguage exposing
( UiLanguage(..)
, all
)
{-| This module defines the languages supported in the web app.
-}
type UiLanguage
= English