build: add i18n support
This commit is contained in:
@@ -11,6 +11,8 @@ import { WebSqlite } from 'angular-web-sqlite';
|
||||
import { Sqlite } from './services/sqlite';
|
||||
import { tables } from '../migrations/20260117';
|
||||
import { provideServiceWorker } from '@angular/service-worker';
|
||||
import {provideTranslateService } from "@ngx-translate/core";
|
||||
import {provideTranslateHttpLoader} from "@ngx-translate/http-loader";
|
||||
|
||||
export const appConfig: ApplicationConfig = {
|
||||
providers: [
|
||||
@@ -28,5 +30,13 @@ export const appConfig: ApplicationConfig = {
|
||||
enabled: !isDevMode(),
|
||||
registrationStrategy: 'registerWhenStable:30000',
|
||||
}),
|
||||
provideTranslateService({
|
||||
loader: provideTranslateHttpLoader({
|
||||
prefix: '/i18n/',
|
||||
suffix: '.json'
|
||||
}),
|
||||
fallbackLang: 'en',
|
||||
lang: 'en'
|
||||
})
|
||||
],
|
||||
};
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { Component, inject } from '@angular/core';
|
||||
import { RouterOutlet } from '@angular/router';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-root',
|
||||
@@ -7,4 +8,11 @@ import { RouterOutlet } from '@angular/router';
|
||||
templateUrl: './app.html',
|
||||
styles: [],
|
||||
})
|
||||
export class App {}
|
||||
export class App {
|
||||
private readonly translate = inject(TranslateService);
|
||||
constructor() {
|
||||
this.translate.addLangs(['en', 'es', 'pt']);
|
||||
this.translate.setFallbackLang('en');
|
||||
this.translate.use('en');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user