diff options
author | Christian Hofmaier | 2018-12-08 15:59:50 +0100 |
---|---|---|
committer | Christian Hofmaier | 2018-12-08 15:59:50 +0100 |
commit | dad607e72ee87f40e91dc3c5f342e8df10e3b088 (patch) | |
tree | a206d2091ed16cfa82b4afd21aeee0d1a19befa2 /modules-available/locationinfo | |
parent | Merge branch 'master' of git.openslx.org:openslx-ng/slx-admin (diff) | |
download | slx-admin-dad607e72ee87f40e91dc3c5f342e8df10e3b088.tar.gz slx-admin-dad607e72ee87f40e91dc3c5f342e8df10e3b088.tar.xz slx-admin-dad607e72ee87f40e91dc3c5f342e8df10e3b088.zip |
[locationinfo] fix summary pannel always in german
Diffstat (limited to 'modules-available/locationinfo')
-rw-r--r-- | modules-available/locationinfo/templates/frontend-summary.html | 46 |
1 files changed, 42 insertions, 4 deletions
diff --git a/modules-available/locationinfo/templates/frontend-summary.html b/modules-available/locationinfo/templates/frontend-summary.html index adb3ce39..a3fa77b0 100644 --- a/modules-available/locationinfo/templates/frontend-summary.html +++ b/modules-available/locationinfo/templates/frontend-summary.html @@ -1,5 +1,5 @@ <!DOCTYPE html> -<html lang="de"> +<html lang="{{language}}"> <meta name="viewport" content="width=device-width, initial-scale=1.0" charset="utf-8"> <head> <script type='text/javascript' src='{{dirprefix}}script/jquery.js'></script> @@ -108,6 +108,10 @@ border-radius: 1px; } + #i18n { + display: none; + } + </style> <script type='text/javascript'> @@ -278,14 +282,14 @@ updateCourseText(room.id, state.titel); updateCoursTimer(room.id, GetTimeDiferenceAsString(state.end, MyDate())); } else if (state.state == "Free") { - updateCourseText(room.id, "Frei"); + updateCourseText(room.id, t("free")); updateCoursTimer(room.id, GetTimeDiferenceAsString(state.end, MyDate())); } else if (state.state == "FreeNoEnd") { - updateCourseText(room.id, "Frei"); + updateCourseText(room.id, t("free")); updateCoursTimer(room.id, ""); } else if (state.state == "closed") { - updateCourseText(room.id, "Geschlossen"); + updateCourseText(room.id, t("closed")); updateCoursTimer(room.id, ""); } } @@ -757,9 +761,43 @@ }) } + /** + * Function for translation + * @param toTranslate key which we want to translate + * @returns r translated string + */ + function t(toTranslate) { + if (tCache[toTranslate]) + return tCache[toTranslate]; + var r = $('#i18n').find('[data-tag="' + toTranslate + '"]'); + return tCache[toTranslate] = (r.length === 0 ? toTranslate : r.text()); + } + var tCache = {}; + </script> </head> <body> <div id="main"></div> + +<div id="i18n"> + <span data-tag="room">{{lang_room}}</span> + <span data-tag="closed">{{lang_closed}}</span> + <span data-tag="free">{{lang_free}}</span> + <span data-tag="shortSun">{{lang_shortSun}}</span> + <span data-tag="shortMon">{{lang_shortMon}}</span> + <span data-tag="shortTue">{{lang_shortTue}}</span> + <span data-tag="shortWed">{{lang_shortWed}}</span> + <span data-tag="shortThu">{{lang_shortThu}}</span> + <span data-tag="shortFri">{{lang_shortFri}}</span> + <span data-tag="shortSat">{{lang_shortSat}}</span> + <span data-tag="longSun">{{lang_longSun}}</span> + <span data-tag="longMon">{{lang_longMon}}</span> + <span data-tag="longTue">{{lang_longTue}}</span> + <span data-tag="longWed">{{lang_longWed}}</span> + <span data-tag="longThu">{{lang_longThu}}</span> + <span data-tag="longFri">{{lang_longFri}}</span> + <span data-tag="longSat">{{lang_longSat}}</span> + <span data-tag="to">{{lang_to}}</span> +</div> </body> </html> |