173 lines
4.2 KiB
JavaScript
173 lines
4.2 KiB
JavaScript
// Temporary translation system until Docker rebuild
|
|
const translations = {
|
|
en: {
|
|
navigation: {
|
|
dashboard: 'Dashboard',
|
|
detections: 'Detections',
|
|
devices: 'Devices',
|
|
alerts: 'Alerts',
|
|
settings: 'Settings',
|
|
logout: 'Logout'
|
|
},
|
|
dashboard: {
|
|
title: 'System Overview',
|
|
online: 'Connected',
|
|
offline: 'Disconnected',
|
|
recentDetections: 'Recent Detections',
|
|
systemHealth: 'System Health',
|
|
connectedDevices: 'Connected Devices',
|
|
activeAlerts: 'Active Alerts',
|
|
totalDetections: 'Total Detections',
|
|
noData: 'No data available',
|
|
loading: 'Loading...'
|
|
},
|
|
detections: {
|
|
title: 'Drone Detections',
|
|
noDetections: 'No detections found',
|
|
loading: 'Loading detections...',
|
|
timestamp: 'Timestamp',
|
|
type: 'Type',
|
|
confidence: 'Confidence',
|
|
location: 'Location',
|
|
device: 'Device',
|
|
actions: 'Actions'
|
|
},
|
|
devices: {
|
|
title: 'Device Management',
|
|
noDevices: 'No devices found',
|
|
loading: 'Loading devices...',
|
|
name: 'Name',
|
|
status: 'Status',
|
|
lastSeen: 'Last Seen',
|
|
location: 'Location',
|
|
actions: 'Actions'
|
|
},
|
|
alerts: {
|
|
title: 'Alert Management',
|
|
noAlerts: 'No alerts found',
|
|
loading: 'Loading alerts...',
|
|
type: 'Type',
|
|
priority: 'Priority',
|
|
status: 'Status',
|
|
created: 'Created',
|
|
actions: 'Actions'
|
|
},
|
|
settings: {
|
|
title: 'Settings',
|
|
profile: 'Profile',
|
|
notifications: 'Notifications',
|
|
system: 'System'
|
|
},
|
|
app: {
|
|
title: 'UAM-ILS Drone Detection System'
|
|
},
|
|
common: {
|
|
loading: 'Loading...',
|
|
error: 'Error',
|
|
success: 'Success',
|
|
cancel: 'Cancel',
|
|
save: 'Save',
|
|
delete: 'Delete',
|
|
edit: 'Edit',
|
|
view: 'View',
|
|
close: 'Close',
|
|
refresh: 'Refresh'
|
|
}
|
|
},
|
|
sv: {
|
|
navigation: {
|
|
dashboard: 'Översikt',
|
|
detections: 'Detekteringar',
|
|
devices: 'Enheter',
|
|
alerts: 'Larm',
|
|
settings: 'Inställningar',
|
|
logout: 'Logga ut'
|
|
},
|
|
dashboard: {
|
|
title: 'Systemöversikt',
|
|
online: 'Ansluten',
|
|
offline: 'Frånkopplad',
|
|
recentDetections: 'Senaste detekteringar',
|
|
systemHealth: 'Systemhälsa',
|
|
connectedDevices: 'Anslutna enheter',
|
|
activeAlerts: 'Aktiva larm',
|
|
totalDetections: 'Totala detekteringar',
|
|
noData: 'Ingen data tillgänglig',
|
|
loading: 'Laddar...'
|
|
},
|
|
detections: {
|
|
title: 'Drönaredetekteringar',
|
|
noDetections: 'Inga detekteringar hittades',
|
|
loading: 'Laddar detekteringar...',
|
|
timestamp: 'Tidsstämpel',
|
|
type: 'Typ',
|
|
confidence: 'Säkerhet',
|
|
location: 'Plats',
|
|
device: 'Enhet',
|
|
actions: 'Åtgärder'
|
|
},
|
|
devices: {
|
|
title: 'Enhetshantering',
|
|
noDevices: 'Inga enheter hittades',
|
|
loading: 'Laddar enheter...',
|
|
name: 'Namn',
|
|
status: 'Status',
|
|
lastSeen: 'Senast sedd',
|
|
location: 'Plats',
|
|
actions: 'Åtgärder'
|
|
},
|
|
alerts: {
|
|
title: 'Larmhantering',
|
|
noAlerts: 'Inga larm hittades',
|
|
loading: 'Laddar larm...',
|
|
type: 'Typ',
|
|
priority: 'Prioritet',
|
|
status: 'Status',
|
|
created: 'Skapad',
|
|
actions: 'Åtgärder'
|
|
},
|
|
settings: {
|
|
title: 'Inställningar',
|
|
profile: 'Profil',
|
|
notifications: 'Aviseringar',
|
|
system: 'System'
|
|
},
|
|
app: {
|
|
title: 'UAM-ILS Drönardetekteringssystem'
|
|
},
|
|
common: {
|
|
loading: 'Laddar...',
|
|
error: 'Fel',
|
|
success: 'Framgång',
|
|
cancel: 'Avbryt',
|
|
save: 'Spara',
|
|
delete: 'Ta bort',
|
|
edit: 'Redigera',
|
|
view: 'Visa',
|
|
close: 'Stäng',
|
|
refresh: 'Uppdatera'
|
|
}
|
|
}
|
|
};
|
|
|
|
let currentLanguage = localStorage.getItem('language') || 'en';
|
|
|
|
export const t = (key) => {
|
|
const keys = key.split('.');
|
|
let value = translations[currentLanguage];
|
|
|
|
for (const k of keys) {
|
|
value = value?.[k];
|
|
}
|
|
|
|
return value || key;
|
|
};
|
|
|
|
export const changeLanguage = (lang) => {
|
|
currentLanguage = lang;
|
|
localStorage.setItem('language', lang);
|
|
// Trigger a page refresh to update all components
|
|
window.location.reload();
|
|
};
|
|
|
|
export const getCurrentLanguage = () => currentLanguage; |