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