refactor: i18n

no circular dependencies
This commit is contained in:
Xmader 2020-11-24 05:57:24 -05:00
parent 5d50c2337c
commit 688e0a4c7e
No known key found for this signature in database
GPG Key ID: A20B97FB9EB730E4
4 changed files with 11 additions and 9 deletions

View File

@ -1,5 +1,5 @@
import { createLocale } from './'
import { createLocale } from './utils'
export default createLocale({
'PROCESSING' () {

View File

@ -1,5 +1,5 @@
import { createLocale } from './'
import { createLocale } from './utils'
export default createLocale({
'PROCESSING' () {

View File

@ -17,13 +17,6 @@ export interface LOCALE {
'FULL_SCORE' (): string;
}
/**
* type checking only so no missing keys
*/
export function createLocale<OBJ extends LOCALE> (obj: OBJ): OBJ {
return Object.freeze(obj)
}
const locales = (<L extends { [n: string]: LOCALE } /** type checking */> (l: L) => Object.freeze(l))({
en,
es,

9
src/i18n/utils.ts Normal file
View File

@ -0,0 +1,9 @@
import type { LOCALE } from './'
/**
* type checking only so no missing keys
*/
export function createLocale<OBJ extends LOCALE> (obj: OBJ): OBJ {
return Object.freeze(obj)
}