From cc19a05a121d759a3a8b476488381a0ff6ec8df2 Mon Sep 17 00:00:00 2001 From: Nicholas Date: Wed, 18 Dec 2024 13:17:43 +0100 Subject: [PATCH] feature: add swedish language (#385) --- lib/qrstorage/qr_codes/qr_code.ex | 2 +- .../services/translate/translate_api_service_impl.ex | 3 ++- lib/qrstorage/services/tts/text_to_speech_mapping.ex | 6 ++++-- priv/gettext/de/LC_MESSAGES/languages.po | 3 +++ priv/gettext/en/LC_MESSAGES/languages.po | 3 +++ priv/gettext/languages.pot | 3 +++ test/qrstorage_web/views/helpers/voice_helpers_test.exs | 2 +- 7 files changed, 17 insertions(+), 5 deletions(-) diff --git a/lib/qrstorage/qr_codes/qr_code.ex b/lib/qrstorage/qr_codes/qr_code.ex index 9b45b16..976c191 100644 --- a/lib/qrstorage/qr_codes/qr_code.ex +++ b/lib/qrstorage/qr_codes/qr_code.ex @@ -8,7 +8,7 @@ defmodule Qrstorage.QrCodes.QrCode do require Logger - @languages ~w[de en fr es tr pl ar ru it pt nl uk cs el fi hu sk ro no da]a + @languages ~w[de en fr es tr pl ar ru it pt nl uk cs el fi hu sk ro no da sv]a @block_list ~w[https http www] @voices ~w[male female]a diff --git a/lib/qrstorage/services/translate/translate_api_service_impl.ex b/lib/qrstorage/services/translate/translate_api_service_impl.ex index 94413bc..ed05461 100644 --- a/lib/qrstorage/services/translate/translate_api_service_impl.ex +++ b/lib/qrstorage/services/translate/translate_api_service_impl.ex @@ -24,7 +24,8 @@ defmodule Qrstorage.Services.Translate.TranslateApiServiceImpl do :sk => :SK, :ro => :RO, :no => :NB, - :da => :DA + :da => :DA, + :sv => :SV } @impl TranslateApiService diff --git a/lib/qrstorage/services/tts/text_to_speech_mapping.ex b/lib/qrstorage/services/tts/text_to_speech_mapping.ex index 30c357e..f88a81d 100644 --- a/lib/qrstorage/services/tts/text_to_speech_mapping.ex +++ b/lib/qrstorage/services/tts/text_to_speech_mapping.ex @@ -21,7 +21,8 @@ defmodule Qrstorage.Services.Tts.TextToSpeechMapping do :sk => %{"female" => "Simona", "male" => "Jakub"}, :ro => %{"female" => "Adina", "male" => "Teodor"}, :no => %{"female" => "Lykke-DNN"}, - :da => %{"female" => "Lene-DNN"} + :da => %{"female" => "Lene-DNN"}, + :sv => %{"female" => "Maja-e2e", "male" => "Sven"} } @language_codes %{ @@ -44,7 +45,8 @@ defmodule Qrstorage.Services.Tts.TextToSpeechMapping do :sk => "sk_sk", :ro => "ro_ro", :no => "no_nb", - :da => "da_dk" + :da => "da_dk", + :sv => "sv_se" } def voice(language, gender) when is_atom(language) do diff --git a/priv/gettext/de/LC_MESSAGES/languages.po b/priv/gettext/de/LC_MESSAGES/languages.po index e0d5f0a..ccc2e45 100644 --- a/priv/gettext/de/LC_MESSAGES/languages.po +++ b/priv/gettext/de/LC_MESSAGES/languages.po @@ -73,3 +73,6 @@ msgstr "Norwegisch" msgid "da" msgstr "Dänisch" + +msgid "sv" +msgstr "Schwedisch" \ No newline at end of file diff --git a/priv/gettext/en/LC_MESSAGES/languages.po b/priv/gettext/en/LC_MESSAGES/languages.po index fb12195..a91daed 100644 --- a/priv/gettext/en/LC_MESSAGES/languages.po +++ b/priv/gettext/en/LC_MESSAGES/languages.po @@ -73,3 +73,6 @@ msgstr "Norwegian" msgid "da" msgstr "Danish" + +msgid "sv" +msgstr "Swedish" diff --git a/priv/gettext/languages.pot b/priv/gettext/languages.pot index 64ce6f8..15b90d0 100644 --- a/priv/gettext/languages.pot +++ b/priv/gettext/languages.pot @@ -60,3 +60,6 @@ msgstr "" msgid "da" msgstr "" + +msgid "sv" +msgstr "" diff --git a/test/qrstorage_web/views/helpers/voice_helpers_test.exs b/test/qrstorage_web/views/helpers/voice_helpers_test.exs index 13bba97..09968ca 100644 --- a/test/qrstorage_web/views/helpers/voice_helpers_test.exs +++ b/test/qrstorage_web/views/helpers/voice_helpers_test.exs @@ -5,7 +5,7 @@ defmodule QrstorageWeb.VoiceHelpersTest do describe "languages_with_male_voice/0" do test "returns all languages with male voices as json" do - languages = ["es", "nl", "fr", "tr", "de", "en", "ar", "ru", "it", "pt", "fi", "hu", "sk", "ro"] + languages = ["es", "nl", "fr", "tr", "de", "en", "ar", "ru", "it", "pt", "fi", "hu", "sk", "ro", "sv"] assert Enum.sort(Jason.decode!(languages_with_male_voice())) == Enum.sort(languages) end