# test_translation.py - Quick translation test from translator import get_translator import json def test_translation(): print("šŸ” Testing AI Translation System...") # Get translator instance translator = get_translator() if translator.init_error: print(f"āŒ Translation Error: {translator.init_error}") return print("āœ… Translator initialized successfully") # Test translation test_text = "Hello, this is a test for the translation system" print(f"\nšŸ”¤ Original text: {test_text}") translated_text, error = translator.translate_text(test_text, target_language='ar') if translated_text: print(f"āœ… Arabic translation: {translated_text}") print(f"šŸ“Š Translation success: True") print(f"šŸ”„ Texts are different: {translated_text != test_text}") else: print(f"āŒ Translation failed: {error}") # Test language detection detected_lang, detect_error = translator.detect_language(test_text) if detected_lang: print(f"šŸŒ Detected language: {detected_lang}") else: print(f"āŒ Language detection failed: {detect_error}") if __name__ == "__main__": test_translation()