Fix jwt-token
This commit is contained in:
61
client/src/utils/tempTranslations.js
Normal file
61
client/src/utils/tempTranslations.js
Normal file
@@ -0,0 +1,61 @@
|
||||
// Temporary translation system until Docker rebuild
|
||||
const translations = {
|
||||
en: {
|
||||
navigation: {
|
||||
dashboard: 'Dashboard',
|
||||
detections: 'Detections',
|
||||
devices: 'Devices',
|
||||
alerts: 'Alerts',
|
||||
settings: 'Settings',
|
||||
logout: 'Logout'
|
||||
},
|
||||
dashboard: {
|
||||
online: 'Connected',
|
||||
offline: 'Disconnected',
|
||||
recentDetections: 'Recent'
|
||||
},
|
||||
app: {
|
||||
title: 'UAM-ILS Management Portal'
|
||||
}
|
||||
},
|
||||
sv: {
|
||||
navigation: {
|
||||
dashboard: 'Översikt',
|
||||
detections: 'Detekteringar',
|
||||
devices: 'Enheter',
|
||||
alerts: 'Larm',
|
||||
settings: 'Inställningar',
|
||||
logout: 'Logga ut'
|
||||
},
|
||||
dashboard: {
|
||||
online: 'Ansluten',
|
||||
offline: 'Frånkopplad',
|
||||
recentDetections: 'Senaste'
|
||||
},
|
||||
app: {
|
||||
title: 'UAM-ILS Förvaltningsportal'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
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;
|
||||
Reference in New Issue
Block a user