Skip to content

Commit

Permalink
if LanguageOfInstruction is number translate it (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
mwkp committed May 21, 2019
1 parent 11802ac commit 01d4ce7
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
24 changes: 23 additions & 1 deletion app/framework/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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');
}

}
1 change: 1 addition & 0 deletions public/locale/de-CH.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ window.kursausschreibung.locale["de-CH"] = {

// properties of an event
"subscriptionFrom": "Start",
"subscriptionDateTo":"Anmeldefrist",
"location": "Ort",
"price": "Preis",
"buildingAddress": "Adresse",
Expand Down

0 comments on commit 01d4ce7

Please sign in to comment.