|
1 | 1 | import logging |
2 | 2 | import os |
3 | 3 | import getpass |
4 | | - |
5 | 4 | user_home = os.path.expanduser('~') |
6 | 5 | log_dir = os.path.join(user_home, '.hackeros') |
7 | 6 | log_file = os.path.join(log_dir, 'hacker-mode.log') |
8 | | - |
9 | 7 | try: |
10 | 8 | os.makedirs(log_dir, exist_ok=True) |
11 | 9 | if not os.access(log_dir, os.W_OK): |
|
15 | 13 | os.makedirs(log_dir, exist_ok=True) |
16 | 14 | log_file = os.path.join(log_dir, 'hacker-mode.log') |
17 | 15 | logging.warning(f"Failed to use primary log directory due to: {e}. Using fallback: {log_file}") |
18 | | - |
19 | 16 | try: |
20 | 17 | logging.basicConfig( |
21 | 18 | filename=log_file, |
|
30 | 27 | handlers=[logging.StreamHandler()] |
31 | 28 | ) |
32 | 29 | logging.error(f"Failed to open log file {log_file}: {e}. Logging to console instead.") |
33 | | - |
34 | 30 | lang = 'en' |
35 | 31 | translations = { |
36 | 32 | 'en': { |
|
80 | 76 | 'restart': 'Restart', |
81 | 77 | 'sleep': 'Sleep', |
82 | 78 | 'restart_apps': 'Restart Apps', |
83 | | - 'restart_sway': 'Restart Wayfire' |
| 79 | + 'restart_app': 'Restart App', |
| 80 | + 'updates': 'Updates', |
| 81 | + 'check_updates': 'Check for Updates', |
| 82 | + 'apply_updates': 'Apply Updates', |
| 83 | + 'updates_checked': 'Updates checked successfully', |
| 84 | + 'updates_check_failed': 'Failed to check updates: {error}', |
| 85 | + 'updates_applied': 'Updates applied successfully', |
| 86 | + 'updates_apply_failed': 'Failed to apply updates: {error}' |
84 | 87 | }, |
85 | 88 | 'pl': { |
86 | 89 | 'settings': 'Ustawienia', |
|
129 | 132 | 'restart': 'Uruchom ponownie', |
130 | 133 | 'sleep': 'Uśpij', |
131 | 134 | 'restart_apps': 'Uruchom ponownie aplikacje', |
132 | | - 'restart_sway': 'Uruchom ponownie Wayfire' |
| 135 | + 'restart_app': 'Uruchom ponownie aplikację', |
| 136 | + 'updates': 'Aktualizacje', |
| 137 | + 'check_updates': 'Sprawdź aktualizacje', |
| 138 | + 'apply_updates': 'Zainstaluj aktualizacje', |
| 139 | + 'updates_checked': 'Aktualizacje sprawdzone pomyślnie', |
| 140 | + 'updates_check_failed': 'Nie udało się sprawdzić aktualizacji: {error}', |
| 141 | + 'updates_applied': 'Aktualizacje zainstalowane pomyślnie', |
| 142 | + 'updates_apply_failed': 'Nie udało się zainstalować aktualizacji: {error}' |
133 | 143 | } |
134 | 144 | } |
135 | | - |
136 | 145 | def get_text(key, params=None): |
137 | 146 | text = translations[lang].get(key, key) |
138 | 147 | if params: |
139 | 148 | return text.format(**params) |
140 | 149 | return text |
141 | | - |
142 | 150 | def set_gaming_tool(tool, enabled): |
143 | 151 | logging.info(f'Setting {tool} to {"enabled" if enabled else "disabled"}') |
144 | | - |
145 | 152 | def set_language(new_lang): |
146 | 153 | global lang |
147 | 154 | if new_lang in translations: |
148 | 155 | lang = new_lang |
149 | 156 | logging.info(f'Language set to {lang}') |
150 | 157 | else: |
151 | 158 | logging.warning(f'Invalid language: {new_lang}') |
152 | | - |
153 | 159 | def setup_language(): |
154 | 160 | pass |
0 commit comments