Skip to content

Commit 8eaa701

Browse files
committed
refact: use environment files for translations
- add each language in a separate environment file in order to use config global Reviewed-by: acapai
1 parent 47659a6 commit 8eaa701

6 files changed

Lines changed: 26 additions & 7 deletions

File tree

frontend/angular.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
"fileReplacements": [
8080
{
8181
"replace": "src/environments/environment.ts",
82-
"with": "src/environments/environment.prod.ts"
82+
"with": "src/environments/environment.fr.ts"
8383
}
8484
],
8585
"baseHref": "/fr/",
@@ -103,7 +103,7 @@
103103
"fileReplacements": [
104104
{
105105
"replace": "src/environments/environment.ts",
106-
"with": "src/environments/environment.prod.ts"
106+
"with": "src/environments/environment.en.ts"
107107
}
108108
],
109109
"baseHref": "/en/",
@@ -126,7 +126,7 @@
126126
"fileReplacements": [
127127
{
128128
"replace": "src/environments/environment.ts",
129-
"with": "src/environments/environment.prod.ts"
129+
"with": "src/environments/environment.de.ts"
130130
}
131131
],
132132
"baseHref": "/de/",

frontend/src/app/core/services/language.service.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
import { Injectable } from '@angular/core';
2-
2+
import { environment } from '../../../environments/environment';
33
@Injectable({
44
providedIn: 'root'
55
})
66
export class LanguageService {
77

8-
// Supported locales, adjust as needed
9-
private supportedLocales = ['fr', 'en', 'de'];
10-
private defaultLocale = 'fr';
8+
private supportedLocales = environment.supportedLocales;
9+
private defaultLocale = environment.locale;
1110

1211

1312
getCurrentLocale(): string {
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
export const environment = {
3+
production: true,
4+
locale: 'de',
5+
supportedLocales: ['fr','en','de']
6+
};
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
export const environment = {
3+
production: true,
4+
locale: 'en',
5+
supportedLocales: ['fr','en','de']
6+
};
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
export const environment = {
3+
production: true,
4+
locale: 'fr',
5+
supportedLocales: ['fr','en','de']
6+
};

frontend/src/environments/environment.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
export const environment = {
66
production: false,
7+
locale: 'fr',
8+
supportedLocales: ['fr','en','de']
79
};
810

911
/*

0 commit comments

Comments
 (0)