Skip to content

Commit 85f8258

Browse files
authored
Update utils.py
1 parent aab469f commit 85f8258

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

utils.py

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
import logging
22
import os
33
import getpass
4-
54
user_home = os.path.expanduser('~')
65
log_dir = os.path.join(user_home, '.hackeros')
76
log_file = os.path.join(log_dir, 'hacker-mode.log')
8-
97
try:
108
os.makedirs(log_dir, exist_ok=True)
119
if not os.access(log_dir, os.W_OK):
@@ -15,7 +13,6 @@
1513
os.makedirs(log_dir, exist_ok=True)
1614
log_file = os.path.join(log_dir, 'hacker-mode.log')
1715
logging.warning(f"Failed to use primary log directory due to: {e}. Using fallback: {log_file}")
18-
1916
try:
2017
logging.basicConfig(
2118
filename=log_file,
@@ -30,7 +27,6 @@
3027
handlers=[logging.StreamHandler()]
3128
)
3229
logging.error(f"Failed to open log file {log_file}: {e}. Logging to console instead.")
33-
3430
lang = 'en'
3531
translations = {
3632
'en': {
@@ -80,7 +76,14 @@
8076
'restart': 'Restart',
8177
'sleep': 'Sleep',
8278
'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}'
8487
},
8588
'pl': {
8689
'settings': 'Ustawienia',
@@ -129,26 +132,29 @@
129132
'restart': 'Uruchom ponownie',
130133
'sleep': 'Uśpij',
131134
'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}'
133143
}
134144
}
135-
136145
def get_text(key, params=None):
137146
text = translations[lang].get(key, key)
138147
if params:
139148
return text.format(**params)
140149
return text
141-
142150
def set_gaming_tool(tool, enabled):
143151
logging.info(f'Setting {tool} to {"enabled" if enabled else "disabled"}')
144-
145152
def set_language(new_lang):
146153
global lang
147154
if new_lang in translations:
148155
lang = new_lang
149156
logging.info(f'Language set to {lang}')
150157
else:
151158
logging.warning(f'Invalid language: {new_lang}')
152-
153159
def setup_language():
154160
pass

0 commit comments

Comments
 (0)