Commit 7ee08b8a authored by Konstantin Schulz's avatar Konstantin Schulz
Browse files

added language support for english

parent 4f3fe0d9
......@@ -22,13 +22,13 @@ export class MCclient {
initTranslate() {
// Set the default language for translation strings, and the current language.
this.translate.setDefaultLang('de');
this.translate.setDefaultLang('en');
// if (this.translate.getBrowserLang() !== undefined) {
// this.translate.use(this.translate.getBrowserLang());
// } else {
this.translate.use('de'); // Set your language here
// }
if (this.translate.getBrowserLang() !== undefined) {
this.translate.use(this.translate.getBrowserLang());
} else {
this.translate.use(this.translate.getDefaultLang()); // Set your language here
}
this.translate.get(['BACK_BUTTON_TEXT']).subscribe(values => {
this.config.set('ios', 'backButtonText', values.BACK_BUTTON_TEXT);
......
......@@ -23,7 +23,6 @@
"INSTRUCTIONS": "Anweisungen",
"INSTRUCTIONS_FILL_THE_GAP": "Ordne die Wörter aus dem Pool den richtigen Lücken zu!",
"INVALID_TEXT_RANGE": "Ungültige Textauswahl",
"LOCAL_STORAGE_KEY_CORPORA": "mc/corpora",
"NO_TEXT_RANGE_CHOSEN": "Bitte wähle einen Textausschnitt.",
"PART_OF_SPEECH_CONJUNCTION": "Konjunktion",
"PDF": "PDF",
......
{
"AUTHORS": "Authors",
"AUTHOR_SEARCH": "Search author...",
"AUTHOR_SELECT": "Select author",
"END": "End",
"EXERCISE_DOWNLOAD_NEXT_STEPS": "Next steps:",
"EXERCISE_FEEDBACK": "Feedback",
"EXERCISE_FEEDBACK_CORRECT": "correct",
"EXERCISE_FEEDBACK_CORRECT_DEFAULT": "That's correct. Well done!",
"EXERCISE_FEEDBACK_GENERAL": "general",
"EXERCISE_FEEDBACK_GENERAL_DEFAULT": "The exercise is now finished.",
"EXERCISE_FEEDBACK_INCORRECT": "incorrect",
"EXERCISE_FEEDBACK_INCORRECT_DEFAULT": "Unfortunately, that is incorrect.",
"EXERCISE_FEEDBACK_PARTIALLY_CORRECT": "partially correct",
"EXERCISE_FEEDBACK_PARTIALLY_CORRECT_DEFAULT": "That is partially correct.",
"EXERCISE_FILL_THE_GAP": "Cloze",
"EXERCISE_GENERATE": "Create exercise",
"EXERCISE_TYPE": "Exercise type",
"INSTRUCTION_CHOOSE_FORMAT_AND_IMPORT": "Choose 'Moodle XML format' as file format. Now upload the XML file that you just downloaded, then click on 'Import'.",
"INSTRUCTION_COGWHEEL_MORE": "Click on the cogwheel in the upper right corner, then on 'More'.",
"INSTRUCTION_GO_TO_QUESTION_BANK": "Click on 'Question bank', then on 'Import'.",
"INSTRUCTION_LOGIN_MOODLE": "Download the exercise by clicking on 'XML'. Now log into Moodle and enter the course that is going to contain the exercise.",
"INSTRUCTIONS": "Instructions",
"INSTRUCTIONS_FILL_THE_GAP": "Assign the words from the pool to the correct gaps!",
"INVALID_TEXT_RANGE": "Invalid text range",
"NO_TEXT_RANGE_CHOSEN": "Please choose a text range.",
"PART_OF_SPEECH_CONJUNCTION": "Conjunction",
"PDF": "PDF",
"PHENOMENON_DEPENDENCY": "Dependency",
"PHENOMENON_PART_OF_SPEECH": "Part of speech",
"PREVIEW": "Preview",
"QUERY_PHENOMENON": "Phenomenon",
"QUERY_VALUE": "Search",
"SHOW": "Show",
"START": "Start",
"TEST": "Test",
"WELCOME": "Welcome!",
"XML": "XML"
}
\ No newline at end of file
export class ConfigMC {
public static backendBaseUrl: string = "http://141.20.186.246:5000"; // 141.20.186.246 localhost
public static backendApiPath: string = "/mc/api/v1.0/";
public static backendApiCorporaPath: string = "corpora";
public static backendApiExercisePath: string = "exercise";
public static backendApiFilePath: string = "file";
public static backendApiPath: string = "/mc/api/v1.0/";
public static backendApiRawtextPath: string = "rawtext";
public static backendBaseUrl: string = "http://141.20.186.246:5000"; // 141.20.186.246 localhost
public static localStorageKeyCorpora: string = "mc/corpora";
public static perseidsCTSapiBaseUrl: string = "https://cts.perseids.org/api/cts?request=";
public static perseidsCTSapiGetCapabilities: string = "GetCapabilities";
public static perseidsCTSapiGetValidReff = "GetValidReff";
......
......@@ -84,22 +84,20 @@ export class CorpusProvider {
this.availableCorpora = [];
this.availableAuthors = [];
// check local storage for corpora
this.translate.get("LOCAL_STORAGE_KEY_CORPORA").subscribe((key: string) => {
let storedCorporaJSONstring: string = window.localStorage.getItem(key);
if (!storedCorporaJSONstring) {
// get corpora from REST API
let url = ConfigMC.backendBaseUrl + ConfigMC.backendApiPath + ConfigMC.backendApiCorporaPath;
this.http.get(url).subscribe((data: object) => {
let corpusList: CorpusMC[] = data["corpora"] as CorpusMC[];
window.localStorage.setItem(key, JSON.stringify(corpusList));
this.processCorpora(corpusList);
});
}
else {
let corpusList: CorpusMC[] = JSON.parse(storedCorporaJSONstring) as CorpusMC[];
let storedCorporaJSONstring: string = window.localStorage.getItem(ConfigMC.localStorageKeyCorpora);
if (!storedCorporaJSONstring) {
// get corpora from REST API
let url = ConfigMC.backendBaseUrl + ConfigMC.backendApiPath + ConfigMC.backendApiCorporaPath;
this.http.get(url).subscribe((data: object) => {
let corpusList: CorpusMC[] = data["corpora"] as CorpusMC[];
window.localStorage.setItem(ConfigMC.localStorageKeyCorpora, JSON.stringify(corpusList));
this.processCorpora(corpusList);
}
});
});
}
else {
let corpusList: CorpusMC[] = JSON.parse(storedCorporaJSONstring) as CorpusMC[];
this.processCorpora(corpusList);
}
}
private processCorpora(corpusList: CorpusMC[]) {
......
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