Skip to content

Commit

Permalink
fix: readd test and update i18n
Browse files Browse the repository at this point in the history
  • Loading branch information
f-necas committed Jan 3, 2024
1 parent 0143380 commit a2973a5
Show file tree
Hide file tree
Showing 12 changed files with 27 additions and 19 deletions.
6 changes: 4 additions & 2 deletions apps/datahub/src/app/home/news-page/news-page.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@
>
datahub.news.contact.title
</h2>
<p translate>datahub.news.contact.desc1</p>
<p translate>datahub.news.contact.desc2</p>
<div
class="flex flex-col gap-3"
[innerHtml]="'datahub.news.contact.html' | translate"
></div>
<a
[href]="'mailto:' + getContactMail()"
class="btn-secondary uppercase justify-center"
Expand Down
11 changes: 11 additions & 0 deletions apps/datahub/src/app/home/news-page/news-page.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'
import { NewsPageComponent } from './news-page.component'
import { NO_ERRORS_SCHEMA } from '@angular/core'
import { getGlobalConfig } from '@geonetwork-ui/util/app-config'
import { TranslateTestingModule } from '@geonetwork-ui/util/i18n'
import { TranslateMessageFormatCompiler } from 'ngx-translate-messageformat-compiler'

jest.mock('@geonetwork-ui/util/app-config', () => ({
getGlobalConfig: jest.fn(() => ({
Expand All @@ -15,6 +17,15 @@ describe('NewsPageComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [NewsPageComponent],
imports: [
TranslateTestingModule.withTranslations({
en: {
'datahub.news.contact.html': '<p>line1</p><p>line2</p>',
},
})
.withDefaultLanguage('en')
.withCompiler(new TranslateMessageFormatCompiler()),
],
schemas: [NO_ERRORS_SCHEMA],
}).compileComponents()

Expand Down
2 changes: 1 addition & 1 deletion conf/default.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ proxy_path = ""
# More information about the translation can be found in the docs (https://geonetwork.github.io/geonetwork-ui/main/docs/reference/i18n.html)
# languages = ['en', 'fr', 'de']

# Allows displaying a contact email on news page for missing data
# Enables displaying a "contact block" wherever relevant in applications
# contact_email = "[email protected]"

### VISUAL THEME
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,9 @@ describe('DownloadsListComponent', () => {
LINK_FIXTURES.geodataShpWithMimeType
)
expect(items[0].componentInstance.format).toEqual('shp')
expect(items[0].componentInstance.color).toEqual(
expect.stringMatching(/#[0-9a-b]{2,6}/i)
)
expect(items[0].componentInstance.isFromWfs).toEqual(false)
})
})
Expand Down
3 changes: 1 addition & 2 deletions translations/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,7 @@
"datahub.header.popularRecords": "Die beliebtesten",
"datahub.header.title.html": "<div class=\"text-white\">Entdecken Sie offene<br> Daten von meiner Organisation</div>",
"datahub.news.contact.contactus": "",
"datahub.news.contact.desc1": "",
"datahub.news.contact.desc2": "",
"datahub.news.contact.html": "",
"datahub.news.contact.title": "",
"datahub.news.feed": "Nachrichtenfeed",
"datahub.news.figures": "Indikatoren",
Expand Down
3 changes: 1 addition & 2 deletions translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,7 @@
"datahub.header.popularRecords": "The most popular",
"datahub.header.title.html": "<div class=\"text-white\">Discover open<br> data from my Organization</div>",
"datahub.news.contact.contactus": "Contact us",
"datahub.news.contact.desc1": "Do you need data that is not currently present on the platform? ",
"datahub.news.contact.desc2": "Our teams are here to answer you.",
"datahub.news.contact.html": "<p>Do you need data that is not currently present on the platform?</p><p>Our teams are here to answer you.</p>",
"datahub.news.contact.title": "A specific need?",
"datahub.news.feed": "News feed",
"datahub.news.figures": "Indicators",
Expand Down
3 changes: 1 addition & 2 deletions translations/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,7 @@
"datahub.header.popularRecords": "",
"datahub.header.title.html": "",
"datahub.news.contact.contactus": "",
"datahub.news.contact.desc1": "",
"datahub.news.contact.desc2": "",
"datahub.news.contact.html": "",
"datahub.news.contact.title": "",
"datahub.news.feed": "",
"datahub.news.figures": "",
Expand Down
3 changes: 1 addition & 2 deletions translations/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,7 @@
"datahub.header.popularRecords": "Les plus appréciées",
"datahub.header.title.html": "<div class=\"text-white\">Toutes les données<br>publiques de mon organisation</div>",
"datahub.news.contact.contactus": "Contactez-nous",
"datahub.news.contact.desc1": "Vous avez besoin de données qui ne sont pas présentes sur la plateforme actuellement ?",
"datahub.news.contact.desc2": "Nos équipes sont la pour vous répondre.",
"datahub.news.contact.html": "<p>Vous avez besoin de données qui ne sont pas présentes sur la plateforme actuellement ? </p><p> Nos équipes sont la pour vous répondre.</p>",
"datahub.news.contact.title": "Un besoin spécifique ?",
"datahub.news.feed": "Fil d'activité",
"datahub.news.figures": "Quelques chiffres",
Expand Down
3 changes: 1 addition & 2 deletions translations/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,7 @@
"datahub.header.popularRecords": "",
"datahub.header.title.html": "",
"datahub.news.contact.contactus": "",
"datahub.news.contact.desc1": "",
"datahub.news.contact.desc2": "",
"datahub.news.contact.html": "",
"datahub.news.contact.title": "",
"datahub.news.feed": "",
"datahub.news.figures": "",
Expand Down
3 changes: 1 addition & 2 deletions translations/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,7 @@
"datahub.header.popularRecords": "",
"datahub.header.title.html": "",
"datahub.news.contact.contactus": "",
"datahub.news.contact.desc1": "",
"datahub.news.contact.desc2": "",
"datahub.news.contact.html": "",
"datahub.news.contact.title": "",
"datahub.news.feed": "",
"datahub.news.figures": "",
Expand Down
3 changes: 1 addition & 2 deletions translations/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,7 @@
"datahub.header.popularRecords": "",
"datahub.header.title.html": "",
"datahub.news.contact.contactus": "",
"datahub.news.contact.desc1": "",
"datahub.news.contact.desc2": "",
"datahub.news.contact.html": "",
"datahub.news.contact.title": "",
"datahub.news.feed": "",
"datahub.news.figures": "",
Expand Down
3 changes: 1 addition & 2 deletions translations/sk.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,7 @@
"datahub.header.popularRecords": "Najpopulárnejšie",
"datahub.header.title.html": "<div class=\"text-white\">Objavte otvorené<br>dáta z mojej organizácie</div>",
"datahub.news.contact.contactus": "",
"datahub.news.contact.desc1": "",
"datahub.news.contact.desc2": "",
"datahub.news.contact.html": "",
"datahub.news.contact.title": "",
"datahub.news.feed": "Spravodajský kanál",
"datahub.news.figures": "Ukazovatele",
Expand Down

0 comments on commit a2973a5

Please sign in to comment.