import deepl
auth_key = '_____'
client = deepl.Translator(auth_key, send_platform_info=False)
text_1_plain = '''
‘So you want this hung up in the window, my — in the window, miss?’ asked Mr Dunball.
‘If you could hang it up without inconvenience, sir.’
'''
text_2_plain = '''
I am not angry with you, Edric.
"Thou art a brave lad!" cried the duke.
'''
result_1_plain_default = client.translate_text(
text_1_plain, source_lang='en', target_lang='de',
formality=deepl.Formality.DEFAULT)
result_1_plain_less = client.translate_text(
text_1_plain, source_lang='en', target_lang='de',
formality=deepl.Formality.LESS)
result_1_plain_more = client.translate_text(
text_1_plain, source_lang='en', target_lang='de',
formality=deepl.Formality.MORE)
result_2_plain_default = client.translate_text(
text_2_plain, source_lang='en', target_lang='de',
formality=deepl.Formality.DEFAULT)
result_2_plain_less = client.translate_text(
text_2_plain, source_lang='en', target_lang='de',
formality=deepl.Formality.LESS)
result_2_plain_more = client.translate_text(
text_2_plain, source_lang='en', target_lang='de',
formality=deepl.Formality.MORE)
print('text_1_plain\n', text_1_plain)
print('result_1_plain_default\n', result_1_plain_default)
print('result_1_plain_less\n', result_1_plain_less)
print('result_1_plain_more\n', result_1_plain_more)
print('text_2_plain\n', text_2_plain)
print('result_2_plain_default\n', result_2_plain_default)
print('result_2_plain_less\n', result_2_plain_less)
print('result_2_plain_more\n', result_2_plain_more)
The above code prints this:
text_1_plain
‘So you want this hung up in the window, my — in the window, miss?’ asked Mr Dunball.
‘If you could hang it up without inconvenience, sir.’
result_1_plain_default
Sie wollen also, dass das im Fenster aufgehängt wird, mein - im Fenster, Miss?", fragte Mr. Dunball.
'Wenn Sie es ohne Unannehmlichkeiten aufhängen könnten, Sir.'
result_1_plain_less
Sie wollen also, dass das ins Fenster gehängt wird?", fragte Mr. Dunball.
Wenn Sie es ohne Probleme aufhängen können, Sir.
result_1_plain_more
'Sie wollen also, dass das im Fenster aufgehängt wird, mein - im Fenster, Miss?', fragte Mr. Dunball.
'Wenn Sie es ohne Unannehmlichkeiten aufhängen könnten, Sir.'
text_2_plain
I am not angry with you, Edric.
"Thou art a brave lad!" cried the duke.
result_2_plain_default
Ich bin nicht böse auf dich, Edric.
"Du bist ein tapferer Bursche!", rief der Herzog.
result_2_plain_less
Ich bin nicht böse auf dich, Edric.
"Du bist ein tapferer Junge!", rief der Herzog.
result_2_plain_more
Ich bin nicht böse auf dich, Edric.
"Du bist ein tapferer Bursche!", rief der Herzog.
Looks like the deepl.Formality is ignored.
text_1:
"You" is always translated as "Sie", but should be "Du" if formality==deepl.Formality.LESS
text_2:
"with you" is always translated as "auf dich", but should be " auf Sie" if formality==deepl.Formality.MORE. The same is for "Thou art"
The above code prints this:
Looks like the deepl.Formality is ignored.
text_1: "You" is always translated as "Sie", but should be "Du" if formality==deepl.Formality.LESS
text_2: "with you" is always translated as "auf dich", but should be " auf Sie" if formality==deepl.Formality.MORE. The same is for "Thou art"