Skip to content

Commit fd72335

Browse files
committed
add ts support for i18n strings
Resolves: #94
1 parent efc36ba commit fd72335

File tree

120 files changed

+1178
-1121
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

120 files changed

+1178
-1121
lines changed

@types/i18next.d.ts

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
import 'i18next'
2+
3+
// // // core/plugins // // //
4+
5+
import { common as resourcesDeCore } from '../packages/core/src/language/locales/de'
6+
import { resourcesDe as resourcesDeAddressSearch } from '../packages/plugins/AddressSearch/src/language'
7+
import { resourcesDe as resourcesDeAttributions } from '../packages/plugins/Attributions/src/language'
8+
import { resourcesDe as resourcesDeDraw } from '../packages/plugins/Draw/src/language'
9+
import { resourcesDe as resourcesDeExport } from '../packages/plugins/Export/src/language'
10+
import { resourcesDe as resourcesDeFilter } from '../packages/plugins/Filter/src/language'
11+
import { resourcesDe as resourcesDeFullscreen } from '../packages/plugins/Fullscreen/src/language'
12+
import { resourcesDe as resourcesDeGeoLocation } from '../packages/plugins/GeoLocation/src/language'
13+
import { resourcesDe as resourcesDeGfi } from '../packages/plugins/Gfi/src/language'
14+
import { resourcesDe as resourcesDeIconMenu } from '../packages/plugins/IconMenu/src/language'
15+
import { resourcesDe as resourcesDeLayerChooser } from '../packages/plugins/LayerChooser/src/language'
16+
import { resourcesDe as resourcesDeLegend } from '../packages/plugins/Legend/src/language'
17+
import { resourcesDe as resourcesDeLoadingIndicator } from '../packages/plugins/LoadingIndicator/src/language'
18+
import { resourcesDe as resourcesDePins } from '../packages/plugins/Pins/src/language'
19+
import { resourcesDe as resourcesDeScale } from '../packages/plugins/Scale/src/language'
20+
import { resourcesDe as resourcesDeToast } from '../packages/plugins/Toast/src/language'
21+
import { resourcesDe as resourcesDeZoom } from '../packages/plugins/Zoom/src/language'
22+
23+
// // // clients // // //
24+
25+
import { dishDe } from '../packages/clients/dish/src/language'
26+
import { dishHeaderDe } from '../packages/clients/dish/src/plugins/Header/language'
27+
import { dishModalDe } from '../packages/clients/dish/src/plugins/Modal/language'
28+
import { meldemichelDe } from '../packages/clients/meldemichel/src/language'
29+
import { meldemichelDe as meldemichelAfmButtonDe } from '../packages/clients/meldemichel/src/plugins/AfmButton/language'
30+
import { snowboxDe } from '../packages/clients/snowbox/src/language'
31+
import { textLocatorDe } from '../packages/clients/textLocator/src/language'
32+
import { textLocatorDe as textLocatorHeaderDe } from '../packages/clients/textLocator/src/plugins/Header/language'
33+
import { geometrySearchDe } from '../packages/clients/textLocator/src/plugins/GeometrySearch/language'
34+
35+
// // // resources // // //
36+
37+
const resources = {
38+
common: {
39+
...resourcesDeCore,
40+
dish: dishDe,
41+
meldemichel: meldemichelDe,
42+
snowbox: snowboxDe,
43+
textLocator: textLocatorDe,
44+
plugins: {
45+
addressSearch: resourcesDeAddressSearch.plugins.addressSearch,
46+
attributions: resourcesDeAttributions.plugins.attributions,
47+
dish: {
48+
...dishHeaderDe,
49+
...dishModalDe
50+
},
51+
draw: resourcesDeDraw.plugins.draw,
52+
export: resourcesDeExport.plugins.export,
53+
filter: resourcesDeFilter.plugins.filter,
54+
fullscreen: resourcesDeFullscreen.plugins.fullscreen,
55+
geoLocation: resourcesDeGeoLocation.plugins.geoLocation,
56+
// geometrySearch is from textLocator
57+
geometrySearch: {
58+
...geometrySearchDe
59+
},
60+
gfi: resourcesDeGfi.plugins.gfi,
61+
iconMenu: resourcesDeIconMenu.plugins.iconMenu,
62+
layerChooser: resourcesDeLayerChooser.plugins.layerChooser,
63+
legend: resourcesDeLegend.plugins.legend,
64+
loadingIndicator: resourcesDeLoadingIndicator.plugins.loadingIndicator,
65+
meldemichel: {
66+
...meldemichelAfmButtonDe
67+
},
68+
pins: resourcesDePins.plugins.pins,
69+
scale: resourcesDeScale.plugins.scale,
70+
textLocator: {
71+
...textLocatorHeaderDe
72+
},
73+
toast: resourcesDeToast.plugins.toast,
74+
zoom: resourcesDeZoom.plugins.zoom,
75+
}
76+
}
77+
} as const
78+
79+
declare module 'i18next' {
80+
interface CustomTypeOptions {
81+
defaultNS: "common"
82+
resources: typeof resources
83+
}
84+
}

packages/clients/afm/tsconfig.json

Lines changed: 0 additions & 3 deletions
This file was deleted.

