1

If i ask about iphone, the output is: "The iPhone is a line of smartphones designed and marketed by Apple Inc. that use Apple's iOS mobile operating system." But i want to change it into german.

elif 'wikipedia' in query:
            speak('Suche auf wikipedia...')
            query = query.replace("wikipedia", "")
            result = wikipedia.summary(query, sentences = 2)
            print(result)
            speak(result)
akito01
  • 13
  • 3
  • What is `wikipedia`? – mkrieger1 Oct 27 '21 at 17:19
  • sorry, i used: import wikipedia from wikipedia.wikipedia import search – akito01 Oct 27 '21 at 17:49
  • Your question needs more clarification! Please, take a look at "How to Ask A Good Question" (stackoverflow.com/help/how-to-ask) and "How to create a Minimal, Reproducible Example" (stackoverflow.com/help/minimal-reproducible-example). It can help you to enhance your question. – whoisraibolt Oct 27 '21 at 18:59

1 Answers1

0

After importing wikipedia you can set the language as follows:

wikipedia.set_lang('de')

Example:

import wikipedia

wikipedia.set_lang('de')

result = wikipedia.summary('Stack Overflow', sentences = 1)

print(result)

And the output will be:

Pufferüberläufe (englisch buffer overflow) oder – im Besonderen – auch Stapelüberläufe (englisch ‚stack overflows‘) genannt, gehören zu den häufigsten Sicherheitslücken in aktueller Software, die sich u.

whoisraibolt
  • 2,082
  • 3
  • 22
  • 45
  • If the answer solves your problem or you believe it is the best solution. Please, up-vote and mark this answer as accepted! Thank you! If it doesn't solve your problem, let me know! – whoisraibolt Nov 05 '21 at 21:40