From 36208ef07145aae94caef3b2ed19c881a9ebdb57 Mon Sep 17 00:00:00 2001 From: Florian THIERRY Date: Sat, 21 Sep 2024 12:28:55 +0200 Subject: [PATCH] i18n of publication page. --- .../publication/publication.component.html | 18 +++++++++++++----- .../pages/publication/publication.component.ts | 11 ++++++----- frontend/src/locale/messages-fr.json | 8 +++++++- frontend/src/locale/messages.json | 8 +++++++- 4 files changed, 33 insertions(+), 12 deletions(-) diff --git a/frontend/src/app/pages/publication/publication.component.html b/frontend/src/app/pages/publication/publication.component.html index 23a42eb..33b4a24 100644 --- a/frontend/src/app/pages/publication/publication.component.html +++ b/frontend/src/app/pages/publication/publication.component.html @@ -1,4 +1,5 @@ @if (isLoading) { +

Publication content loading...

} @else { @if (publication) { @@ -8,7 +9,10 @@

{{ publication.title }}

{{ publication.description }}

@if (isAuthorAndUserEquals) { - + edit } @@ -18,14 +22,18 @@
- Publication posted by {{ publication.author.name }} + Publication posted by {{ publication.author.name }} - ({{ publication.creationDate | date: 'short' : 'fr-FR' }}) + ({{ publication.creationDate | date: 'short' }})
@if (isAuthorAndUserEquals) { - @@ -34,7 +42,7 @@ } @else {
-

Publication failed to load...

+

Publication failed to load...

} } \ No newline at end of file diff --git a/frontend/src/app/pages/publication/publication.component.ts b/frontend/src/app/pages/publication/publication.component.ts index d66392d..8593ac8 100644 --- a/frontend/src/app/pages/publication/publication.component.ts +++ b/frontend/src/app/pages/publication/publication.component.ts @@ -50,8 +50,9 @@ export class PublicationComponent implements OnInit, OnDestroy { setTimeout(() => Prism.highlightAll(), 100); }) .catch(error => { - this.snackBar.open('An error occurred while loading publication...', 'Close', { duration: 5000 }); - console.error('An error occurred while loading publication...', error); + const errorMessage = $localize`An error occurred while loading publication...`; + this.snackBar.open(errorMessage, $localize`Close`, { duration: 5000 }); + console.error(errorMessage, error); }) .finally(() => { this.isLoading = false; @@ -70,8 +71,8 @@ export class PublicationComponent implements OnInit, OnDestroy { ConfirmationDialog, { data: { - title: 'Publication deletion', - description: 'Are you sure you want to delete this publication?' + title: $localize`Publication deletion`, + description: $localize`Are you sure you want to delete this publication?` } } ); @@ -80,7 +81,7 @@ export class PublicationComponent implements OnInit, OnDestroy { .subscribe(response => { if (response && this.publication?.id) { this.publicationRestService.delete(this.publication.id); - this.snackBar.open('Publication deleted', 'Close', { duration: 5000 }); + this.snackBar.open($localize`Publication deleted`, $localize`Close`, { duration: 5000 }); this.location.back(); } }); diff --git a/frontend/src/locale/messages-fr.json b/frontend/src/locale/messages-fr.json index 50b46f6..cc8b352 100644 --- a/frontend/src/locale/messages-fr.json +++ b/frontend/src/locale/messages-fr.json @@ -20,6 +20,12 @@ "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." + "3450287383703155559": "Vous n'êtes pas connecté. Veuillez vous connecter avant de réessayer.", + "9035578711395348230": "Chargement du contenu de la publication...", + "570282468314450588": "La publication n'a pas pu être chargée...", + "3861667381167371965": "Une erreur est survenue lors du chargement de la publication...", + "3189372093194446122": "Suppression de la publication", + "7149611045520326321": "Êtes vous sûr de vouloir supprimer cette publication ?", + "4353366709080867962": "Publication supprimée" } } \ No newline at end of file diff --git a/frontend/src/locale/messages.json b/frontend/src/locale/messages.json index 4b8d4c2..6501d28 100644 --- a/frontend/src/locale/messages.json +++ b/frontend/src/locale/messages.json @@ -20,6 +20,12 @@ "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." + "3450287383703155559": "You are unauthenticated. Please, log-in first.", + "9035578711395348230": "Publication content loading...", + "570282468314450588": "Publication failed to load...", + "3861667381167371965": "An error occurred while loading publication...", + "3189372093194446122": "Publication deletion", + "7149611045520326321": "Are you sure you want to delete this publication?", + "4353366709080867962": "Publication deleted" } } \ No newline at end of file