Add translations + bike Shops

This commit is contained in:
Pieter Fiers 2020-07-20 23:43:42 +02:00
parent 232664ee14
commit 2c92f5bbe2
26 changed files with 390 additions and 83 deletions

View file

@ -1,18 +1,23 @@
import { UIEventSource } from "../UIEventSource";
import ParkingType from "../../Customizations/Questions/bike/ParkingType";
const LANGUAGE_KEY = 'language'
export default class Locale {
const
public static language: UIEventSource<string> = new UIEventSource(Locale.getInitialLanguage())
public static init() {
Locale.language.addCallback(data => {
localStorage.setItem(LANGUAGE_KEY, data)
if (window.confirm('In order to change the displayed language, the page needs to be reloaded. Reload now?')) {
location.reload()
}
})
}
private static getInitialLanguage() {
return localStorage.getItem(LANGUAGE_KEY)
return localStorage.getItem(LANGUAGE_KEY) || 'en'
}
}