Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

translate_document throws Error occurred during document translation: no implicit conversion of nil into String (DeepL::Exceptions::DocumentTranslationError) when source language is nil #8

Open
jtzero opened this issue Nov 22, 2024 · 0 comments

Comments

@jtzero
Copy link

jtzero commented Nov 22, 2024

translate_document states that param can be nil or string

    # @param [String, nil] source_lang Source language to use for the translation. `nil` will cause
    #                                  automatic source langauge detection to be used. Must be

however when passing in a nil it errors

input_document = Tempfile.new(['deep_l', '.html']).tap do |file|
  file.write('<html>Bonjour</html>')
  file.rewind
end
output_document_path = ::Dir::Tmpname.create('deep_l') {}
DeepL.document.translate_document(
  input_document.path,
  output_document_path,
  nil,
  'EN',
  nil,
  tag_handling: 'html',
)

Using an empty string does work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant