From c301d332c6a90d1b0037386b8ef05b2a4ca6daa5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anton=20Luka=20=C5=A0ijanec?= Date: Fri, 6 Mar 2020 14:33:35 +0100 Subject: all js files updated with i18n, not tested yet --- js/app.js | 2 +- js/lang/.bundle.js.swp | Bin 0 -> 1024 bytes js/lang/bundle.js | 4 ++++ js/meals.js | 8 -------- js/teachers.js | 13 +++++++------ js/timetable.js | 6 ++---- 6 files changed, 14 insertions(+), 19 deletions(-) create mode 100644 js/lang/.bundle.js.swp diff --git a/js/app.js b/js/app.js index 267868a..f5e9d50 100644 --- a/js/app.js +++ b/js/app.js @@ -15,7 +15,7 @@ if (navigator.serviceWorker) { if (location.protocol != 'https:') { location.href = 'https:' + window.location.href.substring(window.location.protocol.length); } -function UIAlert(usermsg, devmsg) { +async function UIAlert(usermsg, devmsg) { if(true) { // če bo kakšen dev switch? M.toast( { html: usermsg } ); console.log("[BežiApp UIAlert] "+usermsg+" "+devmsg); diff --git a/js/lang/.bundle.js.swp b/js/lang/.bundle.js.swp new file mode 100644 index 0000000..ff341e2 Binary files /dev/null and b/js/lang/.bundle.js.swp differ diff --git a/js/lang/bundle.js b/js/lang/bundle.js index eb9aa2d..b68c22a 100644 --- a/js/lang/bundle.js +++ b/js/lang/bundle.js @@ -136,6 +136,8 @@ var langstrings = { meals: "meals", about: "about", logout: "logout", + // timetable + noPeriods: "no periods in selected week", // gradings requestFailed: "request failed", noInternetConnection: "no internet connection", @@ -280,6 +282,8 @@ var langstrings = { and: "in", thePrivacyPolicy: "politika zasebnosti (v angleščini)", loginFailed: "prijava je spodletela", + // timetable + noPeriods: "ni ur v izbranem tednu", // index timetable: "urnik", gradings: "ocenjevanja", diff --git a/js/meals.js b/js/meals.js index 26b7f0b..f5c9575 100644 --- a/js/meals.js +++ b/js/meals.js @@ -22,14 +22,6 @@ function setLoading(state) { $("#loading-bar").addClass("hidden"); } } -function UIAlert(usermsg, devmsg) { - if(true) { // če bo kakšen dev switch? - M.toast( { html: usermsg } ); - console.log("[BežiApp UIAlert] "+usermsg+" "+devmsg); - } else { - M.toast( { html: usermsg+" "+devmsg } ); - } -} async function getToken(callback, callbackparams = []) { setLoading(true); let promises_to_run = [ diff --git a/js/teachers.js b/js/teachers.js index 39232b5..9634c06 100644 --- a/js/teachers.js +++ b/js/teachers.js @@ -11,7 +11,8 @@ var teachers = null; * @return {String} Returns day as string */ function dayOfWeekAsString(dayIndex) { - return ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"][dayIndex]; + var daysToReturn = [S("monday"), S("tuesday"), S("wednesday"), S("thursday"), S("friday"), S("saturday"), S("sunday")]; + return daysToReturn[dayIndex]; } // Set loading bar visibility @@ -61,7 +62,7 @@ async function loadTeachers(force_refresh = false) { success: (data) => { // If data is null, the request failed if (data === null) { - M.toast({ html: "Request failed!" }); + UIAlert(D("requestFailed")); setLoading(false); } else { // Save teachers & populate table @@ -74,7 +75,7 @@ async function loadTeachers(force_refresh = false) { }, error: () => { - M.toast({ html: "No internet connection!" }); + UIAlert(D("noInternetConnection")); setLoading(false); } @@ -148,9 +149,9 @@ function teacherInfo(teacher_id) { let office_lesson = teacher_object["govorilneure"]["solskaura"]; document.getElementById("teacher-name").innerText = name; - document.getElementById("teacher-subject").innerText = "Subject: " + subject; + document.getElementById("teacher-subject").innerText = S("schoolSubject") + ": " + subject; - document.getElementById("teacher-office").innerText = office_day + ", lesson " + office_lesson; + document.getElementById("teacher-office").innerText = office_day + ", " + S("lesson") + " " + office_lesson; const modal = document.querySelectorAll('.side-modal')[0]; M.Sidenav.getInstance(modal).open(); @@ -176,4 +177,4 @@ document.addEventListener("DOMContentLoaded", () => { // Setup side modal const modals = document.querySelectorAll('.side-modal'); M.Sidenav.init(modals, { edge: 'left', draggable: false }); -}); \ No newline at end of file +}); diff --git a/js/timetable.js b/js/timetable.js index c144ecf..740731a 100644 --- a/js/timetable.js +++ b/js/timetable.js @@ -128,7 +128,7 @@ async function loadTimetable(date_object, force_refresh = false) { success: (data) => { // Check if operation was successful if (data === null) { - M.toast({ html: "No periods in selected week." }); + UIAlert( D("noPeriods") ); setLoading(false); } else { @@ -142,13 +142,11 @@ async function loadTimetable(date_object, force_refresh = false) { displayTimetable(data, date_monday); setLoading(false); }); - - } }, error: () => { - M.toast({ html: "No internet connection!" }); + UIAlert( D( "noInternetConnection" ) ); setLoading(false); } -- cgit v1.2.3