Translate the menu from Danish to English

Only to be used internally, in the future.
This commit is contained in:
Mikkel Munch Mortensen 2023-03-03 15:00:18 +01:00
parent 8d49e24ed3
commit beb88558ac
3 changed files with 7 additions and 1 deletions

View File

@ -1,2 +1,3 @@
browser-cookie3==0.17.0
googletrans==4.0.0rc1
requests==2.28.2

View File

@ -8,7 +8,7 @@
## Improve the post by including a photo of the menu.
Requirements:
[ ] Ask Google Translate to translate menu from Danish to English.
[x] Ask Google Translate to translate menu from Danish to English.
[ ] Ask Crayion to generate images of the menu in English.
[ ] Include a random image from the Crayion results as an attachment in
the Slack post.

View File

@ -12,6 +12,7 @@ import random
from urllib import error, parse, request
import browser_cookie3
from googletrans import Translator
import requests
@ -78,6 +79,10 @@ else:
menu = menu["Menutekst"]
sys.stdout.write(f"The menu of today ({today}) is: {menu}\n")
# Translate menu from Danish to English.
translation = Translator().translate(menu, src="da", dest="en").text
sys.stdout.write(f"English translation of the menu is: {translation}\n")
# Determine appropriate emojis for the menu.
emojis = []
for emoji, keywords in {