-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtranslations.py
More file actions
226 lines (222 loc) · 12.1 KB
/
Copy pathtranslations.py
File metadata and controls
226 lines (222 loc) · 12.1 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
TRANSLATIONS = {
"uz": {
"app_name": "Lexicon Pro",
"tagline": "Sizning intellektual lug'at yo'ldoshingiz",
"search_tab": "Qidirish",
"add_tab": "Qo'shish",
"settings_tab": "Sozlamalar",
"search_placeholder": "So'zlarni qidirish...",
"word_label": "So'z",
"definition_label": "Ta'rif",
"add_word_button": "So'z qo'shish",
"about": "Dastur haqida",
"dark_mode": "Qorong'i rejim",
"language": "Til",
"import_format": "Import formati",
"import_words": "So'zlarni import qilish",
"import_description": "CSV yoki JSON fayldan ko'plab lug'at yozuvlarini import qiling.",
"import_button": "Import",
"download_templates": "Shablonlarni yuklab olish:",
"download_csv_template": "CSV shablonini yuklab olish",
"download_json_template": "JSON shablonini yuklab olish",
"edit": "Tahrirlash",
"delete": "O'chirish",
"close": "Yopish",
"cancel": "Bekor qilish",
"save": "Saqlash",
"edit_word": "So'zni tahrirlash",
"delete_word_confirm": "O'chirishni tasdiqlaysizmi",
"delete_warning": "Bu amalni bekor qilib bo'lmaydi.",
"fields_required": "Ikkala maydon ham talab qilinadi!",
"added_successfully": "muvaffaqiyatli qo'shildi!",
"error_adding": "qo'shishda xatolik yuz berdi. So'z allaqachon mavjud bo'lishi mumkin.",
"updated_successfully": "muvaffaqiyatli yangilandi!",
"error_updating": "yangilashda xatolik yuz berdi. So'z allaqachon mavjud bo'lishi mumkin.",
"deleted_successfully": "muvaffaqiyatli o'chirildi!",
"error_deleting": "o'chirishda xatolik yuz berdi.",
"no_word_selected": "Hech qanday so'z tanlanmagan",
"about_content": "Professional lug'at dasturi",
"version": "Versiya 1.0.0",
"copyright": "© 2024 Barcha huquqlar himoyalangan",
"added_on": "Qo'shilgan sana",
"select_file": "CSV yoki JSON faylni tanlang",
"selected": "Tanlangan",
"file_extension_error": "Fayl kengaytmasi tanlangan formatga mos kelmaydi",
"loading_preview": "Oldindan ko'rish yuklanmoqda...",
"file_error": "Faylni o'qib bo'lmadi yoki fayl bo'sh",
"large_file": "Katta fayl aniqlandi",
"file_size": "Fayl hajmi",
"large_file_message": "Bu katta fayl. Tezlikni oshirish uchun oldindan ko'rish imkoni o'chirilgan.",
"proceed_import": "Ushbu faylni import qilishni davom ettirasizmi?",
"processing_options": "Ishlash variantlarini tanlang:",
"skip_duplicates": "Takroriy so'zlarni o'tkazib yuborish (tezroq)",
"show_progress": "Jarayon yangilanishlarini ko'rsatish",
"start_import": "Importni boshlash",
"import_preview": "Import oldindan ko'rish",
"preview_message": "Fayldan dastlabki yozuvlarni oldindan ko'rish. Import qilishni davom ettirasizmi?",
"duplicate_note": "Eslatma: Takroriy so'zlar o'tkazib yuboriladi.",
"processing": "Ishlov berilmoqda...",
"complete": "yakunlandi",
"entries": "yozuvlar",
"no_valid_entries": "Faylda haqiqiy yozuvlar topilmadi.",
"import_completed": "Import muvaffaqiyatli yakunlandi.",
"import_errors": "Import xatolar bilan yakunlandi.",
"of": "dan",
"template_exported": "Shablon eksport qilindi",
"template_success": "shablon ilovalar katalogiga saqlandi",
"export_success": "shablon muvaffaqiyatli eksport qilindi:",
"template_usage": "Endi siz ushbu faylni ma'lumotlarni import qilish uchun shablon sifatida ishlatishingiz mumkin.",
"error_exporting": "Shablonni eksport qilishda xatolik yuz berdi"
},
"en": {
"app_name": "Lexicon Pro",
"tagline": "Your intelligent vocabulary companion",
"search_tab": "Search",
"add_tab": "Add",
"settings_tab": "Settings",
"search_placeholder": "Search words...",
"word_label": "Word",
"definition_label": "Definition",
"add_word_button": "Add Word",
"about": "About",
"dark_mode": "Dark Mode",
"language": "Language",
"import_format": "Import Format",
"import_words": "Import Words",
"import_description": "Import multiple dictionary entries from CSV or JSON file.",
"import_button": "Import",
"download_templates": "Download Templates:",
"download_csv_template": "Download CSV Template",
"download_json_template": "Download JSON Template",
"edit": "Edit",
"delete": "Delete",
"close": "Close",
"cancel": "Cancel",
"save": "Save",
"edit_word": "Edit Word",
"delete_word_confirm": "Delete",
"delete_warning": "This action cannot be undone.",
"fields_required": "Both fields are required!",
"added_successfully": "added successfully!",
"error_adding": "Error adding. Word may already exist.",
"updated_successfully": "updated successfully!",
"error_updating": "Error updating. Word may already exist.",
"deleted_successfully": "deleted successfully!",
"error_deleting": "Error deleting.",
"no_word_selected": "No word selected",
"about_content": "A professional dictionary application",
"version": "Version 1.0.0",
"copyright": "© 2024 All rights reserved",
"added_on": "Added on",
"select_file": "Select a CSV or JSON file",
"selected": "Selected",
"file_extension_error": "Error: File extension doesn't match selected format",
"loading_preview": "Loading preview...",
"file_error": "Error: Could not read file or file is empty",
"large_file": "Large File Detected",
"file_size": "File size",
"large_file_message": "This is a large file. Preview is disabled to improve performance.",
"proceed_import": "Would you like to proceed with importing this file?",
"processing_options": "Choose processing options:",
"skip_duplicates": "Skip duplicate words (faster)",
"show_progress": "Show progress updates",
"start_import": "Start Import",
"import_preview": "Import Preview",
"preview_message": "Preview of first entries from file. Continue with import?",
"duplicate_note": "Note: Duplicate words will be skipped.",
"processing": "Processing...",
"complete": "complete",
"entries": "entries",
"no_valid_entries": "No valid entries found in file.",
"import_completed": "Import completed successfully.",
"import_errors": "Import completed with errors.",
"of": "of",
"template_exported": "Template Exported",
"template_success": "saved to app directory",
"export_success": "has been successfully exported to:",
"template_usage": "You can now use this file as a template for importing data.",
"error_exporting": "Error exporting template"
},
"ru": {
"app_name": "Lexicon Pro",
"tagline": "Ваш интеллектуальный словарный помощник",
"search_tab": "Поиск",
"add_tab": "Добавить",
"settings_tab": "Настройки",
"search_placeholder": "Искать слова...",
"word_label": "Слово",
"definition_label": "Определение",
"add_word_button": "Добавить слово",
"about": "О программе",
"dark_mode": "Тёмный режим",
"language": "Язык",
"import_format": "Формат импорта",
"import_words": "Импорт слов",
"import_description": "Импортируйте несколько словарных записей из файла CSV или JSON.",
"import_button": "Импорт",
"download_templates": "Скачать шаблоны:",
"download_csv_template": "Скачать шаблон CSV",
"download_json_template": "Скачать шаблон JSON",
"edit": "Изменить",
"delete": "Удалить",
"close": "Закрыть",
"cancel": "Отмена",
"save": "Сохранить",
"edit_word": "Изменить слово",
"delete_word_confirm": "Удалить",
"delete_warning": "Это действие нельзя отменить.",
"fields_required": "Оба поля обязательны!",
"added_successfully": "успешно добавлено!",
"error_adding": "Ошибка при добавлении. Слово уже может существовать.",
"updated_successfully": "успешно обновлено!",
"error_updating": "Ошибка при обновлении. Слово уже может существовать.",
"deleted_successfully": "успешно удалено!",
"error_deleting": "Ошибка при удалении.",
"no_word_selected": "Слово не выбрано",
"about_content": "Профессиональное словарное приложение",
"version": "Версия 1.0.0",
"copyright": "© 2024 Все права защищены",
"added_on": "Добавлено",
"select_file": "Выберите файл CSV или JSON",
"selected": "Выбрано",
"file_extension_error": "Ошибка: Расширение файла не соответствует выбранному формату",
"loading_preview": "Загрузка предпросмотра...",
"file_error": "Ошибка: Не удалось прочитать файл или файл пуст",
"large_file": "Обнаружен большой файл",
"file_size": "Размер файла",
"large_file_message": "Это большой файл. Предпросмотр отключен для повышения производительности.",
"proceed_import": "Хотите продолжить импорт этого файла?",
"processing_options": "Выберите параметры обработки:",
"skip_duplicates": "Пропускать повторяющиеся слова (быстрее)",
"show_progress": "Показывать обновления прогресса",
"start_import": "Начать импорт",
"import_preview": "Предпросмотр импорта",
"preview_message": "Предпросмотр первых записей из файла. Продолжить импорт?",
"duplicate_note": "Примечание: Повторяющиеся слова будут пропущены.",
"processing": "Обработка...",
"complete": "завершено",
"entries": "записей",
"no_valid_entries": "В файле не найдено действительных записей.",
"import_completed": "Импорт успешно завершен.",
"import_errors": "Импорт завершен с ошибками.",
"of": "из",
"template_exported": "Шаблон экспортирован",
"template_success": "сохранен в каталог приложения",
"export_success": "был успешно экспортирован в:",
"template_usage": "Теперь вы можете использовать этот файл как шаблон для импорта данных.",
"error_exporting": "Ошибка при экспорте шаблона"
}
}
DEFAULT_LANGUAGE = "uz"
def get_text(key, language=DEFAULT_LANGUAGE):
"""Get translation for a key in the specified language."""
if language not in TRANSLATIONS:
language = DEFAULT_LANGUAGE
return TRANSLATIONS.get(language, {}).get(key, TRANSLATIONS[DEFAULT_LANGUAGE].get(key, key))
def get_language_options():
"""Return the list of available languages."""
return [
{"code": "uz", "name": "O'zbekcha"},
{"code": "en", "name": "English"},
{"code": "ru", "name": "Русский"}
]