Skip to content

Commit

Permalink
feature: add swedish language (#385)
Browse files Browse the repository at this point in the history
  • Loading branch information
nwittstruck authored Dec 18, 2024
1 parent 6b76ea2 commit cc19a05
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/qrstorage/qr_codes/qr_code.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ defmodule Qrstorage.Services.Translate.TranslateApiServiceImpl do
:sk => :SK,
:ro => :RO,
:no => :NB,
:da => :DA
:da => :DA,
:sv => :SV
}

@impl TranslateApiService
Expand Down
6 changes: 4 additions & 2 deletions lib/qrstorage/services/tts/text_to_speech_mapping.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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 %{
Expand All @@ -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
Expand Down
3 changes: 3 additions & 0 deletions priv/gettext/de/LC_MESSAGES/languages.po
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,6 @@ msgstr "Norwegisch"

msgid "da"
msgstr "Dänisch"

msgid "sv"
msgstr "Schwedisch"
3 changes: 3 additions & 0 deletions priv/gettext/en/LC_MESSAGES/languages.po
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,6 @@ msgstr "Norwegian"

msgid "da"
msgstr "Danish"

msgid "sv"
msgstr "Swedish"
3 changes: 3 additions & 0 deletions priv/gettext/languages.pot
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,6 @@ msgstr ""

msgid "da"
msgstr ""

msgid "sv"
msgstr ""
2 changes: 1 addition & 1 deletion test/qrstorage_web/views/helpers/voice_helpers_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit cc19a05

Please sign in to comment.