Skip to content

abethcrane/food-bank-translator

Repository files navigation

food-bank-translator

Takes in a list of output-languages, and a list of input-words (in English) and creates pngs with the translations

Written in Python3, using Pillow for images. Kivy for UI. Uses Microsoft Cognitive Services for the translation.

Created with input from a Seattle organization - currently in use by them.

Output

Created images look something like this:

Testimonials

"We have been LOVING your translation tool-- it's so useful! We got a donation of various baking powders (flour, batter, corn starch, etc) and it has been so easy for me to make a batch of signs really quickly. When the food bank distributes unlabeled food, we have to include a card with the food type on it so I have also used the tool to make quarter-page printouts of the foods. This has saved so much time and made PMFB a much more equitable and accessible place-- thank you!!" - Jill Weidman

Get in touch

Hello! Thanks for your interest. If you're an organization, then please contact me via hello @ bethcrane . com I can create an app package for you and assist you in setting up the subscription keys.

Technical Details

Building from Source

Requirements

    Python 3
    OpenPyXL (for interacting with spreadsheets)
    Requests (for the bing image search code to work)

Gui

    Install kivy
    Run python3 main.py

To use command line

    Ensure you have a folder called output/foodThumbnails and one called output/images (where output is a sibling dir or src).
    Run python3 getLanguageCodes.py (I've included the results here in languageCodes.txt) to see the language codes available
    Modify the input/toLanguages.txt file to include whichever languages you desire
    Modify the input/words.txt file to include the words you'd like to translate
    Create a file called subscriptionKeys/translatorSubscriptionKey.txt and enter your azure translation subscription key in
    Run python3 wordTranslator.py - this will open the words.txt and toLanguages.txt files and output a spreadsheet of translations for each word
    Open the spreadsheet output/translatedWords.xlsx
    Modify any translations you like
    Run python3 imageDownloader.py - this will open the spreadsheet and download an image for each english word
    Open the foodThumbnails folder and check the images. If any images aren't suitable, replace them with new ones of the same name
    Run python3 finalImageCreator.py - this will open the spreadsheet and output an image for each word, with the translations + thumbnail image

Building an app package

I do this using PyInstaller. I have a spec file and use the command pyinstaller options main.spec. I've succesfully copied the output distribution folder onto a computer without python/etc installed for PMFB to use. I've also rebuilt and then just copied across the new .exe it created to successfully update them.

Quirks

    Currently expects a newline at the start of the toLanguages file
    Currently assumes foodThumbnails images are max 512x512 and with the same name (+casing) as the english word in the spreadsheet
    The main app assumes there are 4 languages (1 input + 3 output)

Authors and Contributors

@abethcrane wrote this in late 2018-early 2019 after volunteering with a foodbank and being asked to manually create these images

About

Takes in a list of output-languages, and a list of input-words (in English) and creates pngs with the translations

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages