fix: vertaling helper functie fall back constante
This commit is contained in:
		
							parent
							
								
									a66952cc52
								
							
						
					
					
						commit
						749ccb7125
					
				
					 2 changed files with 12 additions and 1 deletions
				
			
		|  | @ -1,6 +1,7 @@ | |||
| import fs from 'fs'; | ||||
| import path from 'path'; | ||||
| import yaml from 'js-yaml'; | ||||
| import {FALLBACK_LANG} from "../../config"; | ||||
| 
 | ||||
| export function loadTranslations<T>(language: string): T { | ||||
|     try { | ||||
|  | @ -12,7 +13,7 @@ export function loadTranslations<T>(language: string): T { | |||
|             `Cannot load translation for ${language}, fallen back to dutch` | ||||
|         ); | ||||
|         console.error(error); | ||||
|         const fallbackPath = path.join(process.cwd(), '_i18n', 'nl.yml'); | ||||
|         const fallbackPath = path.join(process.cwd(), '_i18n', `${FALLBACK_LANG}.yml`); | ||||
|         return yaml.load(fs.readFileSync(fallbackPath, 'utf8')) as T; | ||||
|     } | ||||
| } | ||||
|  |  | |||
		Reference in a new issue
	
	 Gabriellvl
						Gabriellvl