MERGE: dev ino feat/service-layer
This commit is contained in:
commit
6404335040
220 changed files with 12582 additions and 10400 deletions
|
@ -2,6 +2,9 @@ import fs from 'fs';
|
|||
import path from 'path';
|
||||
import yaml from 'js-yaml';
|
||||
import { FALLBACK_LANG } from '../config.js';
|
||||
import { getLogger, Logger } from '../logging/initalize.js';
|
||||
|
||||
const logger: Logger = getLogger();
|
||||
|
||||
export function loadTranslations<T>(language: string): T {
|
||||
try {
|
||||
|
@ -9,15 +12,8 @@ export function loadTranslations<T>(language: string): T {
|
|||
const yamlFile = fs.readFileSync(filePath, 'utf8');
|
||||
return yaml.load(yamlFile) as T;
|
||||
} catch (error) {
|
||||
console.error(
|
||||
`Cannot load translation for ${language}, fallen back to dutch`
|
||||
);
|
||||
console.error(error);
|
||||
const fallbackPath = path.join(
|
||||
process.cwd(),
|
||||
'_i18n',
|
||||
`${FALLBACK_LANG}.yml`
|
||||
);
|
||||
logger.warn(`Cannot load translation for ${language}, fallen back to dutch`, error);
|
||||
const fallbackPath = path.join(process.cwd(), '_i18n', `${FALLBACK_LANG}.yml`);
|
||||
return yaml.load(fs.readFileSync(fallbackPath, 'utf8')) as T;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue