Repository navigation
Expand file tree
/
Copy pathtest_language.py
More file actions
58 lines (45 loc) · 1.65 KB
/
Copy pathtest_language.py
File metadata and controls
58 lines (45 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/usr/bin/env python3
"""
Test script to verify language functionality
"""
import sys
import os
# Add current directory to path to import main module
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
from core.language import LanguageManager, LANGUAGE_DICT
def test_language_manager():
"""Test the language manager functionality"""
print("Testing Language Manager...")
# Create language manager
lm = LanguageManager()
# Test default language (should be English)
print(f"Default language: {lm.get_current_language()}")
print(f"Default title: {lm.get_text('main_title')}")
# Test switching to Turkish
lm.set_language('tr')
print(f"Switched to: {lm.get_current_language()}")
print(f"Turkish title: {lm.get_text('main_title')}")
# Test switching back to English
lm.set_language('en')
print(f"Switched to: {lm.get_current_language()}")
print(f"English title: {lm.get_text('main_title')}")
# Test various text keys
test_keys = [
'start_monitoring',
'stop_monitoring',
'cpu_usage',
'ram_usage',
'stress_test_title',
'log_settings'
]
print("\nTesting key translations:")
for key in test_keys:
en_text = LANGUAGE_DICT['en'].get(key, 'KEY_NOT_FOUND')
tr_text = LANGUAGE_DICT['tr'].get(key, 'KEY_NOT_FOUND')
print(f"{key}: EN='{en_text}' | TR='{tr_text}'")
# Test unknown key
unknown_text = lm.get_text('unknown_key')
print(f"\nUnknown key test: '{unknown_text}'")
print("\nLanguage system test completed successfully!")
if __name__ == "__main__":
test_language_manager()