Skip to content

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

Description

@jtzero

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions