-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathi18n.js
More file actions
333 lines (296 loc) · 11.9 KB
/
i18n.js
File metadata and controls
333 lines (296 loc) · 11.9 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
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
// i18n.js — shared translations (works in both Node main process and renderer)
(function (root) {
const strings = {
fr: {
// States
state_thinking: 'Réflexion',
state_running: 'Exécution',
state_waiting: 'En attente',
state_waiting_idle: 'Inactif',
state_pending: 'Action requise',
state_error: 'Erreur',
// Toolbar tooltips
search_placeholder: 'Rechercher...',
view_grid: 'Vue grille',
view_compact: 'Vue compacte',
view_micro: 'Vue micro',
micro_back: 'Retour',
pin_title: 'Always on top',
settings_title: 'Paramètres',
// Empty states
empty_title: 'Aucune session Claude Code',
empty_hint: 'Lancez <code>claude</code> dans un terminal — les sessions apparaissent ici automatiquement',
empty_filtered_title: 'Aucun résultat',
empty_filtered_hint: 'Essayez une autre recherche',
reset: 'Réinitialiser',
// Card details
tool: 'Outil',
duration: 'Durée',
tokens: 'Tokens',
model: 'Modèle',
branch: 'Branche',
// Card actions
action_notifications: 'Notifications',
action_focus_terminal: 'Focus terminal',
action_delete: 'Supprimer',
action_more: "Plus d'options",
action_copy_id: 'Copier le session ID',
action_copied: '✓ Copié',
// Modals
action_rename: 'Renommer',
action_rename_hint: 'Cliquer pour renommer',
cancel: 'Annuler',
close: 'Fermer',
// Settings tabs
tab_general: 'Général',
tab_notifications: 'Notifications',
tab_about: 'À propos',
// Settings — general
auto_launch_label: 'Lancement au démarrage',
auto_launch_hint: 'Ouvrir <strong>Aby Claude Watcher</strong> automatiquement à la connexion',
auto_launch_hint_html: 'Ouvrir <strong>Aby Claude Watcher</strong> automatiquement à la connexion',
language_label: 'Langue',
language_hint: "Langue de l'interface",
// Settings — notifications
volume_label: 'Volume',
test_sound: 'Tester le son',
position_label: "Position à l'écran",
position_top_left: 'Haut gauche',
position_top_right: 'Haut droite',
position_bottom_left: 'Bas gauche',
position_bottom_right: 'Bas droite',
sound_theme_label: 'Tonalité',
sound_theme_hint: 'Style des sons de notification',
sound_theme_default: 'Standard',
sound_theme_vibraphone: 'Vibraphone',
sound_theme_wood: 'Bois',
sound_theme_soft: 'Feutré',
// Settings — about
about_version: 'Version',
update_check_label: 'Aucune vérification récente',
update_check_hint: 'Cliquez pour chercher une mise à jour',
update_checking: 'Vérification...',
update_checking_hint: 'Connexion à GitHub',
update_available: 'Nouvelle version {version} disponible',
update_download_link: 'Télécharger sur GitHub',
update_up_to_date: '{app} est à jour',
update_up_to_date_hint: 'Version {version} — vérifié {when}',
update_no_releases: 'Aucune version publiée',
update_no_releases_hint: "Le projet n'a pas encore de release GitHub",
update_rate_limited: 'Vérifié récemment',
update_rate_limited_hint: 'Dernière vérification {when} — cliquez pour forcer',
update_error: 'Erreur de vérification',
update_error_hint: 'Vérifiez votre connexion',
update_check_btn: 'Vérifier',
update_banner_download: 'Télécharger',
update_install_btn: 'Installer maintenant',
update_downloading: 'Téléchargement {percent}%',
update_installing: 'Installation et redémarrage…',
update_install_failed: 'Échec — voir les logs',
update_open_github: 'Ouvrir sur GitHub',
rel_just_now: "à l'instant",
rel_minutes_ago: 'il y a {n} min',
rel_hour_ago: 'il y a 1 h',
rel_hours_ago: 'il y a {n} h',
rel_day_ago: 'hier',
rel_days_ago: 'il y a {n} jours',
// Notifications
notif_modal: 'Modal in-app',
notif_sound: 'Son',
notif_session_waiting: 'Session en attente',
// Popover
popover_empty: 'Aucune session active',
popover_header: '{n} session{s}',
popover_open: 'Ouvrir',
popover_quit: 'Quitter',
popover_quit_title: 'Quitter Aby Claude Watcher',
// Status bar
status_active: '{n} active{s}',
status_waiting: '{n} en attente',
status_tokens: '{n} tokens',
status_filtered: '{visible}/{total} affichées',
usage_tooltip_5h: '5h : {pct}% — reset {time}',
usage_tooltip_7d: '7j : {pct}% — reset {time}',
usage_tooltip_7d_sonnet: '7j Sonnet : {pct}% — reset {time}',
usage_tooltip_7d_opus: '7j Opus : {pct}% — reset {time}',
usage_unavailable: 'Quota Claude indisponible ({code})',
// Tray
tray_tooltip: '{app} — {n} active{s}',
tray_tooltip_waiting: ' ({n} en attente)',
// About modal
about_title: 'À propos d\'Aby Claude Watcher',
about_tagline: 'Tableau de bord temps réel pour vos sessions Claude Code.',
about_feature_detect: 'Détecte automatiquement chaque nouvelle session Claude Code',
about_feature_state: 'État live par session : reflechit, exécute, attend',
about_feature_notify: 'Notifie quand Claude attend votre saisie',
about_feature_focus: 'Un clic pour revenir au terminal d\'origine',
about_feature_usage: 'Suit les fenêtres 5h et 7 jours avec décompte avant reset',
about_hint: 'Appuyez sur <kbd>Esc</kbd> pour fermer un panneau.',
},
en: {
// States
state_thinking: 'Thinking',
state_running: 'Running',
state_waiting: 'Waiting',
state_waiting_idle: 'Sleeping',
state_pending: 'Needs you',
state_error: 'Error',
// Toolbar tooltips
search_placeholder: 'Search...',
view_grid: 'Grid view',
view_compact: 'Compact view',
view_micro: 'Micro view',
micro_back: 'Back',
pin_title: 'Always on top',
settings_title: 'Settings',
// Empty states
empty_title: 'No Claude Code sessions',
empty_hint: 'Run <code>claude</code> in a terminal — sessions appear here automatically',
empty_filtered_title: 'No results',
empty_filtered_hint: 'Try a different search',
reset: 'Reset',
// Card details
tool: 'Tool',
duration: 'Duration',
tokens: 'Tokens',
model: 'Model',
branch: 'Branch',
// Card actions
action_notifications: 'Notifications',
action_focus_terminal: 'Focus terminal',
action_delete: 'Delete',
action_more: 'More options',
action_copy_id: 'Copy session ID',
action_copied: '✓ Copied',
// Modals
action_rename: 'Rename',
action_rename_hint: 'Click to rename',
cancel: 'Cancel',
close: 'Close',
// Settings tabs
tab_general: 'General',
tab_notifications: 'Notifications',
tab_about: 'About',
// Settings — general
auto_launch_label: 'Launch at startup',
auto_launch_hint: 'Open <strong>Aby Claude Watcher</strong> automatically at login',
auto_launch_hint_html: 'Open <strong>Aby Claude Watcher</strong> automatically at login',
language_label: 'Language',
language_hint: 'Interface language',
// Settings — notifications
volume_label: 'Volume',
test_sound: 'Test sound',
position_label: 'On-screen position',
position_top_left: 'Top left',
position_top_right: 'Top right',
position_bottom_left: 'Bottom left',
position_bottom_right: 'Bottom right',
sound_theme_label: 'Sound theme',
sound_theme_hint: 'Notification sound style',
sound_theme_default: 'Default',
sound_theme_vibraphone: 'Vibraphone',
sound_theme_wood: 'Wood',
sound_theme_soft: 'Soft',
// Settings — about
about_version: 'Version',
update_check_label: 'No recent check',
update_check_hint: 'Click to check for updates',
update_checking: 'Checking...',
update_checking_hint: 'Connecting to GitHub',
update_available: 'New version {version} available',
update_download_link: 'Download on GitHub',
update_up_to_date: '{app} is up to date',
update_up_to_date_hint: 'Version {version} — checked {when}',
update_no_releases: 'No release published',
update_no_releases_hint: 'The project has no GitHub release yet',
update_rate_limited: 'Checked recently',
update_rate_limited_hint: 'Last check {when} — click to force',
update_error: 'Check failed',
update_error_hint: 'Check your connection',
update_check_btn: 'Check',
update_banner_download: 'Download',
update_install_btn: 'Install now',
update_downloading: 'Downloading {percent}%',
update_installing: 'Installing and restarting…',
update_install_failed: 'Failed — check logs',
update_open_github: 'Open on GitHub',
rel_just_now: 'just now',
rel_minutes_ago: '{n} min ago',
rel_hour_ago: '1 h ago',
rel_hours_ago: '{n} h ago',
rel_day_ago: 'yesterday',
rel_days_ago: '{n} days ago',
// Notifications
notif_modal: 'In-app modal',
notif_sound: 'Sound',
notif_session_waiting: 'Session waiting',
// Popover
popover_empty: 'No active session',
popover_header: '{n} session{s}',
popover_open: 'Open',
popover_quit: 'Quit',
popover_quit_title: 'Quit Aby Claude Watcher',
// Status bar
status_active: '{n} active',
status_waiting: '{n} waiting',
status_tokens: '{n} tokens',
status_filtered: '{visible}/{total} shown',
usage_tooltip_5h: '5h: {pct}% — reset {time}',
usage_tooltip_7d: '7d: {pct}% — reset {time}',
usage_tooltip_7d_sonnet: '7d Sonnet: {pct}% — reset {time}',
usage_tooltip_7d_opus: '7d Opus: {pct}% — reset {time}',
usage_unavailable: 'Claude usage unavailable ({code})',
// Tray
tray_tooltip: '{app} — {n} active',
tray_tooltip_waiting: ' ({n} waiting)',
// About modal
about_title: 'About Aby Claude Watcher',
about_tagline: 'Real-time dashboard for your Claude Code sessions.',
about_feature_detect: 'Auto-detects every new Claude Code session as it spawns',
about_feature_state: 'Live state per session: thinking, running, waiting',
about_feature_notify: 'Notifies you when Claude is waiting for your input',
about_feature_focus: 'One click to focus the originating terminal',
about_feature_usage: 'Tracks 5h and 7-day usage windows with countdown to reset',
about_hint: 'Press <kbd>Esc</kbd> to close any panel.',
},
};
let currentLang = 'fr';
function setLanguage(lang) {
if (lang === 'fr' || lang === 'en') currentLang = lang;
}
function getLanguage() {
return currentLang;
}
function detectSystemLanguage() {
try {
const nav = (typeof navigator !== 'undefined' && navigator.language) || '';
const env = (typeof process !== 'undefined' && process.env && (process.env.LANG || process.env.LC_ALL)) || '';
const source = (nav || env).toLowerCase();
if (source.startsWith('fr')) return 'fr';
if (source.startsWith('en')) return 'en';
} catch {}
return 'fr';
}
function t(key, params) {
const dict = strings[currentLang] || strings.fr;
let s = dict[key] || strings.fr[key] || key;
if (params) {
for (const [k, v] of Object.entries(params)) {
s = s.replace(new RegExp(`\\{${k}\\}`, 'g'), v);
}
}
// Handle plural {s} — "" or "s" based on n
if (params && typeof params.n === 'number') {
s = s.replace(/\{s\}/g, params.n !== 1 ? 's' : '');
} else {
s = s.replace(/\{s\}/g, '');
}
return s;
}
const api = { strings, t, setLanguage, getLanguage, detectSystemLanguage };
if (typeof module !== 'undefined' && module.exports) {
module.exports = api;
} else {
root.i18n = api;
}
})(typeof window !== 'undefined' ? window : globalThis);