i18n for publication update page.

This commit is contained in:
Florian THIERRY
2024-09-21 21:00:59 +02:00
parent 67c3d0b3e6
commit 3f6764dd7d
4 changed files with 27 additions and 10 deletions

View File

@@ -1,13 +1,20 @@
@if ((isLoading$ | async) == true) { @if ((isLoading$ | async) == true) {
<h2 i18n>Loading publication to edit...</h2>
<mat-spinner></mat-spinner> <mat-spinner></mat-spinner>
} }
@else { @else {
@if (publication) { @if (publication) {
<app-publication-edition title="Update publication {{ publication.title }}" [publication]="publication" [isSaving$]="isSaving$" (publicationSave)="onPublicationSave($event)"></app-publication-edition> <app-publication-edition
title="Update publication {{ publication.title }}"
[publication]="publication"
[isSaving$]="isSaving$"
(publicationSave)="onPublicationSave($event)"
i18n-title>
</app-publication-edition>
} }
@else { @else {
<div class="loading-failed"> <div class="loading-failed">
<h1>Publication failed to load...</h1> <h1 i18n>Publication failed to load...</h1>
</div> </div>
} }
} }

View File

@@ -59,7 +59,7 @@ export class PublicationUpdateComponent implements OnInit, OnDestroy {
this.activatedRoute.paramMap.subscribe(params => { this.activatedRoute.paramMap.subscribe(params => {
const publicationId = params.get('publicationId'); const publicationId = params.get('publicationId');
if (publicationId == undefined) { if (publicationId == undefined) {
this.snackBar.open('A technical error occurred while loading publication data.', 'Close', { duration: 5000 }); this.snackBar.open($localize`A technical error occurred while loading publication data.`, $localize`Close`, { duration: 5000 });
this.location.back(); this.location.back();
} else { } else {
this.publicationRestService.getById(publicationId) this.publicationRestService.getById(publicationId)
@@ -67,8 +67,8 @@ export class PublicationUpdateComponent implements OnInit, OnDestroy {
this.publication = publication; this.publication = publication;
}) })
.catch(error => { .catch(error => {
const errorMessage = 'A technical error occurred while loading publication data.'; const errorMessage = $localize`A technical error occurred while loading publication data.`;
this.snackBar.open(errorMessage, 'Close', { duration: 5000 }); this.snackBar.open(errorMessage, $localize`Close`, { duration: 5000 });
console.error(errorMessage, error) console.error(errorMessage, error)
}) })
.finally(() => this.isLoadingSubject.next(false)); .finally(() => this.isLoadingSubject.next(false));
@@ -84,13 +84,13 @@ export class PublicationUpdateComponent implements OnInit, OnDestroy {
this.isSavingSubject.next(true); this.isSavingSubject.next(true);
this.publicationRestService.update(publication) this.publicationRestService.update(publication)
.then(() => { .then(() => {
this.snackBar.open('Publication updated succesfully!', 'Close', { duration: 5000 }); this.snackBar.open($localize`Publication updated succesfully!`, $localize`Close`, { duration: 5000 });
this.router.navigate(['/home']); this.router.navigate(['/home']);
}) })
.catch(error => { .catch(error => {
const errorMessage = 'An error occured while saving publication modifications.'; const errorMessage = $localize`An error occured while saving publication modifications.`;
console.error(errorMessage, error); console.error(errorMessage, error);
this.snackBar.open(errorMessage, 'Close', { duration: 5000 }); this.snackBar.open(errorMessage, $localize`Close`, { duration: 5000 });
}) })
.finally(() => this.isSavingSubject.next(false)); .finally(() => this.isSavingSubject.next(false));
} }

View File

@@ -24,8 +24,13 @@
"2804059545779555969": "Rédaction d'une nouvelle publication", "2804059545779555969": "Rédaction d'une nouvelle publication",
"4229813881636784544": "Publication créée avec succès !", "4229813881636784544": "Publication créée avec succès !",
"1772332295232318552": "Une erreur est survenue lors de l'enregistrement de la nouvelle publication.", "1772332295232318552": "Une erreur est survenue lors de l'enregistrement de la nouvelle publication.",
"9035578711395348230": "Chargement du contenu de la publication...", "5585500423922995936": "Chargement de la publication à modifier...",
"1487849090405054079": "Modification de la publication {$INTERPOLATION}",
"570282468314450588": "La publication n'a pas pu être chargée...", "570282468314450588": "La publication n'a pas pu être chargée...",
"4580042433737768435": "Une erreur technique est survenue lors du chargement de la publication à modifier.",
"1766298802296530620": "Publication modifiée avec succès !",
"5690532907092398845": "Une erreur est survenue lors de l'enregistrement des modifications de la publication.",
"9035578711395348230": "Chargement du contenu de la publication...",
"3861667381167371965": "Une erreur est survenue lors du chargement de la publication...", "3861667381167371965": "Une erreur est survenue lors du chargement de la publication...",
"3189372093194446122": "Suppression de la publication", "3189372093194446122": "Suppression de la publication",
"7149611045520326321": "Êtes vous sûr de vouloir supprimer cette publication ?", "7149611045520326321": "Êtes vous sûr de vouloir supprimer cette publication ?",

View File

@@ -24,8 +24,13 @@
"2804059545779555969": "Creation of a new publication", "2804059545779555969": "Creation of a new publication",
"4229813881636784544": "Publication created succesfully!", "4229813881636784544": "Publication created succesfully!",
"1772332295232318552": "An error occured while saving new publication.", "1772332295232318552": "An error occured while saving new publication.",
"9035578711395348230": "Publication content loading...", "5585500423922995936": "Loading publication to edit...",
"1487849090405054079": "Update publication {$INTERPOLATION}",
"570282468314450588": "Publication failed to load...", "570282468314450588": "Publication failed to load...",
"4580042433737768435": "A technical error occurred while loading publication data.",
"1766298802296530620": "Publication updated succesfully!",
"5690532907092398845": "An error occured while saving publication modifications.",
"9035578711395348230": "Publication content loading...",
"3861667381167371965": "An error occurred while loading publication...", "3861667381167371965": "An error occurred while loading publication...",
"3189372093194446122": "Publication deletion", "3189372093194446122": "Publication deletion",
"7149611045520326321": "Are you sure you want to delete this publication?", "7149611045520326321": "Are you sure you want to delete this publication?",