diff --git a/config/config.exs b/config/config.exs index 950ac15..7b45df9 100644 --- a/config/config.exs +++ b/config/config.exs @@ -10,6 +10,69 @@ import Config config :outlook, ecto_repos: [Outlook.Repo] +config :outlook, :deepl, + source_langs: [ + {"English", "EN"}, + {"Russian", "RU"}, + {"German", "DE"}, + {"Spanish", "ES"}, + {"Bulgarian", "BG"}, + {"Czech", "CS"}, + {"Danish", "DA"}, + {"Greek", "EL"}, + {"Estonian", "ET"}, + {"Finnish", "FI"}, + {"French", "FR"}, + {"Hungarian", "HU"}, + {"Indonesian", "ID"}, + {"Italian", "IT"}, + {"Japanese", "JA"}, + {"Lithuanian", "LT"}, + {"Latvian", "LV"}, + {"Dutch", "NL"}, + {"Polish", "PL"}, + {"Portuguese", "PT"}, + {"Romanian", "RO"}, + {"Slovak", "SK"}, + {"Slovenian", "SL"}, + {"Swedish", "SV"}, + {"Turkish", "TR"}, + {"Ukrainian", "UK"}, + {"Chinese", "ZH"} + ], + target_langs: [ + {"German", "DE"}, + {"English British", "EN-GB"}, + {"English American", "EN-US"}, + {"Bulgarian", "BG"}, + {"Czech", "CS"}, + {"Danish", "DA"}, + {"Greek", "EL"}, + {"Spanish", "ES"}, + {"Estonian", "ET"}, + {"Finnish", "FI"}, + {"French", "FR"}, + {"Hungarian", "HU"}, + {"Indonesian", "ID"}, + {"Italian", "IT"}, + {"Japanese", "JA"}, + {"Lithuanian", "LT"}, + {"Latvian", "LV"}, + {"Dutch", "NL"}, + {"Polish", "PL"}, + {"Portuguese Brazilian", "PT-BR"}, + {"Portuguese International", "PT-PT"}, + {"Romanian", "RO"}, + {"Russian", "RU"}, + {"Slovak", "SK"}, + {"Slovenian", "SL"}, + {"Swedish", "SV"}, + {"Turkish", "TR"}, + {"Ukrainian", "UK"}, + {"Chinese", "ZH"} + ] + + # Configures the endpoint config :outlook, OutlookWeb.Endpoint, url: [host: "localhost"], diff --git a/lib/outlook_web/live/article_live/form_component.ex b/lib/outlook_web/live/article_live/form_component.ex index f6aff2c..1b52371 100644 --- a/lib/outlook_web/live/article_live/form_component.ex +++ b/lib/outlook_web/live/article_live/form_component.ex @@ -23,7 +23,8 @@ defmodule OutlookWeb.ArticleLive.FormComponent do <.input field={{f, :author_id}} type="hidden" /> <.input field={{f, :title}} type="text" label="title" /> <.input field={{f, :url}} type="text" label="url" /> - <.input field={{f, :language}} type="text" label="language" /> + <.input field={{f, :language}} type="select" label="language" + options={Application.get_env(:outlook,:deepl)[:source_langs]} /> <.input field={{f, :date}} type="datetime-local" label="date" /> <:actions> <.button phx-disable-with="Saving...">Save Article