Ask your own question, for FREE!
QuestionCove Feedback 21 Online
PureSoulless:

Code a system where you can translate questions into different languages.

PureSoulless:

@ultrilliam

Aratox:

Google Translate exists, however I'm guessing that this is for a computer science class. I'll work on one now.

Aratox:

Okay, I've made a Python project on Replit that fits your needs, here's the code: `main.py` file: ```python from googletrans import Translator def translate_question(question, target_language): translator = Translator() translated = translator.translate(question, dest=target_language) return translated.text def main(): question = input("Enter the question you want to translate: ") target_language = input("Enter the target language (e.g., en for English, es for Spanish): ") try: translated_question = translate_question(question, target_language) print(f"Translated question: {translated_question}") except Exception as e: print(f"Error translating question: {e}") if __name__ == "__main__": main() ``` `pyproject.toml` file: ```python [tool.poetry] name = "python-template" version = "0.1.0" description = "" authors = ["Your Name <you@example.com>"] [tool.poetry.dependencies] python = ">=3.10.0,<3.12" googletrans = "4.0.0-rc1" [tool.pyright] # https://github.com/microsoft/pyright/blob/main/docs/configuration.md useLibraryCodeForTypes = true exclude = [".cache"] [tool.ruff] # https://beta.ruff.rs/docs/configuration/ select = ignore = [build-system] requires = ["poetry-core>=1.0.0"] build-backend = "poetry.core.masonry.api" ``` There are some auto-generated files in the Replit Python template (eg: `poetry.lock`), so I'd say try checking out Replit and its Python packages. I hope that this fits your needs, and if any changes are required, please notify me :)

StevenisGhost:

hmmmm

PureSoulless:

@aratox wrote:
Okay, I've made a Python project on Replit that fits your needs, here's the code: `main.py` file: Python``` from googletrans import Translator def translate_question(question, target_language): translator = Translator() translated = translator.translate(question, dest=target_language) return translated.text def main(): question = input("Enter the question you want to translate: ") target_language = input("Enter the target language (e.g., en for English, es for Spanish): ") try: translated_question = translate_question(question, target_language) print(f"Translated question: {translated_question}") except Exception as e: print(f"Error translating question: {e}") if __name__ == "__main__": main() ``` `pyproject.toml` file: Python``` [tool.poetry] name = "python-template" version = "0.1.0" description = "" authors = ["Your Name <you@example.com>"] [tool.poetry.dependencies] python = ">=3.10.0,<3.12" googletrans = "4.0.0-rc1" [tool.pyright] # https://github.com/microsoft/pyright/blob/main/docs/configuration.md useLibraryCodeForTypes = true exclude = [".cache"] [tool.ruff] # https://beta.ruff.rs/docs/configuration/ select = ignore = [build-system] requires = ["poetry-core>=1.0.0"] build-backend = "poetry.core.masonry.api" ``` There are some auto-generated files in the Replit Python template (eg: `poetry.lock`), so I'd say try checking out Replit and its Python packages. I hope that this fits your needs, and if any changes are required, please notify me :)
Woah, Thank you!

Aratox:

No problem :)

ihy:

@aratox wrote:
Okay, I've made a Python project on Replit that fits your needs, here's the code: `main.py` file: Python``` from googletrans import Translator def translate_question(question, target_language): translator = Translator() translated = translator.translate(question, dest=target_language) return translated.text def main(): question = input("Enter the question you want to translate: ") target_language = input("Enter the target language (e.g., en for English, es for Spanish): ") try: translated_question = translate_question(question, target_language) print(f"Translated question: {translated_question}") except Exception as e: print(f"Error translating question: {e}") if __name__ == "__main__": main() ``` `pyproject.toml` file: Python``` [tool.poetry] name = "python-template" version = "0.1.0" description = "" authors = ["Your Name <you@example.com>"] [tool.poetry.dependencies] python = ">=3.10.0,<3.12" googletrans = "4.0.0-rc1" [tool.pyright] # https://github.com/microsoft/pyright/blob/main/docs/configuration.md useLibraryCodeForTypes = true exclude = [".cache"] [tool.ruff] # https://beta.ruff.rs/docs/configuration/ select = ignore = [build-system] requires = ["poetry-core>=1.0.0"] build-backend = "poetry.core.masonry.api" ``` There are some auto-generated files in the Replit Python template (eg: `poetry.lock`), so I'd say try checking out Replit and its Python packages. I hope that this fits your needs, and if any changes are required, please notify me :)
Aratox, you're literally the GOAT.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!