CS Proj
CS Proj
BOLINJ, VIRAR(W)
“MULTI-LANGUAGE TRANSLATOR”
SUBMITTED BY:
ANAS ARFEEN
XII AMPERE
ROLL NO: 10
CERTIFICATE
This is to certify that Anas Arfeen, student of Class XII-
Ampere has completed his major project titled:
“MULTI-LANGUAGE TRANSLATOR”
And has submitted the project report for the fulfilment
of the curriculum followed at Matrix academy school,
CBSE, Virar.
ACKNOWLEDGEMENT
I would like to express my gratitude to Mrs. Bristel
Rodrigues Ma’am, for her stimulating guidance
continuous encouragement and supervision
throughout the project work.
3. Code
4. Output
5. Bibliography
INTRODUCTION
This project on Multi-Language Translator is a
software developed using Python to facilitate the
translation of text between multiple languages. Users can
input text in one language and receive accurate
translations in their desired target language. In addition
to text translation, the software also includes a text-to-
speech feature, enabling users to hear the translated
text.
1. Hardware Requirements:
a. Computer/Laptop with at least
i. Processor: Intel i3 or equivalent
ii. RAM: 4 GB or higher
iii. Storage: 100 MB of free disk space
b. Speakers or Headphones (for audio output)
c. Internet Connection (for accessing translation services)
d. Pen drive (For transferring files)
2. Software Requirements:
a. Operating System: Windows 10/11 / macOS / Linux
b. Python: (Programming language used for the project)
c. Modules and Libraries:
i. PyQt5: pip install PyQt5
[Used for creating an intuitive and visually appealing graphical
user interface (GUI).]
ii. Deep Translator: pip install deep_translator
[Provides access to various translation services, enabling
accurate and real-time translations.]
iii. gTTS (Google Text-to-Speech): pip install gTTS
[Used to convert translated text into speech, allowing users to
hear the translation.]
iv. playsound: pip install playsound==1.2.2
[Plays the audio output generated by gTTS.]
d. Python IDE/Editor: VS Code (any Python-supported IDE)
CODE
'''
REQUIRED MODULES AND LIBRARIES:
PyQt5 ------------> pip install PyQt5
deep_translator ------------> pip install deep_translator
gTTS ------------> pip install gTTS
playsound ------------> pip install playsound==1.2.2
import sys
from PyQt5.QtWidgets import (
QApplication,
QMainWindow,
QTextEdit,
QLabel,
QPushButton,
QVBoxLayout,
QHBoxLayout,
QWidget,
QComboBox)
from PyQt5 import QtGui
from PyQt5.QtGui import QTextOption, QFontDatabase, QFont
from PyQt5.QtCore import Qt
from deep_translator import GoogleTranslator
from gtts import gTTS
from playsound import playsound
import os
QPushButton:hover {{
background:{colour2} ;
}}
"""
Dropdownstyle = f"""
QComboBox {{
background-color: {Dropdowncolour1};
border-radius: 10px;
padding: 5px;
color: #333;
}}
QComboBox::drop-down {{
border: none;
background-color: transparent;
width: 30px; /* Adjust width to fit your icon */
}}
QComboBox::down-arrow {{
background-image: url('Datas/dropdown_icon.png');
background-position: center;
background-repeat: no-repeat;
width: 20px; /* Adjust width to fit your icon */
height: 20px; /* Adjust height to fit your icon */
}}
QScrollBar:vertical {{
background: #F0F0F0;
width: 10px;
border: none;
}}
QScrollBar::handle:vertical {{
background: #3fbbe5;
min-height: 20px;
border:none;
}}
QScrollBar::add-line:vertical {{
background: transparent;
height: 0px;
border: none;
}}
QScrollBar::sub-line:vertical {{
background: transparent;
height: 0px;
border:none;
}}
"""
self.languages = list(self.languages1.keys())
self.languages.sort()
def setup_gui(self):
load_fonts()
self.widget = QWidget()
self.widget.setStyleSheet(f"background-color:{Background}")
self.main_layout = QVBoxLayout()
self.welcome_label = QLabel("Welcome to the Translator!") # WELCOME
LABEL
self.welcome_label.setAlignment(Qt.AlignCenter)
self.welcome_label.setFont(QFont(Titlefont, 20))
self.welcome_label.setStyleSheet(f"color:{fontcolour1}")
self.main_layout.addWidget(self.welcome_label)
self.input_language_dropdown.setCurrentIndex(self.languages.index("English"))
self.input_language_dropdown.setFont(QFont(Dropdownfont, 15))
self.input_language_dropdown.setStyleSheet(Dropdownstyle)
self.h_layout.addWidget(self.input_language_dropdown)
self.output_language_dropdown.setCurrentIndex(self.languages.index("Hindi"))
self.output_language_dropdown.setFont(QFont(Dropdownfont, 15))
self.output_language_dropdown.setStyleSheet(Dropdownstyle)
self.h_layout.addWidget(self.output_language_dropdown)
self.widget.setLayout(self.main_layout)
self.setCentralWidget(self.widget)
def translate_text(self):
try:
original_text = self.original_text.toPlainText()
input_lang =
self.languages1[self.input_language_dropdown.currentText()]
output_lang =
self.languages1[self.output_language_dropdown.currentText()]
translated_text = GoogleTranslator(source=input_lang,
target=output_lang).translate(original_text)
self.translated_text = translated_text
self.result_label.setPlainText(translated_text)
except Exception as e:
self.status_label.setText(f"Translation failed: {e}")
def text_to_speech(self):
try:
if not self.translated_text:
self.status_label.setText("Nothing to read!")
return
output_lang =
self.languages1[self.output_language_dropdown.currentText()]
text_to_speech(self.translated_text, output_lang)
self.status_label.setText("Text-to-speech completed!")
except Exception as e:
self.status_label.setText(f"Text-to-speech failed: {e}")
if __name__ == "__main__":
app = QApplication(sys.argv)
translator_app = TranslatorApp()
translator_app.show()
sys.exit(app.exec_())
OUTPUT
BIBLIOGRAPHY
https://docs.python.org/3/
Comprehensive resource for Python's standard library and language
features, offering official guides, tutorials, and reference materials.
Fluent Python by Luciano Ramalho
An in-depth book on writing idiomatic Python code, covering advanced
topics and best practices for Python programming.
https://www.geeksforgeeks.org/real-time-
translation-app-using-python/
A tutorial that explains how to create a real-time language translation app
using Python, providing practical examples and code snippets.
https://medium.com/dataflair/python-language-
translator-project-79dcd6cf2f69
A project-based tutorial on building a Python language translator, focusing
on implementing translation features using various Python libraries.
https://www.riverbankcomputing.com/static/
Docs/PyQt5/
The official documentation for PyQt5, detailing how to use the PyQt5 library
to create cross-platform desktop applications with Python.
https://cloud.google.com/text-to-speech/docs
Documentation for Google Cloud's Text-to-Speech API, which provides
guidelines and examples for converting text into natural-sounding speech
using Google's AI models.
https://github.com/
A platform for hosting and collaborating on open-source software projects,
offering access to a vast collection of code repositories and development
tools.
https://stackoverflow.com/
A community-driven Q&A platform where developers can ask and answer
questions on a wide range of programming topics, including Python and
PyQt5.