Add use <tunit> instead of <span> for Deepl translation
To avoid getting results like "... bla."</span>" -> "... bla</span>."" from Deepl we need to set set splitting_tags option to an element name (that's not as common as span).
This commit is contained in:
@ -73,7 +73,7 @@ defmodule Outlook.Translators do
|
||||
|
||||
defp prepare_article(tree) do
|
||||
# Logger.info "so far."
|
||||
HtmlDocComponent.render_doc(%{tree: tree})
|
||||
HtmlDocComponent.render_doc(%{tree: tree, tunit_tag: "tunit"})
|
||||
|> Phoenix.HTML.Safe.to_iodata()
|
||||
|> IO.iodata_to_binary()
|
||||
end
|
||||
@ -86,7 +86,7 @@ defmodule Outlook.Translators do
|
||||
def process_translation(translation, tunit_ids) do
|
||||
tunit_map = translation
|
||||
|> Floki.parse_fragment!
|
||||
|> Floki.find("span.tunit")
|
||||
|> Floki.find("tunit")
|
||||
|> Enum.map(fn {_,atts,cont} ->
|
||||
%TranslationUnit{
|
||||
nid: Enum.find(atts, fn {k,_} -> k == "nid" end) |> Tuple.to_list |> Enum.at(1),
|
||||
|
||||
Reference in New Issue
Block a user