migrated from redux to recoil

This commit is contained in:
2023-07-31 12:27:36 +02:00
parent 8327d1e94c
commit b5731759b0
36 changed files with 810 additions and 741 deletions

View File

@@ -2,27 +2,27 @@
import i18n from "../assets/i18n.yaml"
export default class I18nBuilder {
private language: string
private textMap = i18n.languages
private language: string
private textMap = i18n.languages
constructor(language: string) {
this.language = language
}
constructor(language: string) {
this.language = language
}
getLanguage(): string {
return this.language
}
getLanguage(): string {
return this.language
}
setLanguage(language: string): void {
this.language = language
}
setLanguage(language: string): void {
this.language = language
}
t(key: string): string {
const map = this.textMap[this.language]
if (map) {
const translation = map[key]
return translation ?? 'caption not defined'
}
return 'caption not defined'
t(key: string): string {
const map = this.textMap[this.language]
if (map) {
const translation = map[key]
return translation ?? 'caption not defined'
}
}
return 'caption not defined'
}
}