packages/clients/dish/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
- Fix: Extend typing for search result function according to type package update.
77
- Fix: Import types `AddressSearchState` and `AddressSearchGetters` from correct position.
88
- Fix: Import enum `SearchResultSymbols` from correct position.
9+
- Fix: The alt text to the "Landesdachmarke" for screen readers was missing.
910
- Chore: Change value of `pins.movable` configuration to `'drag'` as using a boolean has been deprecated in a future release.
1011
- Chore: Upgrade `@masterportal/masterportalapi` from `2.8.0` to `2.40.0` and subsequently `ol` from `^7.1.0` to `^9.2.4`.
1112
- Chore: Update `@polar`-dependencies to the latest versions.
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
export const dishDe = {
2+
backendSizeError:
3+
'Die Suche ist zu allgemein. Bitte wählen Sie weitere Suchbegriffe oder schränken Sie die Suche über einen Filter ein.',
4+
unknownError: 'Ein unbekannter Fehler ist aufgetreten.',
5+
idNotFound:
6+
'Die verlinkte ID konnte leider nicht aufgelöst werden. Bitte verwenden Sie Suche und Karte, um zum Denkmal zu navigieren.',
7+
addressSearchHint: 'Eingabe von z.B. Bezeichnung, Lage, Adresse, ...',
8+
} as const
9+
10+
export const resourcesDe = {
11+
dish: dishDe,
12+
plugins: {
13+
gfi: {
14+
property: {
15+
export: 'Export Detailinformationen',
16+
},
17+
toggle: 'Informationen zu Sachgesamtheit öffnen/schließen',
18+
},
19+
},
20+
} as const
21+
22+
export const resourcesEn = {
23+
dish: {
24+
backendSizeError:
25+
'Too broad search. Please choose additional search terms or use a filter.',
26+
unknownError: 'An unknown error occurred.',
27+
idNotFound:
28+
'The linked ID could not be found. Please use the search function or map to navigate to your point of interest.',
29+
addressSearchHint: 'Entry of e.g. monument names, location, address, ...',
30+
},
31+
plugins: {
32+
gfi: {
33+
property: {
34+
export: 'Detail information export',
35+
},
36+
toggle: 'Open/close additional information',
37+
},
38+
},
39+
} as const
40+
41+
const locales = [
42+
{
43+
type: 'de',
44+
resources: resourcesDe,
45+
},
46+
{
47+
type: 'en',
48+
resources: resourcesEn,
49+
},
50+
]
51+
52+
export default locales

packages/clients/dish/src/locales.ts

Lines changed: 0 additions & 47 deletions
This file was deleted.

packages/clients/dish/src/mapConfig.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
dishBaseUrl,
88
// servicePrefix, s.u.
99
} from './services'
10-
import locales from './locales'
10+
import locales from './language'
1111

1212
const shBlue = '#003064'
1313
const shWhite = '#FFFFFF'
@@ -171,7 +171,7 @@ export const mapConfiguration = {
171171
groupProperties: {
172172
groupDenkmalsuche: {
173173
label: 'Denkmalsuche',
174-
hint: 'common:dish.addressSearchHint',
174+
hint: 'dish.addressSearchHint',
175175
resultDisplayMode: 'categorized',
176176
limitResults: 3,
177177
},

packages/clients/dish/src/plugins/Gfi/ActionButton.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
text
66
:href="exportProperty"
77
target="_blank"
8-
:alt="$t('common:plugins.gfi.property.imageAlt')"
9-
:title="$t('common:plugins.gfi.property.linkTitle')"
10-
:aria-label="$t('common:plugins.gfi.property.export')"
8+
:alt="$t('plugins.gfi.property.imageAlt')"
9+
:title="$t('plugins.gfi.property.linkTitle')"
10+
:aria-label="$t('plugins.gfi.property.export')"
1111
onmousedown="return false"
1212
>
1313
<v-icon small>fa-download</v-icon>
14-
{{ $t('common:plugins.gfi.property.export') }}
14+
{{ $t('plugins.gfi.property.export') }}
1515
</v-btn>
1616
</template>
1717

packages/clients/dish/src/plugins/Gfi/Content.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<v-btn
77
icon
88
small
9-
:aria-label="$t('common:plugins.gfi.header.close')"
9+
:aria-label="$t('plugins.gfi.header.close')"
1010
@click="close(true)"
1111
>
1212
<v-icon small>fa-xmark</v-icon>
@@ -49,7 +49,7 @@
4949
<v-btn
5050
icon
5151
x-small
52-
:aria-label="$t('common:plugins.gfi.toggle')"
52+
:aria-label="$t('plugins.gfi.toggle')"
5353
@click="toggleSachgesamtheit"
5454
>
5555
<v-icon small>

packages/clients/dish/src/plugins/Header/Header.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<h1 class="polar-plugin-header">
3-
{{ $t('common:plugins.dish.header.text') }}
3+
{{ $t('plugins.dish.header.text') }}
44
</h1>
55
</template>
66

packages/clients/dish/src/plugins/Header/language.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
import { LanguageOption } from '@polar/lib-custom-types'
22

3+
export const dishHeaderDe = {
4+
header: {
5+
text: 'Denkmalkarte Schleswig-Holstein',
6+
},
7+
} as const
8+
39
const lang: LanguageOption[] = [
410
{
511
type: 'de',
612
resources: {
713
plugins: {
814
dish: {
9-
header: {
10-
text: 'Denkmalkarte Schleswig-Holstein',
11-
},
15+
...dishHeaderDe,
1216
},
1317
},
1418
},

0 commit comments

Comments
 (0)