Commit d119a723 authored by George Kalampokis's avatar George Kalampokis

Add Translations for the Language names and the Language Controller will...

Add Translations for the Language names and the Language Controller will retrieve it's files from a path instead of the classpath (ref #228)
parent 63ac6df2
......@@ -8,6 +8,7 @@ import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
......@@ -27,11 +28,11 @@ public class LanguageController {
public ResponseEntity getLanguage(@PathVariable String lang) throws IOException {
String fileName = this.environment.getProperty("language.path") + lang + ".json";
InputStream is = getClass().getClassLoader().getResource(fileName).openStream();
InputStream is = new FileInputStream(fileName);
HttpHeaders responseHeaders = new HttpHeaders();
responseHeaders.setContentLength(is.available());
responseHeaders.setContentType(MediaType.APPLICATION_OCTET_STREAM);
responseHeaders.setContentType(MediaType.APPLICATION_JSON);
responseHeaders.set("Content-Disposition", "attachment;filename=" + fileName);
responseHeaders.set("Access-Control-Expose-Headers", "Content-Disposition");
responseHeaders.get("Access-Control-Expose-Headers").add("Content-Type");
......
......@@ -42,7 +42,7 @@
</button>
<mat-menu #languageMenu="matMenu">
<button mat-menu-item *ngFor="let lang of languages" (click)="onLanguageSelected(lang)">
{{ lang.label }}
{{ lang.label | translate }}
</button>
</mat-menu>
</div>
......
......@@ -91,7 +91,7 @@
<mat-select placeholder="{{'USER-PROFILE.SETTINGS.LANGUAGE' | translate}}"
[formControl]="this.formGroup.get('language')" required>
<mat-option *ngFor="let language of languages" [value]="language">
{{ language.label }}
{{ language.label | translate }}
</mat-option>
</mat-select>
</mat-form-field>
......
......@@ -126,6 +126,11 @@
"XML": "XML",
"JSON": "JSON",
"DOC": "Document"
},
"LANGUAGES": {
"ENGLISH": "English",
"GREEK": "Greek",
"SPANISH": "Spanish"
}
},
"COOKIE": {
......
......@@ -126,6 +126,11 @@
"XML": "XML",
"JSON": "JSON",
"DOC": "Document"
},
"LANGUAGES": {
"ENGLISH": "Inglés",
"GREEK": "Griego",
"SPANISH": "Espanol"
}
},
"COOKIE": {
......
......@@ -5,6 +5,11 @@
},
"ACTIONS": {
"LOG-IN": "Είσοδος"
},
"LANGUAGES": {
"ENGLISH": "Αγγλικά",
"GREEK": "Ελληνικά",
"SPANISH": "Ισπανικά"
}
},
"USER-PROFILE": {
......
[
{
"label": "English",
"label": "GENERAL.LANGUAGES.ENGLISH",
"value": "en"
},
{
"label": "Greek",
"label": "GENERAL.LANGUAGES.GREEK",
"value": "gr"
},
{
"label": "Spanish",
"label": "GENERAL.LANGUAGES.SPANISH",
"value": "es"
}
]
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