2019-01-16 10:37:35 +00:00
|
|
|
var locales = {
|
|
|
|
en: {
|
2019-03-04 09:43:08 +00:00
|
|
|
button_new: "new",
|
|
|
|
button_save: "save",
|
2019-01-16 10:37:35 +00:00
|
|
|
button_cancel: "cancel",
|
2019-03-06 13:21:47 +00:00
|
|
|
button_sessions: "sessions",
|
2019-01-16 10:37:35 +00:00
|
|
|
button_delete: "delete",
|
|
|
|
button_login: "login",
|
|
|
|
heading_error: "ERROR!",
|
|
|
|
label_password: "Password:",
|
|
|
|
label_username: "Username:",
|
|
|
|
link_logout: "Logout",
|
|
|
|
span_credentialsavailable: "Login credentials available upon request!",
|
2019-03-06 13:21:47 +00:00
|
|
|
span_loggedinas: "Logged in as",
|
|
|
|
th_username: "Username",
|
|
|
|
th_role: "Role",
|
|
|
|
th_manage: "Manage"
|
2019-01-16 10:37:35 +00:00
|
|
|
},
|
|
|
|
nl: {
|
2019-03-04 09:43:08 +00:00
|
|
|
button_new: "nieuw",
|
|
|
|
button_save: "opslaan",
|
|
|
|
button_cancel: "annuleren",
|
2019-03-06 13:21:47 +00:00
|
|
|
button_sessions: "sessies",
|
2019-01-16 10:37:35 +00:00
|
|
|
button_delete: "verwijder",
|
|
|
|
button_login: "log in",
|
|
|
|
heading_error: "FOUT!",
|
|
|
|
label_password: "Wachtwoord:",
|
|
|
|
label_username: "Gebruikersnaam:",
|
|
|
|
link_logout: "Log uit",
|
|
|
|
span_credentialsavailable: "Inloggegevens verkrijgbaar op aanvraag!",
|
2019-03-06 13:21:47 +00:00
|
|
|
span_loggedinas: "Ingelogd als",
|
|
|
|
th_username: "Gebruikersnaam",
|
|
|
|
th_role: "Rol",
|
|
|
|
th_manage: "Beheer"
|
2019-01-16 10:37:35 +00:00
|
|
|
} // ... etc.
|
|
|
|
};
|
|
|
|
|
|
|
|
$(document).ready(function(){
|
|
|
|
$('[id^=linklanguage-]').click(function() {
|
|
|
|
var selectedlang = $(this).attr('id').split('-')[1];
|
|
|
|
// Replace text of each element with translated value
|
2019-03-06 13:21:47 +00:00
|
|
|
$('[data-translation]').each(function() {
|
2019-01-16 10:37:35 +00:00
|
|
|
$(this).text(locales[selectedlang][$(this).data('translation')]);
|
|
|
|
});
|
|
|
|
// Enable/disable (toggle) anchors
|
|
|
|
$('span#user a.current').removeClass('current');
|
|
|
|
$(this).addClass('current');
|
2019-03-04 09:43:08 +00:00
|
|
|
|
2019-01-16 10:37:35 +00:00
|
|
|
// Store current languagesetting in persistent localstorage
|
|
|
|
localStorage.setItem('language', selectedlang);
|
|
|
|
});
|
2019-03-04 09:43:08 +00:00
|
|
|
|
2019-01-16 10:37:35 +00:00
|
|
|
if (localStorage.getItem('language') !== null) {
|
2019-03-06 13:21:47 +00:00
|
|
|
$('[data-translation]').each(function() {
|
2019-01-16 10:37:35 +00:00
|
|
|
$(this).text(locales[localStorage.getItem('language')][$(this).data('translation')]);
|
|
|
|
});
|
|
|
|
$('span#user a.current').removeClass('current');
|
|
|
|
$('#linklanguage-' + localStorage.getItem('language')).addClass('current');
|
|
|
|
}
|
|
|
|
});
|