Add i18n completion tool.

This commit is contained in:
Florian THIERRY
2024-09-21 12:20:22 +02:00
parent 3935f6ad21
commit b546a0cf01
8 changed files with 665 additions and 10 deletions

View File

@@ -11,7 +11,9 @@
"build-prod-fr": "ng build --configuration=production-fr --base-href /fr/",
"watch": "ng build --watch --configuration development",
"test": "ng test",
"i18n": "ng extract-i18n --output-path src/locale --format=json"
"i18n": "npm run i18n-ng-extraction && npm run i18n-fr-file-completion",
"i18n-ng-extraction": "ng extract-i18n --output-path src/locale --format=json",
"i18n-fr-file-completion": "cd ../ci/i18n-completer && npm start && cd -"
},
"private": true,
"dependencies": {

View File

@@ -1,19 +1,20 @@
<h1>Your publications</h1>
<h1 i18n>Your publications</h1>
<a [routerLink]="['/publications/new']"
class="new-publication"
matTooltip="Add a new publication"
matTooltipPosition="left">
matTooltipPosition="left"
i18n-matTooltip>
+
</a>
@if ((isLoading$ | async) === true) {
<h2>Publication loading...</h2>
<h2 i18n>Publication loading...</h2>
<mat-spinner></mat-spinner>
} @else {
@if ((isLoaded$ | async) === true) {
<app-publication-list [publications$]="publications$"></app-publication-list>
} @else {
<h2>There is no any publication...</h2>
<h2 i18n>There is no any publication...</h2>
}
}

View File

@@ -40,8 +40,8 @@ export class MyPublicationsService {
this.publicationsSubject.next(publications);
})
.catch(error => {
const errorMessage = 'An error occurred while retrieving your publications...';
this.snackBar.open(errorMessage);
const errorMessage = $localize`An error occurred while retrieving your publications...`;
this.snackBar.open(errorMessage, $localize`Close`, { duration: 5000 });
console.error(errorMessage, error);
})
.finally(() => {
@@ -50,7 +50,7 @@ export class MyPublicationsService {
});
} else {
this.authenticationService.unauthenticate();
this.snackBar.open('You are unauthenticated. Please, log-in first.', 'Close', { duration: 5000 });
this.snackBar.open($localize`You are unauthenticated. Please, log-in first.`, $localize`Close`, { duration: 5000 });
this.router.navigate(['/login']);
}
}

View File

@@ -14,6 +14,12 @@
"6490688569532630280": "Valider",
"2308975396733519902": "Créer un compte",
"1037765878727976611": "Connexion réussie",
"6034686865111167926": "Une erreur est survenue lors de la connexion."
"6034686865111167926": "Une erreur est survenue lors de la connexion.",
"1041423751558601074": "Vos publications",
"5463894166935799864": "Rédiger une nouvelle publication",
"1519054954638405159": "Chargement de la liste de vos publications...",
"5982957837973242128": "Vous n'avez rien publié...",
"6147923540123489141": "Une erreur est survenue lors de la récupération de vos publications...",
"3450287383703155559": "Vous n'êtes pas connecté. Veuillez vous connecter avant de réessayer."
}
}

View File

@@ -14,6 +14,12 @@
"6490688569532630280": "Send",
"2308975396733519902": "Create an account",
"1037765878727976611": "Authentication succeeded!",
"6034686865111167926": "Authentication failed."
"6034686865111167926": "Authentication failed.",
"1041423751558601074": "Your publications",
"5463894166935799864": "Add a new publication",
"1519054954638405159": "Publication loading...",
"5982957837973242128": "There is no any publication...",
"6147923540123489141": "An error occurred while retrieving your publications...",
"3450287383703155559": "You are unauthenticated. Please, log-in first."
}
}