Commit 9d01e86f authored by Konstantin Schulz's avatar Konstantin Schulz
Browse files

translations now get updated when a change of language happens

parent 1e5a833c
......@@ -51,7 +51,7 @@
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"sourceMap": true,
"extractCss": true,
"namedChunks": false,
"aot": true,
......
{
"name": "mc_frontend",
"version": "1.0.4",
"version": "1.0.8",
"author": "Ionic Framework",
"homepage": "https://ionicframework.com/",
"scripts": {
......
......@@ -58,7 +58,6 @@ export class CorpusService {
public toastCtrl: ToastController,
public helperService: HelperService,
) {
this.translate.get('ERROR_CORPORA_UNAVAILABLE').subscribe(value => this.corporaUnavailableString = value);
HelperService.waitForConfig().then(() => {
this.checkForUpdates();
this.checkAnnisResponse().then(() => {
......@@ -68,6 +67,9 @@ export class CorpusService {
});
this.initPhenomenonMap();
this.getTranslations();
this.translate.onLangChange.subscribe(() => {
this.getTranslations();
});
}
adjustQueryValue(query: QueryMC) {
......@@ -194,6 +196,7 @@ export class CorpusService {
}
getTranslations() {
this.translate.get('ERROR_CORPORA_UNAVAILABLE').subscribe(value => this.corporaUnavailableString = value);
this.translate.get('EXERCISE_FEEDBACK_CORRECT_DEFAULT').subscribe(value => this.exercise.feedback.correct = value);
this.translate.get('EXERCISE_FEEDBACK_INCORRECT_DEFAULT').subscribe(value => this.exercise.feedback.incorrect = value);
this.translate.get('EXERCISE_FEEDBACK_PARTIALLY_CORRECT_DEFAULT').subscribe((value) => {
......
......@@ -39,9 +39,10 @@ export class ExerciseParametersPage {
public exerciseService: ExerciseService,
public http: HttpClient,
public helperService: HelperService) {
this.translateService.get('TEXT_TOO_LONG').subscribe(
value => this.textTooLongString = value + HelperService.config['maxTextLength']);
this.translateService.get('QUERY_VALUE_EMPTY').subscribe(value => this.emptyQueryValueString = value);
this.translateService.onLangChange.subscribe(() => {
this.initTranslation();
});
this.initTranslation();
}
async generateExercise() {
......@@ -139,4 +140,10 @@ export class ExerciseParametersPage {
toast.present().then();
});
}
private initTranslation() {
this.translateService.get('TEXT_TOO_LONG').subscribe(
value => this.textTooLongString = value + HelperService.config['maxTextLength']);
this.translateService.get('QUERY_VALUE_EMPTY').subscribe(value => this.emptyQueryValueString = value);
}
}
/* tslint:disable:no-string-literal */
import {HttpClient} from '@angular/common/http';
import {Injectable} from '@angular/core';
import {VocabularyCorpus} from 'src/app/models/enum';
......@@ -5,6 +6,8 @@ import {Vocabulary} from 'src/app/models/vocabulary';
import {Sentence} from 'src/app/models/sentence';
import {HelperService} from 'src/app/helper.service';
import {TestResultMC} from 'src/app/models/testResultMC';
import {AnnisResponse} from 'src/app/models/annisResponse';
import {Observable} from 'rxjs';
@Injectable({
providedIn: 'root'
......@@ -46,14 +49,14 @@ export class VocabularyService {
return sentences.map(x => x.matching_degree).reduce((a, b) => a + b) / sentences.length;
}
getVocabularyCheck(query_urn: string, showOOV: boolean) {
getVocabularyCheck(queryUrn: string, showOOV: boolean) {
const url = HelperService.config['backendBaseUrl'] + HelperService.config['backendApiVocabularyPath'];
return this.http.get(url, {
params: {
'vocabulary': VocabularyCorpus[this.currentReferenceVocabulary],
'frequency_upper_bound': this.frequencyUpperBound.toString(),
'query_urn': query_urn,
'show_oov': showOOV ? '1' : '0'
vocabulary: VocabularyCorpus[this.currentReferenceVocabulary],
frequency_upper_bound: this.frequencyUpperBound.toString(),
query_urn: queryUrn,
show_oov: showOOV ? '1' : '0'
}
});
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment