From 01d4ce7a7f63182b0a2e646510b690b5428c034f Mon Sep 17 00:00:00 2001 From: mwkp Date: Tue, 21 May 2019 10:27:45 +0200 Subject: [PATCH] if LanguageOfInstruction is number translate it (#47) --- app/framework/store.js | 24 +++++++++++++++++++++++- public/locale/de-CH.js | 1 + 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/app/framework/store.js b/app/framework/store.js index fe60b168..f7e6098e 100644 --- a/app/framework/store.js +++ b/app/framework/store.js @@ -8,7 +8,7 @@ import ObjectProxy from '@ember/object/proxy'; import { formatDate, combineDate, isInSubscriptionRange, removeMinutes } from './date-helpers'; import { all } from 'rsvp'; import settings from './settings'; -import { getLanguage } from './translate'; +import { getLanguage, getString } from './translate'; let initialized = false; @@ -223,6 +223,9 @@ function prepareEvent(event) { // add properties to the events addPropertiesToEvent(event); + // set LanguageOfInstruction, if int to string translate value + setLanguageEventFromIntToString(event); + // create proxy for human-readable values addDisplayData(event); @@ -364,3 +367,22 @@ function addPropertiesToEvent(event) { } } +/** + * if LanguageOfInstruction is number translate it + * @param {object} event event returned by the API + */ +function setLanguageEventFromIntToString(event){ + + if (event.LanguageOfInstruction === '2') { + event.LanguageOfInstruction = getString('french'); + } else if (event.LanguageOfInstruction === '1') { + event.LanguageOfInstruction = getString('german'); + } else if (event.LanguageOfInstruction === '133') { + event.LanguageOfInstruction = getString('english'); + } else if (event.LanguageOfInstruction === '284') { + event.LanguageOfInstruction = getString('italian'); + } else if (event.LanguageOfInstruction === '285') { + event.LanguageOfInstruction = getString('spain'); + } + +} \ No newline at end of file diff --git a/public/locale/de-CH.js b/public/locale/de-CH.js index 15ed0e6a..ad64c6a9 100644 --- a/public/locale/de-CH.js +++ b/public/locale/de-CH.js @@ -45,6 +45,7 @@ window.kursausschreibung.locale["de-CH"] = { // properties of an event "subscriptionFrom": "Start", + "subscriptionDateTo":"Anmeldefrist", "location": "Ort", "price": "Preis", "buildingAddress": "Adresse",