📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!
TypeScript chartsclickhousedockergdprgoogle-analyticsmetricsmonitoringmysqlnestjsprivacyredisself-hostedselfhostedstatisticstailwindcssweb-analyticswebanalyticswebsite
Added localization module
Yevhenii Kulisidied3ec4b0d2df
diff --git a/nest-cli.json b/nest-cli.jsonindex ba5ebe657..db6c46bc0 100644--- a/nest-cli.json+++ b/nest-cli.json@@ -2,6 +2,9 @@"collection": "@nestjs/schematics","sourceRoot": "src","compilerOptions": {- "assets": [{ "include": "common/templates/**/*", "watchAssets": true }]+ "assets": [+ { "include": "common/templates/**/*", "watchAssets": true },+ { "include": "i18n/**/*", "watchAssets": true }+ ]}}diff --git a/package.json b/package.jsonindex caa86c184..e85194bb4 100644--- a/package.json+++ b/package.json@@ -54,6 +54,7 @@"jsonwebtoken": "^9.0.0","lodash": "^4.17.21","mysql2": "^2.3.3",+ "nestjs-i18n": "^10.2.4","nestjs-telegraf": "^2.6.3","newrelic": "^9.7.4","otplib": "^12.0.1",diff --git a/src/app.module.ts b/src/app.module.tsindex e0813e964..ea8a6ff19 100644--- a/src/app.module.ts+++ b/src/app.module.ts@@ -17,6 +17,8 @@ import { PingModule } from './ping/ping.module'import { TGModule } from './tg-integration/tg.module'import { MarketplaceModule } from './marketplace/marketplace.module'import { AlertModule } from './alert/alert.module'+import { I18nModule } from 'nestjs-i18n'+import { getI18nConfig } from './configs'const modules = [ConfigModule.forRoot({ envFilePath: '.env', isGlobal: true }),@@ -30,6 +32,7 @@ const modules = [synchronize: process.env.NODE_ENV === 'development',entities: [__dirname + '/**/*.entity{.ts,.js}'],}),+ I18nModule.forRootAsync(getI18nConfig()),ScheduleModule.forRoot(),TaskManagerModule,OldAuthModule,diff --git a/src/configs/i18n.config.ts b/src/configs/i18n.config.tsnew file mode 100644index 000000000..0288616c1--- /dev/null+++ b/src/configs/i18n.config.ts@@ -0,0 +1,16 @@+import { ConfigModule, ConfigService } from '@nestjs/config'+import { AcceptLanguageResolver, I18nAsyncOptions } from 'nestjs-i18n'+import { join } from 'path'++export const getI18nConfig = (): I18nAsyncOptions => ({+ imports: [ConfigModule],+ inject: [ConfigService],+ resolvers: [AcceptLanguageResolver],+ useFactory: (configService: ConfigService) => ({+ fallbackLanguage: 'en',+ loaderOptions: {+ path: join(__dirname, '..', 'i18n'),+ watch: configService.get('NODE_ENV') === 'development',+ },+ }),+})diff --git a/src/configs/index.ts b/src/configs/index.tsnew file mode 100644index 000000000..3113e360d--- /dev/null+++ b/src/configs/index.ts@@ -0,0 +1 @@+export * from './i18n.config'