mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-04-04 10:29:34 +00:00
Externalize strings for document language
This commit is contained in:
parent
dac95e81e6
commit
e76d574ea3
@ -200,7 +200,7 @@ view2 flags texts settings model =
|
||||
languageCfg =
|
||||
{ makeOption =
|
||||
\l ->
|
||||
{ text = Data.Language.toName l
|
||||
{ text = texts.languageLabel l
|
||||
, additional = ""
|
||||
}
|
||||
, placeholder = ""
|
||||
|
@ -39,6 +39,7 @@ import Html.Attributes exposing (..)
|
||||
import Html.Events exposing (onCheck, onClick, onInput)
|
||||
import Http
|
||||
import Markdown
|
||||
import Messages.LanguageData
|
||||
import Set exposing (Set)
|
||||
import Styles as S
|
||||
import Util.Folder exposing (mkFolderOption)
|
||||
@ -1054,7 +1055,7 @@ viewMetadata2 flags settings model =
|
||||
}
|
||||
|
||||
languageCfg =
|
||||
{ display = Data.Language.toName
|
||||
{ display = Messages.LanguageData.gb
|
||||
, icon = \_ -> Nothing
|
||||
, style = DS.mainStyleWith "flex-grow mr-2"
|
||||
}
|
||||
|
@ -327,10 +327,10 @@ view2 flags texts settings model =
|
||||
languageCfg =
|
||||
{ makeOption =
|
||||
\a ->
|
||||
{ text = Data.Language.toName a
|
||||
{ text = texts.languageLabel a
|
||||
, additional = ""
|
||||
}
|
||||
, placeholder = "Select…"
|
||||
, placeholder = texts.selectPlaceholder
|
||||
, labelColor = \_ -> \_ -> ""
|
||||
, style = DS.mainStyle
|
||||
}
|
||||
|
@ -3,7 +3,6 @@ module Data.Language exposing
|
||||
, all
|
||||
, fromString
|
||||
, toIso3
|
||||
, toName
|
||||
)
|
||||
|
||||
|
||||
@ -125,55 +124,6 @@ toIso3 lang =
|
||||
"lav"
|
||||
|
||||
|
||||
toName : Language -> String
|
||||
toName lang =
|
||||
case lang of
|
||||
German ->
|
||||
"German"
|
||||
|
||||
English ->
|
||||
"English"
|
||||
|
||||
French ->
|
||||
"French"
|
||||
|
||||
Italian ->
|
||||
"Italian"
|
||||
|
||||
Spanish ->
|
||||
"Spanish"
|
||||
|
||||
Portuguese ->
|
||||
"Portuguese"
|
||||
|
||||
Czech ->
|
||||
"Czech"
|
||||
|
||||
Danish ->
|
||||
"Danish"
|
||||
|
||||
Finnish ->
|
||||
"Finnish"
|
||||
|
||||
Norwegian ->
|
||||
"Norwegian"
|
||||
|
||||
Swedish ->
|
||||
"Swedish"
|
||||
|
||||
Russian ->
|
||||
"Russian"
|
||||
|
||||
Romanian ->
|
||||
"Romanian"
|
||||
|
||||
Dutch ->
|
||||
"Dutch"
|
||||
|
||||
Latvian ->
|
||||
"Latvian"
|
||||
|
||||
|
||||
all : List Language
|
||||
all =
|
||||
[ German
|
||||
|
@ -1,6 +1,8 @@
|
||||
module Messages.CollectiveSettingsFormComp exposing (..)
|
||||
|
||||
import Data.Language exposing (Language)
|
||||
import Messages.ClassifierSettingsFormComp
|
||||
import Messages.LanguageData
|
||||
|
||||
|
||||
type alias Texts =
|
||||
@ -17,6 +19,7 @@ type alias Texts =
|
||||
, reindexAllDataHelp : String
|
||||
, autoTagging : String
|
||||
, startNow : String
|
||||
, languageLabel : Language -> String
|
||||
}
|
||||
|
||||
|
||||
@ -39,4 +42,5 @@ gb =
|
||||
++ "You must type OK before clicking the button to avoid accidental re-indexing."
|
||||
, autoTagging = "Auto-Tagging"
|
||||
, startNow = "Start now"
|
||||
, languageLabel = Messages.LanguageData.gb
|
||||
}
|
||||
|
52
modules/webapp/src/main/elm/Messages/LanguageData.elm
Normal file
52
modules/webapp/src/main/elm/Messages/LanguageData.elm
Normal file
@ -0,0 +1,52 @@
|
||||
module Messages.LanguageData exposing (..)
|
||||
|
||||
import Data.Language exposing (Language(..))
|
||||
|
||||
|
||||
gb : Language -> String
|
||||
gb lang =
|
||||
case lang of
|
||||
German ->
|
||||
"German"
|
||||
|
||||
English ->
|
||||
"English"
|
||||
|
||||
French ->
|
||||
"French"
|
||||
|
||||
Italian ->
|
||||
"Italian"
|
||||
|
||||
Spanish ->
|
||||
"Spanish"
|
||||
|
||||
Portuguese ->
|
||||
"Portuguese"
|
||||
|
||||
Czech ->
|
||||
"Czech"
|
||||
|
||||
Danish ->
|
||||
"Danish"
|
||||
|
||||
Finnish ->
|
||||
"Finnish"
|
||||
|
||||
Norwegian ->
|
||||
"Norwegian"
|
||||
|
||||
Swedish ->
|
||||
"Swedish"
|
||||
|
||||
Russian ->
|
||||
"Russian"
|
||||
|
||||
Romanian ->
|
||||
"Romanian"
|
||||
|
||||
Dutch ->
|
||||
"Dutch"
|
||||
|
||||
Latvian ->
|
||||
"Latvian"
|
@ -1,6 +1,8 @@
|
||||
module Messages.SourceFormComp exposing (..)
|
||||
|
||||
import Data.Language exposing (Language)
|
||||
import Messages.Basics
|
||||
import Messages.LanguageData
|
||||
|
||||
|
||||
type alias Texts =
|
||||
@ -20,6 +22,8 @@ type alias Texts =
|
||||
, fileFilterInfo : String
|
||||
, language : String
|
||||
, languageInfo : String
|
||||
, languageLabel : Language -> String
|
||||
, selectPlaceholder : String
|
||||
}
|
||||
|
||||
|
||||
@ -58,4 +62,6 @@ Specify a file glob to filter files when uploading archives
|
||||
, languageInfo =
|
||||
"Used for text extraction and analysis. The collective's "
|
||||
++ "default language is used if not specified here."
|
||||
, languageLabel = Messages.LanguageData.gb
|
||||
, selectPlaceholder = "Select…"
|
||||
}
|
||||
|
@ -1,7 +1,9 @@
|
||||
module Messages.UploadPage exposing (..)
|
||||
|
||||
import Data.Language exposing (Language)
|
||||
import Messages.Basics
|
||||
import Messages.DropzoneComp
|
||||
import Messages.LanguageData
|
||||
|
||||
|
||||
type alias Texts =
|
||||
@ -25,6 +27,7 @@ type alias Texts =
|
||||
, resetLine2 : String
|
||||
}
|
||||
, selectedFiles : String
|
||||
, languageLabel : Language -> String
|
||||
}
|
||||
|
||||
|
||||
@ -54,6 +57,7 @@ gb =
|
||||
, resetLine2 = " to upload more files."
|
||||
}
|
||||
, selectedFiles = "Selected Files"
|
||||
, languageLabel = Messages.LanguageData.gb
|
||||
}
|
||||
|
||||
|
||||
|
@ -74,7 +74,7 @@ renderForm : Texts -> Model -> Html Msg
|
||||
renderForm texts model =
|
||||
let
|
||||
languageCfg =
|
||||
{ display = Data.Language.toName
|
||||
{ display = texts.languageLabel
|
||||
, icon = \_ -> Nothing
|
||||
, style = DS.mainStyleWith "w-40"
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user