-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtranslate_tutorials.py
More file actions
50 lines (43 loc) · 1.55 KB
/
translate_tutorials.py
File metadata and controls
50 lines (43 loc) · 1.55 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
"""
Script to create English versions of tutorial files
This creates a mapping of Russian to English translations
"""
import os
import shutil
# Translation dictionary for common terms
translations = {
# Comments
"# Основы": "# Basics",
"# Создание": "# Creating",
"# Базовый": "# Basic",
"# Простой": "# Simple",
"# Работа с": "# Working with",
"# Примеры": "# Examples",
# Common phrases
"Привет": "Hello",
"Мир": "World",
"Пример": "Example",
"Результат": "Result",
"Ошибка": "Error",
"Функция": "Function",
"Класс": "Class",
"Метод": "Method",
}
# For now, let's just copy files and mark them for manual translation
source_dir = "/Users/pavel/projects/PythonProject/Russian"
target_dir = "/Users/pavel/projects/PythonProject/English"
print(f"Copying files from {source_dir} to {target_dir}")
print("These files will need manual translation of comments and strings")
files_copied = 0
for filename in sorted(os.listdir(source_dir)):
if filename.endswith('.py'):
source = os.path.join(source_dir, filename)
target = os.path.join(target_dir, filename)
shutil.copy2(source, target)
files_copied += 1
print(f"Copied: {filename}")
print(f"\nTotal files copied: {files_copied}")
print("\nNote: Files have been copied. They need translation of:")
print("1. Comments (lines starting with #)")
print("2. String literals in print() statements")
print("3. Variable names in strings (f-strings)")