refactor(sw): use fully typed locales (#14470)

* refactor(sw): use fully typed locales

* fix(backend): enumerate achievement notification type
This commit is contained in:
zyoshoka 2024-08-30 10:58:11 +09:00 committed by GitHub
parent 3e85052754
commit 06855f769f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 89 additions and 120 deletions

View file

@ -7,7 +7,8 @@
* Language manager for SW
*/
import { get, set } from 'idb-keyval';
import { I18n, type Locale } from '@/scripts/i18n.js';
import { I18n } from '../../../frontend/src/scripts/i18n.js';
import type { Locale } from '../../../../locales/index.js';
class SwLang {
public cacheName = `mk-cache-${_VERSION_}`;
@ -23,7 +24,7 @@ class SwLang {
return this.fetchLocale();
}
public i18n: Promise<I18n> | null = null;
public i18n: Promise<I18n<Locale>> | null = null;
public fetchLocale(): Promise<I18n<Locale>> {
return (this.i18n = this._fetch());