mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-11 16:44:48 -07:00
refactor typescript wiring
This commit is contained in:
parent
cea9ae62d8
commit
c62c336a11
286 changed files with 2999 additions and 3053 deletions
|
|
@ -1,18 +1,18 @@
|
|||
import { ModuleType } from 'i18next';
|
||||
|
||||
import { Language } from 'types';
|
||||
import { App } from '@app/types';
|
||||
|
||||
class I18nBackend {
|
||||
static type: ModuleType = 'backend';
|
||||
static BASE_URL = `${import.meta.env.BASE_URL}locales`;
|
||||
|
||||
read(language, namespace, callback) {
|
||||
if (!Language[language]) {
|
||||
if (!language[App.Language]) {
|
||||
callback(true, null);
|
||||
return;
|
||||
}
|
||||
|
||||
fetch(`${I18nBackend.BASE_URL}/${Language[language]}/${namespace}.json`)
|
||||
fetch(`${I18nBackend.BASE_URL}/${language[App.Language]}/${namespace}.json`)
|
||||
.then(resp => resp.json().then(json => callback(null, json)))
|
||||
.catch(error => callback(error, null));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue