forked from MapComplete/MapComplete
Half complete i18n
This commit is contained in:
parent
7c1c9bc80a
commit
232664ee14
10 changed files with 100 additions and 24 deletions
18
UI/i18n/Locale.ts
Normal file
18
UI/i18n/Locale.ts
Normal file
|
@ -0,0 +1,18 @@
|
|||
import { UIEventSource } from "../UIEventSource";
|
||||
|
||||
|
||||
const LANGUAGE_KEY = 'language'
|
||||
|
||||
export default class Locale {
|
||||
public static language: UIEventSource<string> = new UIEventSource(Locale.getInitialLanguage())
|
||||
|
||||
public static init() {
|
||||
Locale.language.addCallback(data => {
|
||||
localStorage.setItem(LANGUAGE_KEY, data)
|
||||
})
|
||||
}
|
||||
|
||||
private static getInitialLanguage() {
|
||||
return localStorage.getItem(LANGUAGE_KEY)
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue