This is a submission for the Hacktoberfest Weekend Challenge: Build for a Friend
What I Built
I built a cross-platform Python desktop application of Language Translator supporting real-time translation across 10 languages with efficient event handling. The application allows users to input text and select a target language for translation.
Demo
Code
# -*- coding: utf-8 -*-
from deep_translator import GoogleTranslator
import tkinter as t
from tkinter.ttk import Combobox
from tkinter import messagebox
def clear_text():
txt.delete(0, 'end')
result_label.config(text="")
def translate_text():
input_text = txt.get()
selected_language = combo.get()
language_codes = {
"English": "en",
"Tamil": "ta",
"Telugu": "te",
"Hindi": "hi",
"Malayalam": "ml",
"Kannada": "kn",
"Bengali": "bn",
"Japanese": "ja",
"Arabic": "ar",
"Spanish": "es",
"French": "fr"
}
lang_code = language_codes.get(selected_language)
if lang_code:
try:
translated = GoogleTranslator(source='auto', target=lang_code).translate(input_text)
result_label.config(text=translated)
except Exception as e:
messagebox.showerror("Translation Error", str(e))
else:
messagebox.showerror("Error", "Please select a valid language.")
window = t.Tk()
window.title("Language Translator")
window.geometry("500x300")
l = t.Label(window, text="Enter Text:", font=("Calibri", 18, "bold"))
l.grid(column=0, row=0, padx=10, pady=10)
txt = t.Entry(window, width=25, font=("Calibri", 18))
txt.grid(column=1, row=0, padx=10, pady=10)
combo = Combobox(window, font=("Calibri", 15))
combo['values'] = ("Select Language", "English", "Tamil", "Telugu", "Hindi", "Malayalam", "Kannada", "Bengali", "Japanese", "Arabic", "Spanish", "French")
combo.current(0)
combo.grid(column=1, row=1, padx=10, pady=10)
btn1 = t.Button(window, text="Translate", font=("Calibri", 15, "bold"),
bg="#1e90ff", fg="#fdfff5", activebackground="#1084f9",
activeforeground="#fdfff5", command=translate_text)
btn1.grid(column=1, row=2, padx=10, pady=10)
btn2 = t.Button(window, text="Clear Text", font=("Calibri", 15, "bold"),
bg="#ff1e1e", fg="#fdfff5", activebackground="#ff261e",
activeforeground="#fdfff5", command=clear_text)
btn2.grid(column=0, row=2, padx=10, pady=10)
result_label = t.Label(window, text="", font=("Calibri", 16), wraplength=400, justify="left")
result_label.grid(column=0, row=3, columnspan=3, padx=10, pady=10)
window.mainloop()
How I Built It
Tkinter library for the graphical user interface (GUI)
deep_translator library for translation functionality.
Why Does Open Innovation Matter?
This Project relies on open-source tools like Python's tkinter and the deep_translator library—open innovation plays a fundamental role.
Why Open Innovation Matters for this Language Translator?
- Leveraging Shared Ecosystems: Instead of writing complex machine translation models or building a graphical framework from scratch, open innovation allows developers to stitch together existing open-source components (like deep_translator) to create a functional app quickly.
- Accessibility and Cost Efficiency: Open-source libraries are freely available, removing financial barriers and allowing individual developers to build, test, and deploy software without purchasing expensive commercial licenses or proprietary software development kits (SDKs).
- Community-Driven Maintenance: Open tools benefit from a global community that fixes bugs, handles API shifts, and maintains compatibility over time.
What it Made Possible That a Closed API Wouldn't?
- Complete Independence & No Paywalls: A closed, proprietary translation API often comes with strict rate limits, subscription fees, or mandatory account/credit-card registrations. Open translation libraries give developers the freedom to build and test locally without being locked into a single vendor's ecosystem or pricing model.
- Transparency and Control: With open-source components, you can inspect how the code behaves under the hood, modify the interface using native tools like tkinter, and customize the logic entirely to fit your specific needs without being restricted by the terms of a closed black-box service.
Top comments (0)