Commit d119a723 authored by George Kalampokis's avatar George Kalampokis
Browse files

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
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -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");
+1 −1
Original line number Diff line number Diff line
@@ -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>
+1 −1
Original line number Diff line number Diff line
@@ -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>
+5 −0
Original line number Diff line number Diff line
@@ -126,6 +126,11 @@
			"XML": "XML",
			"JSON": "JSON",
			"DOC": "Document"
		},
		"LANGUAGES": {
			"ENGLISH": "English",
			"GREEK": "Greek",
			"SPANISH": "Spanish"
		}
	},
	"COOKIE": {
+5 −0
Original line number Diff line number Diff line
@@ -126,6 +126,11 @@
			"XML": "XML",
			"JSON": "JSON",
			"DOC": "Document"
		},
		"LANGUAGES": {
			"ENGLISH": "Inglés",
			"GREEK": "Griego",
			"SPANISH": "Espanol"
		}
	},
	"COOKIE": {
Loading