parent
657461163b
commit
c6141226a2
File diff suppressed because it is too large
Load Diff
@ -1,11 +1,23 @@
|
||||
import { ApplicationConfig } from '@angular/core';
|
||||
import { ApplicationConfig, isDevMode } from '@angular/core';
|
||||
import { provideRouter, withComponentInputBinding } from '@angular/router';
|
||||
|
||||
import { routes } from './app.routes';
|
||||
import { provideHttpClient } from '@angular/common/http';
|
||||
import { TranslocoHttpLoader } from './transloco-loader';
|
||||
import { provideTransloco } from '@jsverse/transloco';
|
||||
|
||||
export const appConfig: ApplicationConfig = {
|
||||
providers: [
|
||||
provideRouter(routes, withComponentInputBinding()),
|
||||
provideRouter(routes, withComponentInputBinding()), provideHttpClient(), provideTransloco({
|
||||
config: {
|
||||
availableLangs: ['en', 'fr', 'ru'],
|
||||
defaultLang: 'en',
|
||||
// Remove this option if your application doesn't support changing language in runtime.
|
||||
reRenderOnLangChange: true,
|
||||
prodMode: !isDevMode(),
|
||||
},
|
||||
loader: TranslocoHttpLoader
|
||||
}),
|
||||
]
|
||||
};
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
<h1>Recipe List</h1>
|
||||
<h1>{{ 'recipe.list' | transloco }}</h1>
|
||||
|
||||
<div id="recipe-list">
|
||||
<app-recipe-mini *ngFor="let recipe of recipes" [recipe]="recipe"></app-recipe-mini>
|
||||
|
@ -0,0 +1,12 @@
|
||||
import { inject, Injectable } from "@angular/core";
|
||||
import { Translation, TranslocoLoader } from "@jsverse/transloco";
|
||||
import { HttpClient } from "@angular/common/http";
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class TranslocoHttpLoader implements TranslocoLoader {
|
||||
private http = inject(HttpClient);
|
||||
|
||||
getTranslation(lang: string) {
|
||||
return this.http.get<Translation>(`../assets/i18n/${lang}.json`);
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
{
|
||||
"title": "Home",
|
||||
"recipe": {
|
||||
"add": {
|
||||
"link": "Add Recipe",
|
||||
"button-ingredients": "Add Ingredients",
|
||||
"button-recipe": "Add Recipe"
|
||||
},
|
||||
"see": "View Recipe",
|
||||
"list": "Recipe List",
|
||||
"ingredients": "Ingredients"
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
{
|
||||
"title": "Accueil",
|
||||
"recipe": {
|
||||
"add": {
|
||||
"link": "Ajouter une recette",
|
||||
"button-ingredients": "Ajouter des ingrédients",
|
||||
"button-recipe": "Ajouter la recette"
|
||||
},
|
||||
"see": "Voir la recette",
|
||||
"list": "Liste de recettes",
|
||||
"ingredients": "Ingrédients"
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
{
|
||||
"title": "Домой",
|
||||
"recipe": {
|
||||
"add": {
|
||||
"link": "Добавить рецепт",
|
||||
"button-ingredients": "Добавить ингредиенты",
|
||||
"button-recipe": "Добавить рецепт"
|
||||
},
|
||||
"see": "Посмотреть рецепт",
|
||||
"list": "Список рецептов",
|
||||
"ingredients": "Ингредиенты"
|
||||
}
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
module.exports = {
|
||||
rootTranslationsPath: 'src/assets/i18n/',
|
||||
langs: ['en', 'fr', 'ru'],
|
||||
keysManager: {}
|
||||
};
|
Loading…
Reference in new issue