Browse Source
Task/implement OnModuleInit in I18nService (#6448)
* Implement onModuleInit
pull/6548/head
Thomas Kaul
1 week ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with
3 additions and
3 deletions
-
apps/api/src/services/i18n/i18n.service.ts
|
|
@ -1,16 +1,16 @@ |
|
|
import { DEFAULT_LANGUAGE_CODE } from '@ghostfolio/common/config'; |
|
|
import { DEFAULT_LANGUAGE_CODE } from '@ghostfolio/common/config'; |
|
|
|
|
|
|
|
|
import { Injectable, Logger } from '@nestjs/common'; |
|
|
import { Injectable, Logger, OnModuleInit } from '@nestjs/common'; |
|
|
import * as cheerio from 'cheerio'; |
|
|
import * as cheerio from 'cheerio'; |
|
|
import { readFileSync, readdirSync } from 'node:fs'; |
|
|
import { readFileSync, readdirSync } from 'node:fs'; |
|
|
import { join } from 'node:path'; |
|
|
import { join } from 'node:path'; |
|
|
|
|
|
|
|
|
@Injectable() |
|
|
@Injectable() |
|
|
export class I18nService { |
|
|
export class I18nService implements OnModuleInit { |
|
|
private localesPath = join(__dirname, 'assets', 'locales'); |
|
|
private localesPath = join(__dirname, 'assets', 'locales'); |
|
|
private translations: { [locale: string]: cheerio.CheerioAPI } = {}; |
|
|
private translations: { [locale: string]: cheerio.CheerioAPI } = {}; |
|
|
|
|
|
|
|
|
public constructor() { |
|
|
public onModuleInit() { |
|
|
this.loadFiles(); |
|
|
this.loadFiles(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|