i18n for home page.
This commit is contained in:
@@ -7,9 +7,9 @@
|
||||
</div>
|
||||
<div class="footer">
|
||||
<img src="/api/pictures/{{ publication.author.image }}" [matTooltip]="publication.author.name"/>
|
||||
Publication posted by {{publication.author.name}}
|
||||
<span i18n>Publication posted by {{publication.author.name}}</span>
|
||||
<span class="publication-date">
|
||||
({{ publication.creationDate | date: 'short' : 'fr-Fr' }})
|
||||
({{ publication.creationDate | date: 'short' }})
|
||||
</span>
|
||||
</div>
|
||||
</a>
|
||||
|
||||
@@ -1,2 +1,11 @@
|
||||
<h1 i18n>Last publications</h1>
|
||||
<app-publication-list [publications$]="publications$"></app-publication-list>
|
||||
@if ((isLoading$ | async) === true) {
|
||||
<h2 i18n>Publications loading...</h2>
|
||||
<mat-spinner></mat-spinner>
|
||||
} @else {
|
||||
@if ((publications$ | async) != []) {
|
||||
<app-publication-list [publications$]="publications$"></app-publication-list>
|
||||
} @else {
|
||||
<h2 i18n>No any publication.</h2>
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { HomeComponent } from './home.component';
|
||||
|
||||
describe('HomeComponent', () => {
|
||||
let component: HomeComponent;
|
||||
let fixture: ComponentFixture<HomeComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [HomeComponent]
|
||||
})
|
||||
.compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(HomeComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -1,16 +1,19 @@
|
||||
import { Component, OnInit, inject } from '@angular/core';
|
||||
import { HomeService } from './home.service';
|
||||
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
||||
import { Observable } from 'rxjs';
|
||||
import { Publication } from '../../core/rest-services/publications/model/publication';
|
||||
import { RouterModule } from '@angular/router';
|
||||
import { MatTooltipModule } from '@angular/material/tooltip';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { PublicationListComponent } from '../../components/publication-list/publication-list.component';
|
||||
import { Publication } from '../../core/rest-services/publications/model/publication';
|
||||
import { HomeService } from './home.service';
|
||||
import { CommonModule } from '@angular/common';
|
||||
|
||||
@Component({
|
||||
selector: 'app-home',
|
||||
standalone: true,
|
||||
imports: [PublicationListComponent],
|
||||
imports: [
|
||||
CommonModule,
|
||||
MatProgressSpinnerModule,
|
||||
PublicationListComponent
|
||||
],
|
||||
templateUrl: './home.component.html',
|
||||
styleUrl: './home.component.scss',
|
||||
providers: [HomeService]
|
||||
|
||||
@@ -26,8 +26,9 @@ export class HomeService {
|
||||
this.publicationRestService.getLatest()
|
||||
.then(publications => this.publicationsSubject.next(publications))
|
||||
.catch(error => {
|
||||
this.snackBar.open('An error occurred while retrieving latest publications...');
|
||||
console.error('An error occurred while retrieving latest publications...', error);
|
||||
const errorMessage = $localize`An error occurred while retrieving latest publications...`;
|
||||
this.snackBar.open(errorMessage, $localize`Close`, { duration: 5000 });
|
||||
console.error(errorMessage, error);
|
||||
})
|
||||
.finally(() => this.isLoadingSubject.next(false));
|
||||
}
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
{
|
||||
"locale": "fr-FR",
|
||||
"translations": {
|
||||
"4869473828758837325": "Dernières publications"
|
||||
"2578598149846191609": "Publication postée par {$INTERPOLATION}",
|
||||
"4869473828758837325": "Dernières publications",
|
||||
"5148998676057880041": "Chargement des publications...",
|
||||
"3688381096110057852": "Il n'y a aucune publication.",
|
||||
"8393632007890629197": "Une erreur est survenue lors du chargement des dernières publications...",
|
||||
"7819314041543176992": "Fermer"
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,11 @@
|
||||
{
|
||||
"locale": "en-UK",
|
||||
"translations": {
|
||||
"4869473828758837325": "Last publications"
|
||||
"2578598149846191609": "Publication posted by {$INTERPOLATION}",
|
||||
"4869473828758837325": "Last publications",
|
||||
"5148998676057880041": "Publications loading...",
|
||||
"3688381096110057852": "No any publication.",
|
||||
"8393632007890629197": "An error occurred while retrieving latest publications...",
|
||||
"7819314041543176992": "Close"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user