build: add i18n support
This commit is contained in:
28
package-lock.json
generated
28
package-lock.json
generated
@@ -17,6 +17,8 @@
|
|||||||
"@angular/platform-browser": "^21.0.0",
|
"@angular/platform-browser": "^21.0.0",
|
||||||
"@angular/router": "^21.0.0",
|
"@angular/router": "^21.0.0",
|
||||||
"@angular/service-worker": "^21.0.6",
|
"@angular/service-worker": "^21.0.6",
|
||||||
|
"@ngx-translate/core": "^17.0.0",
|
||||||
|
"@ngx-translate/http-loader": "^17.0.0",
|
||||||
"angular-web-sqlite": "^1.0.34",
|
"angular-web-sqlite": "^1.0.34",
|
||||||
"rxjs": "~7.8.0",
|
"rxjs": "~7.8.0",
|
||||||
"tslib": "^2.3.0"
|
"tslib": "^2.3.0"
|
||||||
@@ -2698,6 +2700,32 @@
|
|||||||
"@tybys/wasm-util": "^0.10.1"
|
"@tybys/wasm-util": "^0.10.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@ngx-translate/core": {
|
||||||
|
"version": "17.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@ngx-translate/core/-/core-17.0.0.tgz",
|
||||||
|
"integrity": "sha512-Rft2D5ns2pq4orLZjEtx1uhNuEBerUdpFUG1IcqtGuipj6SavgB8SkxtNQALNDA+EVlvsNCCjC2ewZVtUeN6rg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"tslib": "^2.3.0"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"@angular/common": ">=16",
|
||||||
|
"@angular/core": ">=16"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@ngx-translate/http-loader": {
|
||||||
|
"version": "17.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@ngx-translate/http-loader/-/http-loader-17.0.0.tgz",
|
||||||
|
"integrity": "sha512-hgS8sa0ARjH9ll3PhkLTufeVXNI2DNR2uFKDhBgq13siUXzzVr/a31M6zgecrtwbA34iaBV01hsTMbMS8V7iIw==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"tslib": "^2.3.0"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"@angular/common": ">=16",
|
||||||
|
"@angular/core": ">=16"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@npmcli/agent": {
|
"node_modules/@npmcli/agent": {
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/@npmcli/agent/-/agent-4.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/@npmcli/agent/-/agent-4.0.0.tgz",
|
||||||
|
|||||||
@@ -32,6 +32,8 @@
|
|||||||
"@angular/platform-browser": "^21.0.0",
|
"@angular/platform-browser": "^21.0.0",
|
||||||
"@angular/router": "^21.0.0",
|
"@angular/router": "^21.0.0",
|
||||||
"@angular/service-worker": "^21.0.6",
|
"@angular/service-worker": "^21.0.6",
|
||||||
|
"@ngx-translate/core": "^17.0.0",
|
||||||
|
"@ngx-translate/http-loader": "^17.0.0",
|
||||||
"angular-web-sqlite": "^1.0.34",
|
"angular-web-sqlite": "^1.0.34",
|
||||||
"rxjs": "~7.8.0",
|
"rxjs": "~7.8.0",
|
||||||
"tslib": "^2.3.0"
|
"tslib": "^2.3.0"
|
||||||
@@ -45,4 +47,4 @@
|
|||||||
"typescript": "~5.9.2",
|
"typescript": "~5.9.2",
|
||||||
"vitest": "^4.0.8"
|
"vitest": "^4.0.8"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
0
public/i18n/en.json
Normal file
0
public/i18n/en.json
Normal file
0
public/i18n/es.json
Normal file
0
public/i18n/es.json
Normal file
0
public/i18n/pt.json
Normal file
0
public/i18n/pt.json
Normal file
@@ -11,6 +11,8 @@ import { WebSqlite } from 'angular-web-sqlite';
|
|||||||
import { Sqlite } from './services/sqlite';
|
import { Sqlite } from './services/sqlite';
|
||||||
import { tables } from '../migrations/20260117';
|
import { tables } from '../migrations/20260117';
|
||||||
import { provideServiceWorker } from '@angular/service-worker';
|
import { provideServiceWorker } from '@angular/service-worker';
|
||||||
|
import {provideTranslateService } from "@ngx-translate/core";
|
||||||
|
import {provideTranslateHttpLoader} from "@ngx-translate/http-loader";
|
||||||
|
|
||||||
export const appConfig: ApplicationConfig = {
|
export const appConfig: ApplicationConfig = {
|
||||||
providers: [
|
providers: [
|
||||||
@@ -28,5 +30,13 @@ export const appConfig: ApplicationConfig = {
|
|||||||
enabled: !isDevMode(),
|
enabled: !isDevMode(),
|
||||||
registrationStrategy: 'registerWhenStable:30000',
|
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 { RouterOutlet } from '@angular/router';
|
||||||
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-root',
|
selector: 'app-root',
|
||||||
@@ -7,4 +8,11 @@ import { RouterOutlet } from '@angular/router';
|
|||||||
templateUrl: './app.html',
|
templateUrl: './app.html',
|
||||||
styles: [],
|
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