refactor: i18n
no circular dependencies
This commit is contained in:
		
							parent
							
								
									5d50c2337c
								
							
						
					
					
						commit
						688e0a4c7e
					
				
					 4 changed files with 11 additions and 9 deletions
				
			
		|  | @ -1,5 +1,5 @@ | |||
| 
 | ||||
| import { createLocale } from './' | ||||
| import { createLocale } from './utils' | ||||
| 
 | ||||
| export default createLocale({ | ||||
|   'PROCESSING' () { | ||||
|  |  | |||
|  | @ -1,5 +1,5 @@ | |||
| 
 | ||||
| import { createLocale } from './' | ||||
| import { createLocale } from './utils' | ||||
| 
 | ||||
| export default createLocale({ | ||||
|   'PROCESSING' () { | ||||
|  |  | |||
|  | @ -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
									
								
							
							
						
						
									
										9
									
								
								src/i18n/utils.ts
									
										
									
									
									
										Normal 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) | ||||
| } | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue