@opengeoweb/sigmet-airmet 9.23.1 → 9.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.esm.js CHANGED
@@ -3,32 +3,512 @@ import * as React from 'react';
3
3
  import React__default from 'react';
4
4
  import { FormControlLabel, Radio, Grid, Typography, Box, Button, Checkbox, MenuItem, FormHelperText, useTheme, Dialog, DialogTitle, DialogContent, Card, LinearProgress, List, ListItemButton, Backdrop, CircularProgress } from '@mui/material';
5
5
  import { useFormContext } from 'react-hook-form';
6
- import { useDraftFormHelpers, ReactHookFormRadioGroup, hasValidGeometry, ReactHookFormSelect, ReactHookFormNumberField, isInteger, isValidMax, isValidMin, isEmpty, ReactHookFormDateTime, countIntersectionPoints, hasMulitpleIntersections, ReactHookFormHiddenInput, isMaximumOneDrawing, hasIntersectionWithFIR, isValidGeoJsonCoordinates, isXHoursBefore, isXHoursAfter, ReactHookFormTextField, isLatitude, isNonOrBothCoordinates, isLongitude, ReactHookFormFormControl, isGeometryDirty, ReactHookFormProvider, defaultFormOptions } from '@opengeoweb/form-fields';
6
+ import { FORM_FIELDS_NAMESPACE, useDraftFormHelpers, ReactHookFormRadioGroup, hasValidGeometry, ReactHookFormSelect, ReactHookFormNumberField, isInteger, isValidMax, isValidMin, isEmpty, ReactHookFormDateTime, countIntersectionPoints, hasMulitpleIntersections, ReactHookFormHiddenInput, isMaximumOneDrawing, isValidGeoJsonCoordinates, hasIntersectionWithFIR, isXHoursBefore, isXHoursAfter, ReactHookFormTextField, isLatitude, isNonOrBothCoordinates, isLongitude, ReactHookFormFormControl, isGeometryDirty, ReactHookFormProvider, defaultFormOptions } from '@opengeoweb/form-fields';
7
7
  import { useApiContext, useApi, createApiInstance, createNonAuthApiInstance, createFakeApiInstance, ApiProvider } from '@opengeoweb/api';
8
8
  import { defaultGeoJSONStyleProperties, defaultIntersectionStyleProperties, defaultPoint, addGeoJSONProperties, defaultBox, defaultPolygon, DRAWMODE, addSelectionTypeToGeoJSON, defaultDelete, getIcon, MapControls, MapViewLayer, useMapDrawTool, addFeatureProperties, rewindGeometry } from '@opengeoweb/webmap-react';
9
+ import i18n from 'i18next';
10
+ import { useTranslation } from 'react-i18next';
9
11
  import { dateUtils, ToggleMenu, CustomTooltip, useIsMounted, StatusTag, AlertBanner, ConfirmationServiceProvider, usePreventBrowserClose, useConfirmationDialog, isAxiosError, getAxiosErrorMessage, usePoller, ErrorBoundary } from '@opengeoweb/shared';
12
+ import { LayerManagerMapButtonConnect, LegendMapButtonConnect, MultiDimensionSelectMapButtonsConnect, MapViewConnect, TimeSliderConnect, LegendConnect, LayerManagerConnect } from '@opengeoweb/core';
10
13
  import { DrawFIRLand, ChevronLeft, Edit, Success, Clock } from '@opengeoweb/theme';
11
14
  import { LayerType, webmapUtils } from '@opengeoweb/webmap';
12
15
  import { debounce } from 'lodash';
13
16
  import { useDispatch, useSelector, shallowEqual } from 'react-redux';
14
17
  import { mapSelectors, syncGroupsActions, mapStoreActions, defaultLayers, syncConstants } from '@opengeoweb/store';
15
- import { LayerManagerMapButtonConnect, LegendMapButtonConnect, MultiDimensionSelectMapButtonsConnect, MapViewConnect, TimeSliderConnect, LegendConnect, LayerManagerConnect } from '@opengeoweb/core';
16
- import { useAuthenticationContext } from '@opengeoweb/authentication';
17
18
  import { Box as Box$1 } from '@mui/system';
18
- import 'i18next';
19
- import 'react-i18next';
19
+ import { useAuthenticationContext } from '@opengeoweb/authentication';
20
20
 
21
21
  var en = {
22
- "sigmet-airmet": "sigmet"
22
+ "sigmet-airmet": "sigmet",
23
+ levels: "Levels",
24
+ "not-published": "(Not published)",
25
+ "valid-time": "Valid time",
26
+ "vulcanic-ash-description": "Use the FIR to indicate the direction the Volcanic Ash is moving to",
27
+ "vulcanic-VA-SIGMET-text": "Cancel VA SIGMET without VA MOV TO information",
28
+ "vulcanic-cloud-moving-text": "Volcanic Cloud is moving in the direction of",
29
+ unknown: "Unknown",
30
+ "create-new-product": "Create a new {{ product }}",
31
+ discard: "DISCARD",
32
+ save: "Save",
33
+ cancel: "Cancel",
34
+ publish: "Publish",
35
+ back: "BACK",
36
+ draft: "DRAFT",
37
+ "error-title": "Something went wrong with loading the configuration file",
38
+ "error-auth-login": "This feature is protected by authentication. Please log in to proceed",
39
+ "error-config": "An error has occurred while loading the config",
40
+ "error-backend": "An error has occurred while retrieving the list, please try again",
41
+ "error-auth": "This feature is protected by authentication",
42
+ "saved-as-draft": "saved as draft",
43
+ cancels: "Cancels",
44
+ close: "Close",
45
+ "discard-non-capitalized": "Discard",
46
+ "are-you-sure-you-want-to-discard": "Are you sure you would like to discard this {{product}}? Its properties will be lost`",
47
+ "save-changes-made": "Do you want to save any changes made?",
48
+ "publish-this-product": "Are you sure you want to publish this {{product}}?",
49
+ "cancel-this-product": "Are you sure you want to cancel this {{product}}?`",
50
+ "save-and-close": "Save and close",
51
+ "discard-and-close": "Discard and close",
52
+ "drop-a-point-as": "Drop a point as {{type}} position`",
53
+ "draw-a-box-as": "Draw a box as {{type}} position",
54
+ "draw-a-shape-as": "Draw a shape as {{type}} position`",
55
+ "set-a-fir-as": "Set FIR as {{type}} position`",
56
+ "remove-geometry": "Remove geometry",
57
+ "valid-until-time": "Valid until time has to be after Valid from time",
58
+ "discard-product": "Discard {{product}}",
59
+ "issue-time": "Issue time",
60
+ "type-title": "Type",
61
+ "phenomenon-title": "What",
62
+ "observation-label": "Observed",
63
+ "forecast-label": "Forecast",
64
+ "valid-from-before-current-error": "Valid from time cannot be before current time",
65
+ "valid-from-time-error": "Valid from time can be no more than {{hours}} hours after current time",
66
+ "date-and-time": "Date and time",
67
+ "valid-from": "Valid from",
68
+ "valid-until": "Valid until",
69
+ "valid-until-time-error": "Valid until time can be no more than {{hours}} hours after Valid from time",
70
+ "select-fir-title": "Where",
71
+ "select-fir-label": "Select FIR",
72
+ "geometry-coodinates-empty-message": "A start position drawing is required",
73
+ "geometry-no-intersection-message": "The start position needs to be (partly) inside the FIR",
74
+ "geometry-exit-draw-mode-message": "Press ESC to exit draw mode",
75
+ "geometry-max-feature-points-message": "Intersection of the drawn polygon with the FIR-boundary has more than 6 individual points. Check if the TAC in the preview corresponds to the intended area.",
76
+ "geometry-multi-intersections-message": "The drawn polygon has multiple intersections with the FIR-boundary. The drawn polygon will be used for the TAC-code.",
77
+ "geometry-maximum-points-message": "The start position drawing allows a maximum of {{maxPoints}} individual points",
78
+ "geometry-more-than-6-points-message": "The start/end position drawing has exceeded 6 individual points. The TAC has a total of {{totalDrawnPoints}} points. If possible, reduce the number of points.",
79
+ "geometry-intersection-above-6-points-message": "The start/end position of the intersected polygon has {{intersectingPolygonPointsTotal}} points, and the intersection of the drawn polygon with the FIR-boundary has exceeded 6 individual points. Check if the TAC in the preview corresponds to the intended area.",
80
+ "geometry-only-one-start-position-drawing": "Only one start position drawing is allowed",
81
+ "progress-get-movement-step-valktmessage": "Speed should be rounded to the nearest {{value}}kt",
82
+ "progress-get-movement-step-valkmhmessage": "Speed should be rounded to the nearest {{value}}kmh",
83
+ "progress-coordinate-empty-message": "An end position drawing is required when selecting End position",
84
+ "progress-no-intersection-message": "The end position needs to be (partly) inside the FIR",
85
+ "invalid-unit": "Invalid unit",
86
+ "progress-maximumPointsMessage": "The end position drawing allows a maximum of {{maxPoints}} individual points",
87
+ "progress-more-than-6-points-message": "The start/end position drawing has exceeded 6 individual points. The TAC has a total of {{totalDrawnPoints}} points. If possible, reduce the number of points.",
88
+ "progress-intersection-above-6-points-message": "The start/end position of the intersected polygon has {{intersectingPolygonPointsTotal}} points, and the intersection of the drawn polygon with the FIR-boundary has exceeded 6 individual points. Check if the TAC in the preview corresponds to the intended area.",
89
+ "progress-radio-button-label-no-va-exp": "No volcanic ash expected",
90
+ "progress-radio-button-label-stationary": "Stationary",
91
+ "progress-radio-button-label-movement": "Movement",
92
+ "progress-radio-button-label-end-potision": "End position",
93
+ "progress-movement-direction-label": "Set direction",
94
+ "progress-movement-unit-label": "Unit",
95
+ "progress-movement-speed-label": "Step speed",
96
+ "progress-the-minimum-level-in-movement": "The minimum level in {{movementUnitType}} is {{movementUnit}}",
97
+ "progress-the-maxium-level-in-movement": "The maximum level in {{movementUnitType}} is {{movementUnit}}",
98
+ "progress-only-one-position-drawing": "Only one end position drawing is allowed",
99
+ at: "At",
100
+ select: "Select",
101
+ "observation-forecast-error": "Observation time cannot be in the future",
102
+ "start-position": "Start position",
103
+ between: "Between",
104
+ above: "Above",
105
+ change: "Change",
106
+ weakening: "Weakening",
107
+ "no-change": "No change",
108
+ intensifying: "Intensifying",
109
+ "issued-at": "Issued at",
110
+ "volcano-name": "Volcano name",
111
+ latitude: "Latitude",
112
+ longitude: "Longitude",
113
+ "tac-missing-data": "Missing data: no TAC can be generated",
114
+ "invalid-surface-wind-direction-message": "Direction must be rounded to the nearest {{value}} deg.",
115
+ "surface-wind-label": "wind direction",
116
+ "surface-wind-speed-label": "speed",
117
+ "surface-wind-helper-text": "Value in degrees",
118
+ "surface-wind-rule-min-max-message": "Direction should be between 10 and 360 deg.",
119
+ "surface-wind-minimum-wind-speed": "The minimum wind speed in {{windUnit}} is {{minWindSpeedValue}}",
120
+ "surface-wind-maximum-wind-speed": "The maximum wind speed in {{windUnit}} is {{maxWindSpeedValue}}",
121
+ "invalid-surface-visibility-till-750-steps-message": "A visibility below 750m must be rounded to the nearest {{value}}m",
122
+ "invalid-surface-visibility-from-750-steps-message": "A visibility above 750m must be rounded to the nearest {{value}}m",
123
+ set: "Set",
124
+ "levels-get-level-invalid-steps-for-fl-unit-message": "Levels must be rounded to the nearest {{value}}",
125
+ "levels-get-level-invalid-steps-for-ft-unit-message": "Levels must be rounded to the nearest {{value}}ft",
126
+ "levels-get-level-invalid-steps-for-m-unit-message": "Levels must be rounded to the nearest {{value}}m",
127
+ "levels-invalid-unit-message": "Level unit not defined",
128
+ "levels-invalid-level-unit-combination-message": "Invalid unit combination",
129
+ level: "Level",
130
+ "levels-the-minimum-level": "The minimum level in {{levelUnit}} is {{minLevelValue}}",
131
+ "levels-the-maximum-level": "The maximum level in {{levelUnit}} is {{maxLevelValue}}",
132
+ "levels-upper-level-label": "Upper level",
133
+ "unit-label": "Unit",
134
+ "levels-lower-level-label": "Lower level",
135
+ "levels-tops-label": "Tops",
136
+ progress: "Progress",
137
+ "surface-visibility": "Visibility",
138
+ "surface-visibility-cause": "Cause",
139
+ "surface-visibility-minimum-visibility": "The minimum visibility in meters is {{minimumVisibility}}",
140
+ "surface-visibility-maximum-visibility": "The maximum visibility in meters is {{maximumVisibility}}",
141
+ "surface-visibility-helper-text": "Value in meters",
142
+ phenomenon: "Phenomenon"
23
143
  };
24
144
  var fi = {
25
- "sigmet-airmet": "sigmet"
145
+ "sigmet-airmet": "sigmet",
146
+ levels: "Tasot",
147
+ "not-published": "(Ei julkaistu)",
148
+ "valid-time": "Voimassa oleva aika",
149
+ "vulcanic-ash-description": "Käytä FIR:iä määrittääksesi suunnan johon vulkaaninen tuhkapilvi on liikkumassa",
150
+ "vulcanic-VA-SIGMET-text": "Peruuta VA SIGMET ilman VA MOV TO tietoja",
151
+ "vulcanic-cloud-moving-text": "Vulkaaninen tuhkapilvi on liikkumassa suuntaan: ",
152
+ unknown: "Ei tiedossa",
153
+ "create-new-product": "Luo uusi {{product}}",
154
+ discard: "HYLKÄÄ",
155
+ save: "Tallenna",
156
+ cancel: "Peruuta",
157
+ publish: "Julkaise",
158
+ back: "PALAA TAKAISIN",
159
+ draft: "LUONNOS",
160
+ "error-title": "Virhe konfiguraatiotiedostoa ladatessa",
161
+ "error-auth-login": "Tämän toiminnallisuuden käyttäminen vaatii tunnistautumista. Kirjaudu sisään jatkaaksesi",
162
+ "error-config": "Konfiguraatiota ladatessa on havaittu virhe",
163
+ "error-backend": "Tietoja haettaessa on havaittu virhe, yritä uudelleen",
164
+ "error-auth": "Tämän toiminnallisuuden käyttäminen vaatii tunnistautumista",
165
+ "saved-as-draft": "tallenna luonnoksena",
166
+ cancels: "Peruu",
167
+ close: "Sulje",
168
+ "discard-non-capitalized": "Hylkää",
169
+ "are-you-sure-you-want-to-discard": "Oletko varma, että haluat hylätä kyseisen {{product}}? Kaikki ilmoitetut tiedot menetetään",
170
+ "save-changes-made": "Haluatko tallentaa kaikki tehdyt muutokset?",
171
+ "publish-this-product": "Oletko varma, että haluat julkaista tämän {{product}}:n?",
172
+ "cancel-this-product": "Oletko varma, että haluat peruuttaa tämän {{product}}:n?",
173
+ "save-and-close": "Tallenna ja sulje",
174
+ "discard-and-close": "Hylkää ja sulje",
175
+ "drop-a-point-as": "Pudota piste kartalle ja käytä sitä {{type}} sijaintina ",
176
+ "draw-a-box-as": "Piirrä laatikko kartalle ja käytä sitä {{type}} sijaintina",
177
+ "draw-a-shape-as": "Piirrä muoto kartalle ja käytä sitä {{type}} sijaintina",
178
+ "set-a-fir-as": "Aseta FIR {{type}}:n sijaintina",
179
+ "remove-geometry": "Poista geometria",
180
+ "valid-until-time": "Voimassaoloajan päättymishetken on oltava voimassaoloajan alkuhetken jälkeen",
181
+ "discard-product": "Hylkää {{product}}",
182
+ "issue-time": "Julkaisuaika",
183
+ "type-title": "Tyyppi",
184
+ "phenomenon-title": "Mikä",
185
+ "observation-label": "Havainto",
186
+ "forecast-label": "Ennuste",
187
+ "valid-from-before-current-error": "Voimassaoloajan alkuhetki ei voi olla ennen nykyistä ajanhetkeä.",
188
+ "valid-from-time-error": "Voimassaoloajan alkuhetki ei voi olla enempää kuin {{hours}} nykyisen ajanhetken jälkeen.",
189
+ "date-and-time": "Päivämäärä ja aika",
190
+ "valid-from": "Alkuhetki",
191
+ "valid-until": "Päättymishetki",
192
+ "valid-until-time-error": "Voimassaoloajan loppuhetki ei voi olla enempää kuin {{hours}} voimassaoloajan alkuhetken jälkeen.",
193
+ "select-fir-title": "Missä",
194
+ "select-fir-label": "Valitse FIR",
195
+ "geometry-coodinates-empty-message": "Aloituspaikan piirros vaaditaan",
196
+ "geometry-no-intersection-message": "Aloituspaikan sijainnin on oltava ainakin osittain FIR:n sisäpuolella.",
197
+ "geometry-exit-draw-mode-message": "Paina ESC:iä poistuaksesi piirtotilasta",
198
+ "geometry-max-feature-points-message": "Piirretyn polygonin ja FIR-rajan leikkauspisteessä on yli 6 yksittäistä pistettä. Tarkita vastaako esikatselun TAC aiottua aluetta.",
199
+ "geometry-multi-intersections-message": "Piirretyllä polygonilla on useita leikkauspisteitä FIR-rajan kanssa. Piirrettyä polygonia käytetään TAC-koodin luomiseen",
200
+ "geometry-maximum-points-message": "Aloituspisteenä käytettävä piirros sallii maksimissaan {{maxPoints}} yksittäistä pistettä.",
201
+ "geometry-more-than-6-points-message": "Piirros jota käytetään sijainnin aloitukseen tai lopetukseen sisältää enemmän kuin sallitun määrän: 6 yksittäistä pistettä. TAC-viestissä on kaikenkaikkiaan {{totalDrawnPoints}} pistettä. Jos mahdollista, vähennä pisteiden määrää.",
202
+ "geometry-intersection-above-6-points-message": "Leikatun polygonin alku-/päätepisteessä on {{intersectingPolygonPointsTotal}} pistettä. Piirretyn polygonin ja FIR-rajan leikkauspiste on ylittänyt 6 yksittäistä pistettä. Tarkista vastaako esikatselun TAC aiottua aluetta.",
203
+ "geometry-only-one-start-position-drawing": "Vain yksi aloitusaluepiirros on sallittu.",
204
+ "progress-get-movement-step-valktmessage": "Nopeus tulisi pyöristää lähimpään {{value}}kt arvoon.",
205
+ "progress-get-movement-step-valkmhmessage": "Nopeus tulisi pyöristää lähimpään {{value}}kmh arvoon.",
206
+ "progress-coordinate-empty-message": "Lopetuspaikan piirtäminen on pakollista, kun valitset lopetuspaikan",
207
+ "progress-no-intersection-message": "Lopetuspaikan täytyy olla (osittain) FIR-alueen sisällä.",
208
+ "invalid-unit": "Virheellinen yksikkö",
209
+ "progress-maximumPointsMessage": "Lopetuspaikan piirtäminen sallii enintään {{maxPoints}} yksittäistä pistettä.",
210
+ "progress-more-than-6-points-message": "Aloitus-/lopetuspaikan piirroksessa on yli 6 yksittäistä pistettä. TAC:ssa on kaikenkaikkiaan {{totalDrawnPoints}} pistettä. Vähennä pisteiden määrää, jos mahdollista.",
211
+ "progress-intersection-above-6-points-message": "Leikatun polygonin aloitus-/lopetuspaikassa on {{intersectingPolygonPointsTotal}} pistettä. Piirretyn monikulmion leikkaus FIR-rajalla on ylittänyt 6 yksittäistä pistettä. Tarkista, vastaako esikatselun TAC aiottua aluetta.",
212
+ "progress-radio-button-label-no-va-exp": "Tulivuoren tuhkaa ei odotettavissa",
213
+ "progress-radio-button-label-stationary": "Liikkumaton",
214
+ "progress-radio-button-label-movement": "Liikkuva",
215
+ "progress-radio-button-label-end-potision": "Lopullinen sijainti",
216
+ "progress-movement-direction-label": "Aseta suunta",
217
+ "progress-movement-unit-label": "Yksikkö",
218
+ "progress-movement-speed-label": "Askeleen nopeus",
219
+ "progress-the-minimum-level-in-movement": "Pienin taso {{movementUnitType}}:ssa on {{movementUnit}}",
220
+ "progress-the-maxium-level-in-movement": "Suurin taso {{movementUnitType}}:ssa on {{movementUnit}}",
221
+ "progress-only-one-position-drawing": "Vain yksi lopetuspaikan piirros on sallittu",
222
+ at: "Ajanhetkessä",
223
+ select: "Valitse",
224
+ "observation-forecast-error": "Havainnon ajankohta ei voi olla tulevaisuudessa",
225
+ "start-position": "Alkusijainti",
226
+ between: "Välissä",
227
+ above: "Yläpuolella",
228
+ change: "Muutos",
229
+ weakening: "Heikentyvä",
230
+ "no-change": "Ei muutosta",
231
+ intensifying: "Vahvistuva",
232
+ "issued-at": "Annettu klo:",
233
+ "volcano-name": "Tulivuoren nimi",
234
+ latitude: "Leveysaste",
235
+ longitude: "Pituusaste",
236
+ "tac-missing-data": "Tarvittavia tietoja puuttu, TAC:ia ei voida generoida",
237
+ "invalid-surface-wind-direction-message": "Suunta tulee pyöristää lähimpään {{value}} asteeseen.",
238
+ "surface-wind-label": "tuulen suunta",
239
+ "surface-wind-speed-label": "nopeus",
240
+ "surface-wind-helper-text": "Arvo asteina",
241
+ "surface-wind-rule-min-max-message": "Suunnan on oltava 10 ja 360 asteen välissä.",
242
+ "surface-wind-minimum-wind-speed": "Minimituulennopeus käyttäen yksikköä {{windUnit}} on {{minWindSpeedValue}}",
243
+ "surface-wind-maximum-wind-speed": "Maksimituulennopeus käyttäen yksikköä {{windUnit}} on {{maxWindSpeedValue}}",
244
+ "invalid-surface-visibility-till-750-steps-message": "Alle 750m näkyvyys tulee pyöristää lähimpään {{value}}m arvoon.",
245
+ "invalid-surface-visibility-from-750-steps-message": "Yli 750m näkyvyys tulee pyöristää lähimpään {{value}}m arvoon.",
246
+ set: "Aseta",
247
+ "levels-get-level-invalid-steps-for-fl-unit-message": "Tasot tulee pyöristää lähimpään {{value}} arvoon.",
248
+ "levels-get-level-invalid-steps-for-ft-unit-message": "Tasot tulee pyöristää lähimpään {{value}}ft arvoon.",
249
+ "levels-get-level-invalid-steps-for-m-unit-message": "Tasot tulee pyöristää lähimpään {{value}}m arvoon",
250
+ "levels-invalid-unit-message": "Tason yksikkö ei ole määritelty",
251
+ "levels-invalid-level-unit-combination-message": "Virheellinen yhdistelmä yksiköitä",
252
+ level: "Taso",
253
+ "levels-the-maximum-level": "Tason maksimiarvo käyttäen yksikköä {{levelUnit}} on {{maxLevelValue}}",
254
+ "levels-the-minimum-level": "Tason minimiarvo käyttäen yksiköä {{levelUnit}} on {{minLevelValue}} ",
255
+ "levels-upper-level-label": "Ylempi taso",
256
+ "unit-label": "Yksikkö",
257
+ "levels-lower-level-label": "Alempi taso",
258
+ "levels-tops-label": "Ylittää",
259
+ progress: "Edistyminen",
260
+ "surface-visibility": "Näkyvyys",
261
+ "surface-visibility-cause": "Aiheuttaja",
262
+ "surface-visibility-minimum-visibility": "Miniminäkyvyys metreinä: {{minimumVisibility}}",
263
+ "surface-visibility-maximum-visibility": "Maksiminäkyvyys metreinä: {{maximumVisibility}}",
264
+ "surface-visibility-helper-text": "Arvo metreinä",
265
+ phenomenon: "sääilmiö"
26
266
  };
27
267
  var no = {
28
- "sigmet-airmet": "sigmet"
268
+ "sigmet-airmet": "sigmet",
269
+ levels: "Nivå",
270
+ "not-published": "Ikke publisert",
271
+ "valid-time": "ikke oversatt",
272
+ "vulcanic-ash-description": "Bruk FIR til å indikere retningen den vulkansek asken går mot",
273
+ "vulcanic-VA-SIGMET-text": "ikke oversatt",
274
+ "vulcanic-cloud-moving-text": "Vulkansk askesky går mot",
275
+ unknown: "Ukjent",
276
+ "create-new-product": "Lage et nytt {{ product }}",
277
+ discard: "ikke oversatt",
278
+ save: "ikke oversatt",
279
+ cancel: "ikke oversatt",
280
+ publish: "ikke oversatt",
281
+ back: "ikke oversatt",
282
+ draft: "ikke oversatt",
283
+ "error-title": "ikke oversatt",
284
+ "error-auth-login": "ikke oversatt",
285
+ "error-config": "ikke oversatt",
286
+ "error-backend": "ikke oversatt",
287
+ "error-auth": "ikke oversatt",
288
+ "saved-as-draft": "ikke oversatt",
289
+ cancels: "ikke oversatt",
290
+ close: "ikke oversatt",
291
+ "discard-non-capitalized": "ikke oversatt",
292
+ "are-you-sure-you-want-to-discard": "ikke oversatt",
293
+ "save-changes-made": "ikke oversatt",
294
+ "publish-this-product": "ikke oversatt",
295
+ "cancel-this-product": "ikke oversatt",
296
+ "save-and-close": "ikke oversatt",
297
+ "discard-and-close": "ikke oversatt",
298
+ "drop-a-point-as": "ikke oversatt",
299
+ "draw-a-box-as": "ikke oversatt",
300
+ "draw-a-shape-as": "ikke oversatt",
301
+ "set-a-fir-as": "ikke oversatt",
302
+ "remove-geometry": "ikke oversatt",
303
+ "valid-until-time": "ikke oversatt",
304
+ "discard-product": "ikke oversatt",
305
+ "issue-time": "ikke oversatt",
306
+ "type-title": "ikke oversatt",
307
+ "phenomenon-title": "ikke oversatt",
308
+ "observation-label": "ikke oversatt",
309
+ "forecast-label": "ikke oversatt",
310
+ "valid-from-before-current-error": "ikke oversatt",
311
+ "valid-from-time-error": "ikke oversatt",
312
+ "date-and-time": "ikke oversatt",
313
+ "valid-from": "ikke oversatt",
314
+ "valid-until": "ikke oversatt",
315
+ "valid-until-time-error": "ikke oversatt",
316
+ "select-fir-title": "ikke oversatt",
317
+ "select-fir-label": "ikke oversatt",
318
+ "geometry-coodinates-empty-message": "ikke oversatt",
319
+ "geometry-no-intersection-message": "ikke oversatt",
320
+ "geometry-exit-draw-mode-message": "ikke oversatt",
321
+ "geometry-max-feature-points-message": "ikke oversatt",
322
+ "geometry-multi-intersections-message": "ikke oversatt",
323
+ "geometry-maximum-points-message": "ikke oversatt",
324
+ "geometry-more-than-6-points-message": "ikke oversatt",
325
+ "geometry-intersection-above-6-points-message": "ikke oversatt",
326
+ "geometry-only-one-start-position-drawing": "ikke oversatt",
327
+ "progress-get-movement-step-valktmessage": "ikke oversatt",
328
+ "progress-get-movement-step-valkmhmessage": "ikke oversatt",
329
+ "progress-coordinate-empty-message": "ikke oversatt",
330
+ "progress-no-intersection-message": "ikke oversatt",
331
+ "invalid-unit": "ikke oversatt",
332
+ "progress-maximumPointsMessage": "ikke oversatt",
333
+ "progress-more-than-6-points-message": "ikke oversatt",
334
+ "progress-intersection-above-6-points-message": "ikke oversatt",
335
+ "progress-radio-button-label-no-va-exp": "ikke oversatt",
336
+ "progress-radio-button-label-stationary": "ikke oversatt",
337
+ "progress-radio-button-label-movement": "ikke oversatt",
338
+ "progress-radio-button-label-end-potision": "ikke oversatt",
339
+ "progress-movement-direction-label": "ikke oversatt",
340
+ "progress-movement-unit-label": "ikke oversatt",
341
+ "progress-movement-speed-label": "ikke oversatt",
342
+ "progress-the-minimum-level-in-movement": "ikke oversatt",
343
+ "progress-the-maxium-level-in-movement": "ikke oversatt",
344
+ "progress-only-one-position-drawing": "ikke oversatt",
345
+ at: "ikke oversatt",
346
+ select: "ikke oversatt",
347
+ "observation-forecast-error": "ikke oversatt",
348
+ "start-position": "ikke oversatt",
349
+ between: "ikke oversatt",
350
+ above: "ikke oversatt",
351
+ change: "ikke oversatt",
352
+ weakening: "ikke oversatt",
353
+ "no-change": "ikke oversatt",
354
+ intensifying: "ikke oversatt",
355
+ "issued-at": "ikke oversatt",
356
+ "volcano-name": "ikke oversatt",
357
+ latitude: "ikke oversatt",
358
+ longitude: "ikke oversatt",
359
+ "tac-missing-data": "ikke oversatt",
360
+ "invalid-surface-wind-direction-message": "ikke oversatt",
361
+ "surface-wind-label": "ikke oversatt",
362
+ "surface-wind-speed-label": "ikke oversatt",
363
+ "surface-wind-helper-text": "ikke oversatt",
364
+ "surface-wind-rule-min-max-message": "ikke oversatt",
365
+ "surface-wind-minimum-wind-speed": "ikke oversatt",
366
+ "surface-wind-maximum-wind-speed": "ikke oversatt",
367
+ "invalid-surface-visibility-till-750-steps-message": "ikke oversatt",
368
+ "invalid-surface-visibility-from-750-steps-message": "ikke oversatt",
369
+ set: "ikke oversatt",
370
+ "levels-get-level-invalid-steps-for-fl-unit-message": "ikke oversatt",
371
+ "levels-get-level-invalid-steps-for-ft-unit-message": "ikke oversatt",
372
+ "levels-get-level-invalid-steps-for-m-unit-message": "ikke oversatt",
373
+ "levels-invalid-unit-message": "ikke oversatt",
374
+ "levels-invalid-level-unit-combination-message": "ikke oversatt",
375
+ level: "ikke oversatt",
376
+ "levels-the-minimum-level": "ikke oversatt",
377
+ "levels-the-maximum-level": "ikke oversatt",
378
+ "levels-upper-level-label": "ikke oversatt",
379
+ "unit-label": "ikke oversatt",
380
+ "levels-lower-level-label": "ikke oversatt",
381
+ "levels-tops-label": "ikke oversatt",
382
+ progress: "ikke oversatt",
383
+ "surface-visibility": "ikke oversatt",
384
+ "surface-visibility-cause": "ikke oversatt",
385
+ "surface-visibility-minimum-visibility": "ikke oversatt",
386
+ "surface-visibility-maximum-visibility": "ikke oversatt",
387
+ "surface-visibility-helper-text": "ikke oversatt",
388
+ phenomenon: "ikke oversatt"
29
389
  };
30
390
  var nl = {
31
- "sigmet-airmet": "sigmet"
391
+ "sigmet-airmet": "sigmet",
392
+ levels: "niet vertaald",
393
+ "not-published": "niet vertaald",
394
+ "valid-time": "niet vertaald",
395
+ "vulcanic-ash-description": "niet vertaald",
396
+ "vulcanic-VA-SIGMET-text": "niet vertaald",
397
+ "vulcanic-cloud-moving-text": "niet vertaald",
398
+ unknown: "niet vertaald",
399
+ "create-new-product": "niet vertaald",
400
+ discard: "niet vertaald",
401
+ save: "niet vertaald",
402
+ cancel: "niet vertaald",
403
+ publish: "niet vertaald",
404
+ back: "niet vertaald",
405
+ draft: "niet vertaald",
406
+ "error-title": "niet vertaald",
407
+ "error-auth-login": "niet vertaald",
408
+ "error-config": "niet vertaald",
409
+ "error-backend": "niet vertaald",
410
+ "error-auth": "niet vertaald",
411
+ "saved-as-draft": "niet vertaald",
412
+ cancels: "niet vertaald",
413
+ close: "niet vertaald",
414
+ "discard-non-capitalized": "niet vertaald",
415
+ "are-you-sure-you-want-to-discard": "niet vertaald",
416
+ "save-changes-made": "niet vertaald",
417
+ "publish-this-product": "niet vertaald",
418
+ "cancel-this-product": "niet vertaald",
419
+ "save-and-close": "niet vertaald",
420
+ "discard-and-close": "niet vertaald",
421
+ "drop-a-point-as": "niet vertaald",
422
+ "draw-a-box-as": "niet vertaald",
423
+ "draw-a-shape-as": "niet vertaald",
424
+ "set-a-fir-as": "niet vertaald",
425
+ "remove-geometry": "niet vertaald",
426
+ "valid-until-time": "niet vertaald",
427
+ "discard-product": "niet vertaald",
428
+ "issue-time": "niet vertaald",
429
+ "type-title": "niet vertaald",
430
+ "phenomenon-title": "niet vertaald",
431
+ "observation-label": "niet vertaald",
432
+ "forecast-label": "niet vertaald",
433
+ "valid-from-before-current-error": "niet vertaald",
434
+ "valid-from-time-error": "niet vertaald",
435
+ "date-and-time": "niet vertaald",
436
+ "valid-from": "niet vertaald",
437
+ "valid-until": "niet vertaald",
438
+ "valid-until-time-error": "niet vertaald",
439
+ "select-fir-title": "niet vertaald",
440
+ "select-fir-label": "niet vertaald",
441
+ "geometry-coodinates-empty-message": "niet vertaald",
442
+ "geometry-no-intersection-message": "niet vertaald",
443
+ "geometry-exit-draw-mode-message": "niet vertaald",
444
+ "geometry-max-feature-points-message": "niet vertaald",
445
+ "geometry-multi-intersections-message": "niet vertaald",
446
+ "geometry-maximum-points-message": "niet vertaald",
447
+ "geometry-more-than-6-points-message": "niet vertaald",
448
+ "geometry-intersection-above-6-points-message": "niet vertaald",
449
+ "geometry-only-one-start-position-drawing": "niet vertaald",
450
+ "progress-get-movement-step-valktmessage": "niet vertaald",
451
+ "progress-get-movement-step-valkmhmessage": "niet vertaald",
452
+ "progress-coordinate-empty-message": "niet vertaald",
453
+ "progress-no-intersection-message": "niet vertaald",
454
+ "invalid-unit": "niet vertaald",
455
+ "progress-maximumPointsMessage": "niet vertaald",
456
+ "progress-more-than-6-points-message": "niet vertaald",
457
+ "progress-intersection-above-6-points-message": "niet vertaald",
458
+ "progress-radio-button-label-no-va-exp": "niet vertaald",
459
+ "progress-radio-button-label-stationary": "niet vertaald",
460
+ "progress-radio-button-label-movement": "niet vertaald",
461
+ "progress-radio-button-label-end-potision": "niet vertaald",
462
+ "progress-movement-direction-label": "niet vertaald",
463
+ "progress-movement-unit-label": "niet vertaald",
464
+ "progress-movement-speed-label": "niet vertaald",
465
+ "progress-the-minimum-level-in-movement": "niet vertaald",
466
+ "progress-the-maxium-level-in-movement": "niet vertaald",
467
+ "progress-only-one-position-drawing": "niet vertaald",
468
+ at: "niet vertaald",
469
+ select: "niet vertaald",
470
+ "observation-forecast-error": "niet vertaald",
471
+ "start-position": "niet vertaald",
472
+ between: "niet vertaald",
473
+ above: "niet vertaald",
474
+ change: "niet vertaald",
475
+ weakening: "niet vertaald",
476
+ "no-change": "niet vertaald",
477
+ intensifying: "niet vertaald",
478
+ "issued-at": "niet vertaald",
479
+ "volcano-name": "niet vertaald",
480
+ latitude: "niet vertaald",
481
+ longitude: "niet vertaald",
482
+ "tac-missing-data": "niet vertaald",
483
+ "invalid-surface-wind-direction-message": "niet vertaald",
484
+ "surface-wind-label": "niet vertaald",
485
+ "surface-wind-speed-label": "niet vertaald",
486
+ "surface-wind-helper-text": "niet vertaald",
487
+ "surface-wind-rule-min-max-message": "niet vertaald",
488
+ "surface-wind-minimum-wind-speed": "niet vertaald",
489
+ "surface-wind-maximum-wind-speed": "niet vertaald",
490
+ "invalid-surface-visibility-till-750-steps-message": "niet vertaald",
491
+ "invalid-surface-visibility-from-750-steps-message": "niet vertaald",
492
+ set: "niet vertaald",
493
+ "levels-get-level-invalid-steps-for-fl-unit-message": "niet vertaald",
494
+ "levels-get-level-invalid-steps-for-ft-unit-message": "niet vertaald",
495
+ "levels-get-level-invalid-steps-for-m-unit-message": "niet vertaald",
496
+ "levels-invalid-unit-message": "niet vertaald",
497
+ "levels-invalid-level-unit-combination-message": "niet vertaald",
498
+ level: "niet vertaald",
499
+ "levels-the-minimum-level": "niet vertaald",
500
+ "levels-the-maximum-level": "niet vertaald",
501
+ "levels-upper-level-label": "niet vertaald",
502
+ "unit-label": "niet vertaald",
503
+ "levels-lower-level-label": "niet vertaald",
504
+ "levels-tops-label": "niet vertaald",
505
+ progress: "niet vertaald",
506
+ "surface-visibility": "niet vertaald",
507
+ "surface-visibility-cause": "niet vertaald",
508
+ "surface-visibility-minimum-visibility": "niet vertaald",
509
+ "surface-visibility-maximum-visibility": "niet vertaald",
510
+ "surface-visibility-helper-text": "niet vertaald",
511
+ phenomenon: "niet vertaald"
32
512
  };
33
513
  var sigmetAirmetTranslations = {
34
514
  en: en,
@@ -2069,10 +2549,20 @@ const useShortTestHelpers = () => {
2069
2549
  };
2070
2550
  };
2071
2551
 
2552
+ const SA_NAMESPACE = 'sigmetairmet';
2553
+ const ns = [SA_NAMESPACE, FORM_FIELDS_NAMESPACE];
2554
+ const translateKeyOutsideComponents = (key, params = undefined) => i18n.t(key, Object.assign({
2555
+ ns
2556
+ }, params));
2557
+ const useSigmetAirmetTranslation = () => useTranslation(ns);
2558
+
2072
2559
  const Change = ({
2073
2560
  isDisabled,
2074
2561
  isReadOnly
2075
2562
  }) => {
2563
+ const {
2564
+ t
2565
+ } = useSigmetAirmetTranslation();
2076
2566
  const {
2077
2567
  isRequired: isRequiredField
2078
2568
  } = useDraftFormHelpers();
@@ -2082,7 +2572,7 @@ const Change = ({
2082
2572
  const isRequired = value => isShortTest() || isRequiredField(value);
2083
2573
  const fieldsDisabled = isDisabled || isShortTest();
2084
2574
  return jsx(ProductFormFieldLayout, Object.assign({
2085
- title: "Change",
2575
+ title: t('change'),
2086
2576
  sx: styles$2.containerItem
2087
2577
  }, {
2088
2578
  children: jsx(Grid, Object.assign({
@@ -2101,17 +2591,17 @@ const Change = ({
2101
2591
  }, {
2102
2592
  children: [jsx(RadioButtonAndLabel, {
2103
2593
  value: "WKN",
2104
- label: "Weakening",
2594
+ label: t('weakening'),
2105
2595
  disabled: fieldsDisabled,
2106
2596
  "data-testid": "change-WKN"
2107
2597
  }), jsx(RadioButtonAndLabel, {
2108
2598
  value: "NC",
2109
- label: "No change",
2599
+ label: t('no-change'),
2110
2600
  disabled: fieldsDisabled,
2111
2601
  "data-testid": "change-NC"
2112
2602
  }), jsx(RadioButtonAndLabel, {
2113
2603
  value: "INTSF",
2114
- label: "Intensifying",
2604
+ label: t('intensifying'),
2115
2605
  disabled: fieldsDisabled,
2116
2606
  "data-testid": "change-INTSF"
2117
2607
  })]
@@ -2621,12 +3111,12 @@ const getDialogtitle = (product, productType) => {
2621
3111
  }
2622
3112
  if (!isInstanceOfCancelSigmetOrAirmet(product)) {
2623
3113
  const phenomenon = productType === 'sigmet' ? SigmetPhenomena[product.phenomenon] : AirmetPhenomena[product.phenomenon];
2624
- return `${productName} ${phenomenon} - ${product.status === 'DRAFT' ? 'saved as draft' : ProductStatusDescription[product.status]}`;
3114
+ return `${productName} ${phenomenon} - ${product.status === 'DRAFT' ? translateKeyOutsideComponents('saved-as-draft') : ProductStatusDescription[product.status]}`;
2625
3115
  }
2626
3116
  if (isInstanceOfCancelSigmet(product)) {
2627
- return `${productName} Cancels ${product.cancelsSigmetSequenceId}`;
3117
+ return `${productName} ${translateKeyOutsideComponents('cancels')} ${product.cancelsSigmetSequenceId}`;
2628
3118
  }
2629
- return `${productName} Cancels ${product.cancelsAirmetSequenceId}`;
3119
+ return `${productName} ${translateKeyOutsideComponents('cancels')} ${product.cancelsAirmetSequenceId}`;
2630
3120
  };
2631
3121
  const getProductFormMode = (canBeOptions, productListItem) => {
2632
3122
  if (productListItem === null) {
@@ -2651,17 +3141,17 @@ const getProductFormLifecycleButtons = ({
2651
3141
  const hasPublishButton = canBe.includes('PUBLISHED');
2652
3142
  const onPublish = () => onButtonPress('PUBLISHED');
2653
3143
  const mobileMenuItems = [...(hasDiscardButton ? [{
2654
- text: 'Discard',
3144
+ text: translateKeyOutsideComponents('discard'),
2655
3145
  action: onDiscard
2656
3146
  }] : []), ...(hasSaveButton ? [{
2657
- text: 'Save',
3147
+ text: translateKeyOutsideComponents('save'),
2658
3148
  action: onSave,
2659
3149
  isDisabled: _areActionsDisabled
2660
3150
  }] : []), ...(hasCancelButton ? [{
2661
- text: 'Cancel',
3151
+ text: translateKeyOutsideComponents('cancel'),
2662
3152
  action: onCancel
2663
3153
  }] : []), ...(hasPublishButton ? [{
2664
- text: 'Publish',
3154
+ text: translateKeyOutsideComponents('publish'),
2665
3155
  action: onPublish,
2666
3156
  isDisabled: _areActionsDisabled
2667
3157
  }] : [])];
@@ -2686,7 +3176,7 @@ const getProductFormLifecycleButtons = ({
2686
3176
  sx: buttonStyle,
2687
3177
  "data-testid": "productform-dialog-discard"
2688
3178
  }, {
2689
- children: "DISCARD"
3179
+ children: translateKeyOutsideComponents('discard')
2690
3180
  })), hasSaveButton && jsx(Button, Object.assign({
2691
3181
  variant: "tertiary",
2692
3182
  onClick: onSave,
@@ -2694,14 +3184,14 @@ const getProductFormLifecycleButtons = ({
2694
3184
  "data-testid": "productform-dialog-draft",
2695
3185
  disabled: _areActionsDisabled
2696
3186
  }, {
2697
- children: "Save"
3187
+ children: translateKeyOutsideComponents('save')
2698
3188
  })), hasCancelButton && jsx(Button, Object.assign({
2699
3189
  variant: "tertiary",
2700
3190
  onClick: onCancel,
2701
3191
  sx: buttonStyle,
2702
3192
  "data-testid": "productform-dialog-cancel"
2703
3193
  }, {
2704
- children: "Cancel"
3194
+ children: translateKeyOutsideComponents('cancel')
2705
3195
  })), hasPublishButton && jsx(Button, Object.assign({
2706
3196
  variant: "primary",
2707
3197
  onClick: onPublish,
@@ -2709,7 +3199,7 @@ const getProductFormLifecycleButtons = ({
2709
3199
  "data-testid": "productform-dialog-publish",
2710
3200
  disabled: _areActionsDisabled
2711
3201
  }, {
2712
- children: "Publish"
3202
+ children: translateKeyOutsideComponents('publish')
2713
3203
  }))]
2714
3204
  })), jsx(Box, Object.assign({
2715
3205
  display: {
@@ -2779,46 +3269,54 @@ const createAirmetPostParameter = (airmetToPost, newStatus, previousUuid) => {
2779
3269
  const getConfirmationDialogTitle = (action, productType) => {
2780
3270
  const product = productType.toUpperCase();
2781
3271
  if (action === 'CLOSED') {
2782
- return `Close ${product}`;
3272
+ return `${translateKeyOutsideComponents('close')} ${product}`;
2783
3273
  }
2784
3274
  if (action === 'DISCARDED') {
2785
- return `Discard ${product}`;
3275
+ return `${translateKeyOutsideComponents('discard-non-capitalized')} ${product}`;
2786
3276
  }
2787
3277
  if (action === 'PUBLISHED') {
2788
- return 'Publish';
3278
+ return translateKeyOutsideComponents('publish');
2789
3279
  }
2790
- return `Cancel ${product}`;
3280
+ return `${translateKeyOutsideComponents('cancel')} ${product}`;
2791
3281
  };
2792
3282
  const getConfirmationDialogContent = (action, productType) => {
2793
3283
  const product = productType.toUpperCase();
2794
3284
  if (action === 'DISCARDED') {
2795
- return `Are you sure you would like to discard this ${product}? Its properties will be lost`;
3285
+ return translateKeyOutsideComponents('are-you-sure-you-want-to-discard', {
3286
+ product
3287
+ });
2796
3288
  }
2797
3289
  if (action === 'CLOSED') {
2798
- return 'Do you want to save any changes made?';
3290
+ return translateKeyOutsideComponents('save-changes-made');
2799
3291
  }
2800
3292
  if (action === 'PUBLISHED') {
2801
- return `Are you sure you want to publish this ${product}?`;
3293
+ return translateKeyOutsideComponents('publish-this-product', {
3294
+ product
3295
+ });
2802
3296
  }
2803
- return `Are you sure you want to cancel this ${product}?`;
3297
+ return translateKeyOutsideComponents('cancel-this-product', {
3298
+ product
3299
+ });
2804
3300
  };
2805
3301
  const getConfirmationDialogButtonLabel = (action, productType) => {
2806
3302
  const product = productType.toUpperCase();
2807
3303
  switch (action) {
2808
3304
  case 'DISCARDED':
2809
- return `Discard ${product}`;
3305
+ return `${translateKeyOutsideComponents('discard-product', {
3306
+ product
3307
+ })}`;
2810
3308
  case 'PUBLISHED':
2811
- return 'Publish';
3309
+ return translateKeyOutsideComponents('publish');
2812
3310
  case 'CANCELLED':
2813
- return 'Cancel';
3311
+ return translateKeyOutsideComponents('cancel');
2814
3312
  default:
2815
- return 'Save and close';
3313
+ return translateKeyOutsideComponents('save-and-close');
2816
3314
  }
2817
3315
  };
2818
3316
  const getConfirmationDialogCancelLabel = action => {
2819
3317
  switch (action) {
2820
3318
  case 'CLOSED':
2821
- return 'Discard and close';
3319
+ return translateKeyOutsideComponents('discard-and-close');
2822
3320
  default:
2823
3321
  return undefined;
2824
3322
  }
@@ -2830,7 +3328,7 @@ const getProductIssueDate = (initialProduct, initialCancelProduct) => {
2830
3328
  if (initialCancelProduct !== null && initialCancelProduct.issueDate) {
2831
3329
  return `${dateUtils.dateToString(dateUtils.utc(initialCancelProduct.issueDate), dateUtils.DATE_FORMAT_DATEPICKER)} UTC`;
2832
3330
  }
2833
- return '(Not published)';
3331
+ return translateKeyOutsideComponents('not-published');
2834
3332
  };
2835
3333
  // Provide a cross section of the units from the config and the units as allowed by the type definition
2836
3334
  // Units from the config which are not in the type definition should be ignored
@@ -2867,7 +3365,7 @@ const getFir = (productConfig, firName) => {
2867
3365
  const isFir = geojson => {
2868
3366
  return geojson && geojson.features && geojson.features.length > 0 && geojson.features[0].properties['selectionType'] === 'fir';
2869
3367
  };
2870
- const getFieldLabel = (title, isDisabled, action = 'Select') => isDisabled ? title : `${action} ${title.toLowerCase()}`;
3368
+ const getFieldLabel = (title, isDisabled, action = translateKeyOutsideComponents('select')) => isDisabled ? title : `${action} ${title.toLowerCase()}`;
2871
3369
  const getBaseLayers = productConfig => {
2872
3370
  var _a, _b;
2873
3371
  return ((_b = (_a = productConfig.mapPreset) === null || _a === void 0 ? void 0 : _a.layers) === null || _b === void 0 ? void 0 : _b.filter(layer => layer.layerType === LayerType.baseLayer || layer.layerType === LayerType.overLayer)) || [];
@@ -2904,24 +3402,32 @@ const firSelectionType = 'fir';
2904
3402
  const getDrawTools = (type, firShape) => {
2905
3403
  const defaultStyleProperties = type === StartOrEndDrawing.start ? featurePropsStart : featurePropsEnd;
2906
3404
  return [Object.assign(Object.assign({}, defaultPoint), {
2907
- title: `Drop a point as ${type} position`,
3405
+ title: translateKeyOutsideComponents('drop-a-point-as', {
3406
+ type
3407
+ }),
2908
3408
  shape: addGeoJSONProperties(defaultPoint.shape, defaultStyleProperties)
2909
3409
  }), Object.assign(Object.assign({}, defaultBox), {
2910
- title: `Draw a box as ${type} position`,
3410
+ title: translateKeyOutsideComponents('draw-a-box-as', {
3411
+ type
3412
+ }),
2911
3413
  shape: addGeoJSONProperties(defaultBox.shape, defaultStyleProperties)
2912
3414
  }), Object.assign(Object.assign({}, defaultPolygon), {
2913
- title: `Draw a shape as ${type} position`,
3415
+ title: translateKeyOutsideComponents('draw-a-shape-as', {
3416
+ type
3417
+ }),
2914
3418
  shape: addGeoJSONProperties(defaultPolygon.shape, defaultStyleProperties)
2915
3419
  }), {
2916
3420
  drawModeId: 'drawtools-fir',
2917
- title: `Set FIR as ${type} position`,
3421
+ title: translateKeyOutsideComponents('set-a-fir-as', {
3422
+ type
3423
+ }),
2918
3424
  isSelectable: false,
2919
3425
  value: DRAWMODE.POLYGON,
2920
3426
  // add selectionType here to use later for `onUpdateStartgeoJSON` in Sigmet/Airmet-Form when updating form values directly
2921
3427
  shape: addSelectionTypeToGeoJSON(addGeoJSONProperties(firShape, Object.assign({}, defaultStyleProperties)), firSelectionType),
2922
3428
  selectionType: firSelectionType
2923
3429
  }, Object.assign(Object.assign({}, defaultDelete), {
2924
- title: 'Remove geometry'
3430
+ title: translateKeyOutsideComponents('remove-geometry')
2925
3431
  })];
2926
3432
  };
2927
3433
  const updateDrawToolsWithFir = (drawTools, newFirShape) => {
@@ -3064,10 +3570,16 @@ $$9({ global: true, forced: parseInt !== $parseInt }, {
3064
3570
  const DEFAULT_ROUNDING_LEVELS_FL = 5;
3065
3571
  const DEFAULT_ROUNDING_LEVELS_FT = 500;
3066
3572
  const DEFAULT_ROUNDING_LEVELS_M = 1;
3067
- const getLevelInvalidStepsForFLUnitMessage = (value = DEFAULT_ROUNDING_LEVELS_FL) => `Levels must be rounded to the nearest ${value}`;
3068
- const getLevelInvalidStepsForFTUnitMessage = (value = DEFAULT_ROUNDING_LEVELS_FT) => `Levels must be rounded to the nearest ${value}ft`;
3069
- const getLevelInvalidStepsForMUnitMessage = (value = DEFAULT_ROUNDING_LEVELS_M) => `Levels must be rounded to the nearest ${value}m`;
3070
- const invalidUnitMessage$1 = 'Level unit not defined';
3573
+ const getLevelInvalidStepsForFLUnitMessage = (value = DEFAULT_ROUNDING_LEVELS_FL) => translateKeyOutsideComponents('levels-get-level-invalid-steps-for-fl-unit-message', {
3574
+ value
3575
+ });
3576
+ const getLevelInvalidStepsForFTUnitMessage = (value = DEFAULT_ROUNDING_LEVELS_FT) => translateKeyOutsideComponents('levels-get-level-invalid-steps-for-ft-unit-message', {
3577
+ value
3578
+ });
3579
+ const getLevelInvalidStepsForMUnitMessage = (value = DEFAULT_ROUNDING_LEVELS_M) => translateKeyOutsideComponents('levels-get-level-invalid-steps-for-m-unit-message', {
3580
+ value
3581
+ });
3582
+ const invalidUnitMessage$1 = translateKeyOutsideComponents('levels-invalid-unit-message');
3071
3583
  const validateLevels = (value, unit, productConfig, selectedFIR) => {
3072
3584
  if (isEmpty(value)) {
3073
3585
  return true;
@@ -3092,7 +3604,7 @@ const validateLevels = (value, unit, productConfig, selectedFIR) => {
3092
3604
  }
3093
3605
  return invalidUnitMessage$1;
3094
3606
  };
3095
- const invalidLevelUnitCombinationMessage = 'Invalid unit combination';
3607
+ const invalidLevelUnitCombinationMessage = translateKeyOutsideComponents('levels-invalid-level-unit-combination-message');
3096
3608
  const validateLevelUnitCombinations = (levelUnit, lowerLevelUnit) => {
3097
3609
  // If different units and lower level not SFC, only FL is allowed as upper level
3098
3610
  if (lowerLevelUnit !== 'SFC' && levelUnit !== lowerLevelUnit && LevelUnits[levelUnit] !== LevelUnits.FL) {
@@ -3106,6 +3618,9 @@ const Levels = ({
3106
3618
  onChange: _onChange = () => {},
3107
3619
  productConfig
3108
3620
  }) => {
3621
+ const {
3622
+ t
3623
+ } = useSigmetAirmetTranslation();
3109
3624
  const {
3110
3625
  watch,
3111
3626
  setValue,
@@ -3140,7 +3655,7 @@ const Levels = ({
3140
3655
  }
3141
3656
  }, [getValues, isRadioactiveCloud, levelInfoMode, radioactiveCloudLevel, setValue, trigger, unregister]);
3142
3657
  return jsx(ProductFormFieldLayout, Object.assign({
3143
- title: "Levels",
3658
+ title: t('levels'),
3144
3659
  sx: styles$2.containerItem
3145
3660
  }, {
3146
3661
  children: jsx(Grid, Object.assign({
@@ -3166,7 +3681,7 @@ const Levels = ({
3166
3681
  }, {
3167
3682
  children: [jsx(RadioButtonAndLabel, {
3168
3683
  value: "AT",
3169
- label: "At",
3684
+ label: t('at'),
3170
3685
  checked: levelInfoMode === 'AT' || levelInfoMode === 'TOPS',
3171
3686
  "data-testid": "levels-AT",
3172
3687
  disabled: fieldsDisabled
@@ -3195,7 +3710,7 @@ const Levels = ({
3195
3710
  disabled: isDisabled
3196
3711
  }),
3197
3712
  "data-testid": "levels-TOPS",
3198
- label: "Tops"
3713
+ label: t('levels-tops-label')
3199
3714
  })
3200
3715
  })), jsx(Grid, Object.assign({
3201
3716
  item: true,
@@ -3204,7 +3719,7 @@ const Levels = ({
3204
3719
  }, {
3205
3720
  children: jsx(ReactHookFormSelect, Object.assign({
3206
3721
  name: "level.unit",
3207
- label: "Unit",
3722
+ label: t('unit-label'),
3208
3723
  rules: {
3209
3724
  validate: {
3210
3725
  isRequired
@@ -3234,17 +3749,23 @@ const Levels = ({
3234
3749
  children: jsx(ReactHookFormNumberField, {
3235
3750
  name: "level.value",
3236
3751
  "data-testid": "level.value",
3237
- label: "Level",
3752
+ label: t('level'),
3238
3753
  rules: {
3239
3754
  validate: {
3240
3755
  isRequired,
3241
3756
  isInteger,
3242
3757
  max: value =>
3243
3758
  // The max level depends on the unit
3244
- isValidMax(value, getMaxLevelValue(getValues('level.unit'), getFIRValue(), productConfig)) || `The maximum level in ${LevelUnits[getValues('level.unit')]} is ${getMaxLevelValue(getValues('level.unit'), getFIRValue(), productConfig)}`,
3759
+ isValidMax(value, getMaxLevelValue(getValues('level.unit'), getFIRValue(), productConfig)) || t('levels-the-maximum-level', {
3760
+ levelUnit: LevelUnits[getValues('level.unit')],
3761
+ maxLevelValue: getMaxLevelValue(getValues('level.unit'), getFIRValue(), productConfig)
3762
+ }),
3245
3763
  min: value =>
3246
3764
  // The min level depends on the unit
3247
- isValidMin(value, getMinLevelValue(getValues('level.unit'), getFIRValue(), productConfig)) || `The minimum level in ${LevelUnits[getValues('level.unit')]} is ${getMinLevelValue(getValues('level.unit'), getFIRValue(), productConfig)}`,
3765
+ isValidMin(value, getMinLevelValue(getValues('level.unit'), getFIRValue(), productConfig)) || t('levels-the-minimum-level', {
3766
+ levelUnit: LevelUnits[getValues('level.unit')],
3767
+ minLevelValue: getMinLevelValue(getValues('level.unit'), getFIRValue(), productConfig)
3768
+ }),
3248
3769
  validateLevels: value =>
3249
3770
  // level step depends on the unit
3250
3771
  validateLevels(value, getValues('level.unit'), productConfig, getFIRValue())
@@ -3258,7 +3779,7 @@ const Levels = ({
3258
3779
  }))]
3259
3780
  })) : null, jsx(RadioButtonAndLabel, {
3260
3781
  value: "BETW",
3261
- label: "Between",
3782
+ label: t('between'),
3262
3783
  checked: levelInfoMode === 'BETW' || levelInfoMode === 'BETW_SFC',
3263
3784
  "data-testid": "levels-BETW",
3264
3785
  disabled: fieldsDisabled
@@ -3280,7 +3801,7 @@ const Levels = ({
3280
3801
  }, {
3281
3802
  children: jsx(ReactHookFormSelect, Object.assign({
3282
3803
  name: "level.unit",
3283
- label: "Unit",
3804
+ label: t('unit-label'),
3284
3805
  rules: {
3285
3806
  validate: {
3286
3807
  isRequired,
@@ -3313,7 +3834,7 @@ const Levels = ({
3313
3834
  children: jsx(ReactHookFormNumberField, {
3314
3835
  value: level || '',
3315
3836
  name: "level.value",
3316
- label: "Upper level",
3837
+ label: t('levels-upper-level-label'),
3317
3838
  sx: styles$2.levelField,
3318
3839
  size: "small",
3319
3840
  rules: {
@@ -3322,10 +3843,16 @@ const Levels = ({
3322
3843
  isInteger,
3323
3844
  max: value =>
3324
3845
  // The max level depends on the unit
3325
- isValidMax(value, getMaxLevelValue(getValues('level.unit'), getFIRValue(), productConfig)) || `The maximum level in ${LevelUnits[getValues('level.unit')]} is ${getMaxLevelValue(getValues('level.unit'), getFIRValue(), productConfig)}`,
3846
+ isValidMax(value, getMaxLevelValue(getValues('level.unit'), getFIRValue(), productConfig)) || t('levels-the-maximum-level', {
3847
+ levelUnit: LevelUnits[getValues('level.unit')],
3848
+ maxLevelValue: getMaxLevelValue(getValues('level.unit'), getFIRValue(), productConfig)
3849
+ }),
3326
3850
  min: value =>
3327
3851
  // The min level depends on the unit
3328
- isValidMin(value, getMinLevelValue(getValues('level.unit'), getFIRValue(), productConfig)) || `The minimum level in ${LevelUnits[getValues('level.unit')]} is ${getMinLevelValue(getValues('level.unit'), getFIRValue(), productConfig)}`,
3852
+ isValidMin(value, getMinLevelValue(getValues('level.unit'), getFIRValue(), productConfig)) || t('levels-the-minimum-level', {
3853
+ levelUnit: LevelUnits[getValues('level.unit')],
3854
+ minLevelValue: getMinLevelValue(getValues('level.unit'), getFIRValue(), productConfig)
3855
+ }),
3329
3856
  validateLevels: value =>
3330
3857
  // level step depends on the unit
3331
3858
  validateLevels(value, getValues('level.unit'), productConfig, getFIRValue())
@@ -3376,7 +3903,7 @@ const Levels = ({
3376
3903
  }, {
3377
3904
  children: jsx(ReactHookFormSelect, Object.assign({
3378
3905
  name: "lowerLevel.unit",
3379
- label: "Unit",
3906
+ label: t('unit-label'),
3380
3907
  rules: {
3381
3908
  validate: {
3382
3909
  isRequired,
@@ -3408,17 +3935,23 @@ const Levels = ({
3408
3935
  }, {
3409
3936
  children: jsx(ReactHookFormNumberField, {
3410
3937
  name: "lowerLevel.value",
3411
- label: "Lower level",
3938
+ label: t('levels-lower-level-label'),
3412
3939
  rules: {
3413
3940
  validate: {
3414
3941
  isRequired,
3415
3942
  isInteger,
3416
3943
  max: value =>
3417
3944
  // The max level depends on the unit
3418
- isValidMax(value, getMaxLevelValue(getValues('lowerLevel.unit'), getFIRValue(), productConfig)) || `The maximum level in ${LevelUnits[getValues('lowerLevel.unit')]} is ${getMaxLevelValue(getValues('lowerLevel.unit'), getFIRValue(), productConfig)}`,
3945
+ isValidMax(value, getMaxLevelValue(getValues('lowerLevel.unit'), getFIRValue(), productConfig)) || t('levels-the-maximum-level', {
3946
+ levelUnit: LevelUnits[getValues('lowerLevel.unit')],
3947
+ maxLevelValue: getMaxLevelValue(getValues('lowerLevel.unit'), getFIRValue(), productConfig)
3948
+ }),
3419
3949
  min: value =>
3420
3950
  // The min level depends on the unit
3421
- isValidMin(value, getMinLevelValue(getValues('lowerLevel.unit'), getFIRValue(), productConfig)) || `The minimum level in ${LevelUnits[getValues('lowerLevel.unit')]} is ${getMinLevelValue(getValues('lowerLevel.unit'), getFIRValue(), productConfig)}`,
3951
+ isValidMin(value, getMinLevelValue(getValues('lowerLevel.unit'), getFIRValue(), productConfig)) || t('levels-the-minimum-level', {
3952
+ levelUnit: LevelUnits[getValues('lowerLevel.unit')],
3953
+ minLevelValue: getMinLevelValue(getValues('lowerLevel.unit'), getFIRValue(), productConfig)
3954
+ }),
3422
3955
  isLevelLower: value =>
3423
3956
  // The lower level needs to be smaller than upper level
3424
3957
  isLevelLower(value, getValues('lowerLevel.unit'), getValues('level.value'), getValues('level.unit')),
@@ -3436,7 +3969,7 @@ const Levels = ({
3436
3969
  }))]
3437
3970
  }) : null, jsx(RadioButtonAndLabel, {
3438
3971
  value: "ABV",
3439
- label: "Above",
3972
+ label: t('above'),
3440
3973
  disabled: fieldsDisabled,
3441
3974
  checked: levelInfoMode === 'ABV' || levelInfoMode === 'TOPS_ABV',
3442
3975
  "data-testid": "levels-ABV"
@@ -3463,7 +3996,7 @@ const Levels = ({
3463
3996
  },
3464
3997
  disabled: isDisabled
3465
3998
  }),
3466
- label: "Tops",
3999
+ label: t('levels-tops-label'),
3467
4000
  "data-testid": "levels-TOPS_ABV"
3468
4001
  })
3469
4002
  })), jsx(Grid, Object.assign({
@@ -3473,7 +4006,7 @@ const Levels = ({
3473
4006
  }, {
3474
4007
  children: jsx(ReactHookFormSelect, Object.assign({
3475
4008
  name: "level.unit",
3476
- label: "Unit",
4009
+ label: t('unit-label'),
3477
4010
  rules: {
3478
4011
  validate: {
3479
4012
  isRequired
@@ -3502,17 +4035,23 @@ const Levels = ({
3502
4035
  }, {
3503
4036
  children: jsx(ReactHookFormNumberField, {
3504
4037
  name: "level.value",
3505
- label: "Level",
4038
+ label: t('level'),
3506
4039
  rules: {
3507
4040
  validate: {
3508
4041
  isRequired,
3509
4042
  isInteger,
3510
4043
  max: value =>
3511
4044
  // The max level depends on the unit
3512
- isValidMax(value, getMaxLevelValue(getValues('level.unit'), getFIRValue(), productConfig)) || `The maximum level in ${LevelUnits[getValues('level.unit')]} is ${getMaxLevelValue(getValues('level.unit'), getFIRValue(), productConfig)}`,
4045
+ isValidMax(value, getMaxLevelValue(getValues('level.unit'), getFIRValue(), productConfig)) || t('levels-the-maximum-level', {
4046
+ levelUnit: LevelUnits[getValues('level.unit')],
4047
+ maxLevelValue: getMaxLevelValue(getValues('level.unit'), getFIRValue(), productConfig)
4048
+ }),
3513
4049
  min: value =>
3514
4050
  // The min level depends on the unit
3515
- isValidMin(value, getMinLevelValue(getValues('level.unit'), getFIRValue(), productConfig)) || `The minimum level in ${LevelUnits[getValues('level.unit')]} is ${getMinLevelValue(getValues('level.unit'), getFIRValue(), productConfig)}`,
4051
+ isValidMin(value, getMinLevelValue(getValues('level.unit'), getFIRValue(), productConfig)) || t('levels-the-minimum-level', {
4052
+ levelUnit: LevelUnits[getValues('level.unit')],
4053
+ minLevelValue: getMinLevelValue(getValues('level.unit'), getFIRValue(), productConfig)
4054
+ }),
3516
4055
  validateLevels: value =>
3517
4056
  // level step depends on the unit
3518
4057
  validateLevels(value, getValues('level.unit'), productConfig, getFIRValue())
@@ -3534,6 +4073,9 @@ const ObservationForecast = ({
3534
4073
  isDisabled,
3535
4074
  isReadOnly
3536
4075
  }) => {
4076
+ const {
4077
+ t
4078
+ } = useSigmetAirmetTranslation();
3537
4079
  const {
3538
4080
  watch,
3539
4081
  trigger,
@@ -3571,12 +4113,12 @@ const ObservationForecast = ({
3571
4113
  }, {
3572
4114
  children: [(!isReadOnly || watch('isObservationOrForecast') === 'OBS') && jsx(RadioButtonAndLabel, {
3573
4115
  value: "OBS",
3574
- label: "Observed",
4116
+ label: t('observation-label'),
3575
4117
  disabled: fieldsDisabled,
3576
4118
  "data-testid": "isObservationOrForecast-OBS"
3577
4119
  }), (!isReadOnly || watch('isObservationOrForecast') === 'FCST') && jsx(RadioButtonAndLabel, {
3578
4120
  value: "FCST",
3579
- label: "Forecast",
4121
+ label: t('forecast-label'),
3580
4122
  disabled: fieldsDisabled,
3581
4123
  "data-testid": "isObservationOrForecast-FCST"
3582
4124
  })]
@@ -3597,16 +4139,19 @@ const ObservationForecastTime = ({
3597
4139
  helperText,
3598
4140
  onChange: _onChange = () => {}
3599
4141
  }) => {
4142
+ const {
4143
+ t
4144
+ } = useSigmetAirmetTranslation();
3600
4145
  const {
3601
4146
  watch
3602
4147
  } = useFormContext();
3603
- const label = getFieldLabel('Date and time', isReadOnly);
4148
+ const label = getFieldLabel(t('date-and-time'), isReadOnly);
3604
4149
  const {
3605
4150
  isShortTest
3606
4151
  } = useShortTestHelpers();
3607
4152
  const fieldsDisabled = isDisabled || isShortTest();
3608
4153
  return !isReadOnly || watch('observationOrForecastTime') !== null ? jsx(ProductFormFieldLayout, Object.assign({
3609
- title: "At"
4154
+ title: t('at')
3610
4155
  }, {
3611
4156
  children: jsx(ReactHookFormDateTime, {
3612
4157
  disablePast: watch('isObservationOrForecast') === 'FCST',
@@ -3616,7 +4161,7 @@ const ObservationForecastTime = ({
3616
4161
  rules: {
3617
4162
  validate: {
3618
4163
  isValidDate: dateUtils.isValidIsoDateString,
3619
- isBefore: val => watch('isObservationOrForecast') === 'OBS' && val ? dateUtils.isBefore(val, dateUtils.getNowUtc()) || 'Observation time cannot be in the future' : true,
4164
+ isBefore: val => watch('isObservationOrForecast') === 'OBS' && val ? dateUtils.isBefore(val, dateUtils.getNowUtc()) || t('observation-forecast-error') : true,
3620
4165
  isBetween: val => watch('isObservationOrForecast') === 'FCST' && val ? dateUtils.isBetween(dateUtils.isoStringToDate(val), dateUtils.isoStringToDate(goZeroSeconds(watch('validDateStart'))), dateUtils.isoStringToDate(goZeroSeconds(watch('validDateEnd'))), '[]') || ForecastTimeValidation : true
3621
4166
  }
3622
4167
  },
@@ -3636,6 +4181,9 @@ const Phenomenon = ({
3636
4181
  isReadOnly,
3637
4182
  onChange: _onChange = () => {}
3638
4183
  }) => {
4184
+ const {
4185
+ t
4186
+ } = useSigmetAirmetTranslation();
3639
4187
  const {
3640
4188
  getValues,
3641
4189
  setValue,
@@ -3646,10 +4194,10 @@ const Phenomenon = ({
3646
4194
  } = useShortTestHelpers();
3647
4195
  const isSigmet = productType === 'sigmet';
3648
4196
  const phenomenaList = isSigmet ? SigmetPhenomena : AirmetPhenomena;
3649
- const label = getFieldLabel('Phenomenon', isReadOnly);
4197
+ const label = getFieldLabel(t('phenomenon'), isReadOnly);
3650
4198
  const fieldsDisabled = isDisabled || isShortTest();
3651
4199
  return jsx(ProductFormFieldLayout, Object.assign({
3652
- title: "What"
4200
+ title: t('phenomenon-title')
3653
4201
  }, {
3654
4202
  children: jsx(ReactHookFormSelect, Object.assign({
3655
4203
  name: "phenomenon",
@@ -3684,115 +4232,14 @@ const Phenomenon = ({
3684
4232
  }));
3685
4233
  };
3686
4234
 
3687
- const coordinatesEmptyMessage$1 = 'A start position drawing is required';
3688
- const noIntersectionMessage$1 = 'The start position needs to be (partly) inside the FIR';
3689
- const exitDrawModeMessage = 'Press ESC to exit draw mode';
3690
- const maxFeaturePointsMessage = 'Intersection of the drawn polygon with the FIR-boundary has more than 6 individual points. Check if the TAC in the preview corresponds to the intended area.';
3691
- const multiIntersectionsMessage = 'The drawn polygon has multiple intersections with the FIR-boundary. The drawn polygon will be used for the TAC-code.';
3692
- const StartGeometry = ({
3693
- isReadOnly: _isReadOnly = false,
3694
- activeTool,
3695
- tools,
3696
- onChangeTool,
3697
- geoJSON,
3698
- geoJSONIntersection,
3699
- productConfig
3700
- }) => {
3701
- var _a, _b;
3702
- const {
3703
- formState: {
3704
- errors
3705
- },
3706
- watch,
3707
- getValues
3708
- } = useFormContext();
3709
- const {
3710
- isDraft
3711
- } = useDraftFormHelpers();
3712
- const {
3713
- isShortTest
3714
- } = useShortTestHelpers();
3715
- const getFIRValue = () => getValues('locationIndicatorATSR');
3716
- // Max points the FIR allows for a polygon
3717
- const maxPoints = getMaxPolygonPoints(getFIRValue(), productConfig);
3718
- // Intersections with FIR
3719
- const intersectionPointCount = countIntersectionPoints(geoJSON, geoJSONIntersection);
3720
- const drawnGeometry = (_a = geoJSON === null || geoJSON === void 0 ? void 0 : geoJSON.features[0]) === null || _a === void 0 ? void 0 : _a.geometry;
3721
- const interceptionGeometry = (_b = geoJSONIntersection === null || geoJSONIntersection === void 0 ? void 0 : geoJSONIntersection.features[0]) === null || _b === void 0 ? void 0 : _b.geometry;
3722
- // Total points in the user drawn polygon
3723
- const totalDrawnPoints = drawnGeometry && drawnGeometry.coordinates[0] ? drawnGeometry.coordinates[0].length : 0;
3724
- // Total points in the intersection polygon
3725
- const intersectingPolygonPointsTotal = interceptionGeometry && interceptionGeometry.coordinates[0] ? interceptionGeometry.coordinates[0].length : 0;
3726
- const maximumPointsMessage = `The start position drawing allows a maximum of ${maxPoints - 1} individual points`;
3727
- const moreThan6PointsMessage = `The start/end position drawing has exceeded 6 individual points. The TAC has a total of ${totalDrawnPoints} points. If possible, reduce the number of points.`;
3728
- const intersectionAbove6PointsMessage = `The start/end position of the intersected polygon has
3729
- ${intersectingPolygonPointsTotal} points,
3730
- and the intersection of the drawn polygon with the FIR-boundary has exceeded 6 individual points.
3731
- Check if the TAC in the preview corresponds to the intended area.`;
3732
- const showMaxFeaturePointsWarning = intersectionPointCount > 7 && hasMaxFeaturePoints(geoJSONIntersection, maxPoints) && !activeTool && !errors.startGeometry && !isFir(geoJSON);
3733
- const showMoreThan6PointsWarning = totalDrawnPoints > 7 && intersectionPointCount < 1 && !activeTool && !errors.startGeometry && !isFir(geoJSON);
3734
- const showIntersectionAbove6PointsWarning = intersectingPolygonPointsTotal > 7 && intersectionPointCount > 6 && maxPoints > 7 && !activeTool && !errors.startGeometry && !isFir(geoJSON);
3735
- return !_isReadOnly ? jsxs(ProductFormFieldLayout, Object.assign({
3736
- title: "Start position",
3737
- sx: styles$2.drawSection,
3738
- "data-testid": "startGeometry"
3739
- }, {
3740
- children: [jsx(DrawTools, {
3741
- activeTool: activeTool,
3742
- tools: tools,
3743
- onChangeTool: onChangeTool,
3744
- isDisabled: isShortTest()
3745
- }), activeTool && jsx(FormHelperText, Object.assign({
3746
- variant: "filled",
3747
- sx: styles$2.quitDrawModeMessage
3748
- }, {
3749
- children: exitDrawModeMessage
3750
- })), !!errors.startGeometry && jsx(FormHelperText, Object.assign({
3751
- error: true,
3752
- variant: "filled"
3753
- }, {
3754
- children: errors.startGeometry.message
3755
- })), /* non-blocking warnings */
3756
- showMaxFeaturePointsWarning && jsx(FormHelperText, Object.assign({
3757
- variant: "filled"
3758
- }, {
3759
- children: maxFeaturePointsMessage
3760
- })), /* non-blocking warnings */
3761
- showMoreThan6PointsWarning && jsx(FormHelperText, Object.assign({
3762
- variant: "filled"
3763
- }, {
3764
- children: moreThan6PointsMessage
3765
- })), /* non-blocking warnings */
3766
- showIntersectionAbove6PointsWarning && jsx(FormHelperText, Object.assign({
3767
- variant: "filled"
3768
- }, {
3769
- children: intersectionAbove6PointsMessage
3770
- })), hasMulitpleIntersections(geoJSONIntersection) && !activeTool && !errors.startGeometry && !isFir(geoJSON) && jsx(FormHelperText, Object.assign({
3771
- variant: "filled"
3772
- }, {
3773
- children: multiIntersectionsMessage
3774
- })), jsx(ReactHookFormHiddenInput, {
3775
- name: "startGeometry",
3776
- rules: {
3777
- validate: {
3778
- maximumOneDrawing: value => isMaximumOneDrawing(value) || 'Only one start position drawing is allowed',
3779
- intersectWithFIR: value => hasIntersectionWithFIR(value, watch('startGeometryIntersect')) || noIntersectionMessage$1,
3780
- coordinatesNotEmpty: value => isDraft() || isShortTest() ? true : isValidGeoJsonCoordinates(value) || coordinatesEmptyMessage$1,
3781
- hasMaxFeaturePoints: value => isFir(value) ? true : !hasMaxFeaturePoints(value, maxPoints) || maximumPointsMessage
3782
- }
3783
- }
3784
- }), jsx(ReactHookFormHiddenInput, {
3785
- name: "startGeometryIntersect"
3786
- })]
3787
- })) : null;
3788
- };
3789
-
3790
4235
  const DEFAULT_ROUNDING_MOVEMENT_KT = 5;
3791
4236
  const DEFAULT_ROUNDING_MOVEMENT_KMH = 10;
3792
- const getMovementStepValKTMessage = (value = DEFAULT_ROUNDING_MOVEMENT_KT) => `Speed should be rounded to the nearest ${value}kt`;
3793
- const getMovementStepValKMHMessage = (value = DEFAULT_ROUNDING_MOVEMENT_KMH) => `Speed should be rounded to the nearest ${value}kmh`;
3794
- const coordinatesEmptyMessage = 'An end position drawing is required when selecting End position';
3795
- const noIntersectionMessage = 'The end position needs to be (partly) inside the FIR';
4237
+ const getMovementStepValKTMessage = (value = DEFAULT_ROUNDING_MOVEMENT_KT) => translateKeyOutsideComponents('progress-get-movement-step-valktmessage', {
4238
+ value
4239
+ });
4240
+ const getMovementStepValKMHMessage = (value = DEFAULT_ROUNDING_MOVEMENT_KMH) => translateKeyOutsideComponents('progress-get-movement-step-valkmhmessage', {
4241
+ value
4242
+ });
3796
4243
  const validateMovementSteps = (value, unit, productConfig, selectedFIR) => {
3797
4244
  if (isEmpty(value)) {
3798
4245
  return true;
@@ -3811,7 +4258,7 @@ const validateMovementSteps = (value, unit, productConfig, selectedFIR) => {
3811
4258
  if (MovementUnit[unit] === MovementUnit.KMH) {
3812
4259
  return intLevel % movement_rounding_kmh === 0 || getMovementStepValKMHMessage(movement_rounding_kmh);
3813
4260
  }
3814
- return 'Invalid unit';
4261
+ return translateKeyOutsideComponents('invalid-unit');
3815
4262
  };
3816
4263
  const Progress = ({
3817
4264
  productType,
@@ -3826,6 +4273,9 @@ const Progress = ({
3826
4273
  geoJSONIntersection
3827
4274
  }) => {
3828
4275
  var _a, _b;
4276
+ const {
4277
+ t
4278
+ } = useSigmetAirmetTranslation();
3829
4279
  const {
3830
4280
  watch,
3831
4281
  getValues,
@@ -3873,17 +4323,11 @@ const Progress = ({
3873
4323
  const totalDrawnPoints = drawnGeometry && drawnGeometry.coordinates[0] ? drawnGeometry.coordinates[0].length : 0;
3874
4324
  // Total points in the intersection polygon
3875
4325
  const intersectingPolygonPointsTotal = interceptionGeometry && interceptionGeometry.coordinates[0] ? interceptionGeometry.coordinates[0].length : 0;
3876
- const maximumPointsMessage = `The end position drawing allows a maximum of ${maxPoints - 1} individual points`;
3877
- const moreThan6PointsMessage = `The start/end position drawing has exceeded 6 individual points. The TAC has a total of ${totalDrawnPoints} points. If possible, reduce the number of points.`;
3878
- const intersectionAbove6PointsMessage = `The start/end position of the intersected polygon has
3879
- ${intersectingPolygonPointsTotal} points,
3880
- and the intersection of the drawn polygon with the FIR-boundary has exceeded 6 individual points.
3881
- Check if the TAC in the preview corresponds to the intended area.`;
3882
4326
  const showMaxFeaturePointsWarning = intersectionPointCount > 7 && hasMaxFeaturePoints(geoJSONIntersection, maxPoints) && !activeTool && !errors.startGeometry && !isFir(geoJSON);
3883
4327
  const showMoreThan6PointsWarning = totalDrawnPoints > 7 && intersectionPointCount < 1 && !activeTool && !errors.startGeometry && !isFir(geoJSON);
3884
4328
  const showIntersectionAbove6PointsWarning = intersectingPolygonPointsTotal > 7 && intersectionPointCount > 6 && maxPoints > 7 && !activeTool && !errors.startGeometry && !isFir(geoJSON);
3885
4329
  return jsx(ProductFormFieldLayout, Object.assign({
3886
- title: "Progress",
4330
+ title: t('progress'),
3887
4331
  sx: styles$2.containerItem
3888
4332
  }, {
3889
4333
  children: jsxs(Grid, Object.assign({
@@ -3908,23 +4352,23 @@ const Progress = ({
3908
4352
  }, {
3909
4353
  children: [isVolcanicCloud && jsx(RadioButtonAndLabel, {
3910
4354
  value: "NO_VA_EXP",
3911
- label: "No volcanic ash expected",
4355
+ label: t('progress-radio-button-label-no-va-exp'),
3912
4356
  disabled: fieldsDisabled,
3913
4357
  "data-testid": "movementType-NO_VA_EXP"
3914
4358
  }), jsxs(Fragment, {
3915
4359
  children: [jsx(RadioButtonAndLabel, {
3916
4360
  value: "STATIONARY",
3917
- label: "Stationary",
4361
+ label: t('progress-radio-button-label-stationary'),
3918
4362
  disabled: fieldsDisabled,
3919
4363
  "data-testid": "movementType-STATIONARY"
3920
4364
  }), jsx(RadioButtonAndLabel, {
3921
4365
  value: "MOVEMENT",
3922
- label: "Movement",
4366
+ label: t('progress-radio-button-label-movement'),
3923
4367
  disabled: fieldsDisabled,
3924
4368
  "data-testid": "movementType-MOVEMENT"
3925
4369
  }), isSigmet && isShortTestOrRdoact && jsx(RadioButtonAndLabel, {
3926
4370
  value: "FORECAST_POSITION",
3927
- label: "End position",
4371
+ label: t('progress-radio-button-label-end-potision'),
3928
4372
  disabled: fieldsDisabled,
3929
4373
  "data-testid": "movementType-FORECAST_POSITION"
3930
4374
  })]
@@ -3935,7 +4379,7 @@ const Progress = ({
3935
4379
  }, {
3936
4380
  children: jsx(ReactHookFormSelect, Object.assign({
3937
4381
  name: "movementDirection",
3938
- label: "Set direction",
4382
+ label: t('progress-movement-direction-label'),
3939
4383
  rules: {
3940
4384
  validate: {
3941
4385
  isRequired
@@ -3969,7 +4413,7 @@ const Progress = ({
3969
4413
  }, {
3970
4414
  children: jsx(ReactHookFormSelect, Object.assign({
3971
4415
  name: "movementUnit",
3972
- label: "Unit",
4416
+ label: t('progress-movement-unit-label'),
3973
4417
  rules: {
3974
4418
  validate: {
3975
4419
  isRequired
@@ -3999,17 +4443,23 @@ const Progress = ({
3999
4443
  }, {
4000
4444
  children: jsx(ReactHookFormNumberField, {
4001
4445
  name: "movementSpeed",
4002
- label: "Step speed",
4446
+ label: t('progress-movement-speed-label'),
4003
4447
  rules: {
4004
4448
  validate: {
4005
4449
  isRequired,
4006
4450
  isInteger,
4007
4451
  min: value =>
4008
4452
  // The max level depends on the unit
4009
- isValidMin(value, getMinMovementSpeedValue(getValues('movementUnit'), getFIRValue(), productConfig)) || `The minimum level in ${MovementUnit[getValues('movementUnit')]} is ${getMinMovementSpeedValue(getValues('movementUnit'), getFIRValue(), productConfig)}`,
4453
+ isValidMin(value, getMinMovementSpeedValue(getValues('movementUnit'), getFIRValue(), productConfig)) || t('progress-the-minimum-level-in-movement', {
4454
+ movementUnitType: MovementUnit[getValues('movementUnit')],
4455
+ movementUnit: getMinMovementSpeedValue(getValues('movementUnit'), getFIRValue(), productConfig)
4456
+ }),
4010
4457
  max: value =>
4011
4458
  // The max level depends on the unit
4012
- isValidMax(value, getMaxMovementSpeedValue(getValues('movementUnit'), getFIRValue(), productConfig)) || `The maximum level in ${MovementUnit[getValues('movementUnit')]} is ${getMaxMovementSpeedValue(getValues('movementUnit'), getFIRValue(), productConfig)}`,
4459
+ isValidMax(value, getMaxMovementSpeedValue(getValues('movementUnit'), getFIRValue(), productConfig)) || t('progress-the-maxium-level-in-movement', {
4460
+ movementUnitType: MovementUnit[getValues('movementUnit')],
4461
+ movementUnit: getMaxMovementSpeedValue(getValues('movementUnit'), getFIRValue(), productConfig)
4462
+ }),
4013
4463
  validateMovementSteps: value =>
4014
4464
  // movement step depends on the unit
4015
4465
  validateMovementSteps(value, getValues('movementUnit'), productConfig, getFIRValue())
@@ -4025,7 +4475,7 @@ const Progress = ({
4025
4475
  }))]
4026
4476
  }), isSigmet && !isShortTestOrRdoact && jsx(RadioButtonAndLabel, {
4027
4477
  value: "FORECAST_POSITION",
4028
- label: "End position",
4478
+ label: t('progress-radio-button-label-end-potision'),
4029
4479
  disabled: _isDisabled,
4030
4480
  "data-testid": "movementType-FORECAST_POSITION"
4031
4481
  })]
@@ -4045,7 +4495,7 @@ const Progress = ({
4045
4495
  variant: "filled",
4046
4496
  sx: styles$2.quitDrawModeMessage
4047
4497
  }, {
4048
- children: exitDrawModeMessage
4498
+ children: t('geometry-exit-draw-mode-message')
4049
4499
  })), !!errors.endGeometry && jsx(FormHelperText, Object.assign({
4050
4500
  error: true,
4051
4501
  variant: "filled"
@@ -4055,30 +4505,36 @@ const Progress = ({
4055
4505
  showMaxFeaturePointsWarning && jsx(FormHelperText, Object.assign({
4056
4506
  variant: "filled"
4057
4507
  }, {
4058
- children: maxFeaturePointsMessage
4508
+ children: t('geometry-max-feature-points-message')
4059
4509
  })), /* non-blocking warnings */
4060
4510
  showMoreThan6PointsWarning && jsx(FormHelperText, Object.assign({
4061
4511
  variant: "filled"
4062
4512
  }, {
4063
- children: moreThan6PointsMessage
4513
+ children: t('progress-more-than-6-points-message', {
4514
+ totalDrawnPoints
4515
+ })
4064
4516
  })), /* non-blocking warnings */
4065
4517
  showIntersectionAbove6PointsWarning && jsx(FormHelperText, Object.assign({
4066
4518
  variant: "filled"
4067
4519
  }, {
4068
- children: intersectionAbove6PointsMessage
4520
+ children: t('progress-intersection-above-6-points-message', {
4521
+ intersectingPolygonPointsTotal
4522
+ })
4069
4523
  })), hasMulitpleIntersections(geoJSONIntersection) && !activeTool && !errors.endGeometry && !isFir(geoJSON) && jsx(FormHelperText, Object.assign({
4070
4524
  variant: "filled"
4071
4525
  }, {
4072
- children: multiIntersectionsMessage
4526
+ children: t('geometry-multi-intersections-message')
4073
4527
  }))]
4074
4528
  }), jsx(ReactHookFormHiddenInput, {
4075
4529
  name: "endGeometry",
4076
4530
  rules: {
4077
4531
  validate: {
4078
- maximumOneDrawing: value => isMaximumOneDrawing(value) || 'Only one end position drawing is allowed',
4079
- coordinatesNotEmpty: value => getValues('movementType') === 'FORECAST_POSITION' && !isDraft() ? isValidGeoJsonCoordinates(value) || coordinatesEmptyMessage : true,
4080
- intersectWithFIR: value => hasIntersectionWithFIR(value, getValues('endGeometryIntersect')) || noIntersectionMessage,
4081
- hasMaxFeaturePoints: value => isFir(value) ? true : !hasMaxFeaturePoints(value, maxPoints) || maximumPointsMessage
4532
+ maximumOneDrawing: value => isMaximumOneDrawing(value) || t('progress-only-one-position-drawing'),
4533
+ coordinatesNotEmpty: value => getValues('movementType') === 'FORECAST_POSITION' && !isDraft() ? isValidGeoJsonCoordinates(value) || t('progress-coordinate-empty-message') : true,
4534
+ intersectWithFIR: value => hasIntersectionWithFIR(value, getValues('endGeometryIntersect')) || t('progress-no-intersection-message'),
4535
+ hasMaxFeaturePoints: value => isFir(value) ? true : !hasMaxFeaturePoints(value, maxPoints) || t('progress-maximumPointsMessage', {
4536
+ maxPoints: maxPoints - 1
4537
+ })
4082
4538
  }
4083
4539
  }
4084
4540
  }), jsx(ReactHookFormHiddenInput, {
@@ -4111,6 +4567,9 @@ const SelectFIR = ({
4111
4567
  isReadOnly,
4112
4568
  onChange: _onChange = () => {}
4113
4569
  }) => {
4570
+ const {
4571
+ t
4572
+ } = useSigmetAirmetTranslation();
4114
4573
  const {
4115
4574
  setValue,
4116
4575
  trigger,
@@ -4143,11 +4602,11 @@ const SelectFIR = ({
4143
4602
  _onChange(changeEvent);
4144
4603
  };
4145
4604
  return jsxs(ProductFormFieldLayout, Object.assign({
4146
- title: "Where"
4605
+ title: t('select-fir-title')
4147
4606
  }, {
4148
4607
  children: [jsx(ReactHookFormSelect, Object.assign({
4149
4608
  name: "locationIndicatorATSR",
4150
- label: isReadOnly ? 'FIR' : 'Select FIR',
4609
+ label: isReadOnly ? 'FIR' : t('select-fir-label'),
4151
4610
  rules: {
4152
4611
  validate: {
4153
4612
  isRequired
@@ -4184,23 +4643,127 @@ const SelectFIR = ({
4184
4643
  }));
4185
4644
  };
4186
4645
 
4646
+ const StartGeometry = ({
4647
+ isReadOnly: _isReadOnly = false,
4648
+ activeTool,
4649
+ tools,
4650
+ onChangeTool,
4651
+ geoJSON,
4652
+ geoJSONIntersection,
4653
+ productConfig
4654
+ }) => {
4655
+ var _a, _b;
4656
+ const {
4657
+ t
4658
+ } = useSigmetAirmetTranslation();
4659
+ const {
4660
+ formState: {
4661
+ errors
4662
+ },
4663
+ watch,
4664
+ getValues
4665
+ } = useFormContext();
4666
+ const {
4667
+ isDraft
4668
+ } = useDraftFormHelpers();
4669
+ const {
4670
+ isShortTest
4671
+ } = useShortTestHelpers();
4672
+ const getFIRValue = () => getValues('locationIndicatorATSR');
4673
+ // Max points the FIR allows for a polygon
4674
+ const maxPoints = getMaxPolygonPoints(getFIRValue(), productConfig);
4675
+ // Intersections with FIR
4676
+ const intersectionPointCount = countIntersectionPoints(geoJSON, geoJSONIntersection);
4677
+ const drawnGeometry = (_a = geoJSON === null || geoJSON === void 0 ? void 0 : geoJSON.features[0]) === null || _a === void 0 ? void 0 : _a.geometry;
4678
+ const interceptionGeometry = (_b = geoJSONIntersection === null || geoJSONIntersection === void 0 ? void 0 : geoJSONIntersection.features[0]) === null || _b === void 0 ? void 0 : _b.geometry;
4679
+ // Total points in the user drawn polygon
4680
+ const totalDrawnPoints = drawnGeometry && drawnGeometry.coordinates[0] ? drawnGeometry.coordinates[0].length : 0;
4681
+ // Total points in the intersection polygon
4682
+ const intersectingPolygonPointsTotal = interceptionGeometry && interceptionGeometry.coordinates[0] ? interceptionGeometry.coordinates[0].length : 0;
4683
+ const showMaxFeaturePointsWarning = intersectionPointCount > 7 && hasMaxFeaturePoints(geoJSONIntersection, maxPoints) && !activeTool && !errors.startGeometry && !isFir(geoJSON);
4684
+ const showMoreThan6PointsWarning = totalDrawnPoints > 7 && intersectionPointCount < 1 && !activeTool && !errors.startGeometry && !isFir(geoJSON);
4685
+ const showIntersectionAbove6PointsWarning = intersectingPolygonPointsTotal > 7 && intersectionPointCount > 6 && maxPoints > 7 && !activeTool && !errors.startGeometry && !isFir(geoJSON);
4686
+ return !_isReadOnly ? jsxs(ProductFormFieldLayout, Object.assign({
4687
+ title: t('start-position'),
4688
+ sx: styles$2.drawSection,
4689
+ "data-testid": "startGeometry"
4690
+ }, {
4691
+ children: [jsx(DrawTools, {
4692
+ activeTool: activeTool,
4693
+ tools: tools,
4694
+ onChangeTool: onChangeTool,
4695
+ isDisabled: isShortTest()
4696
+ }), activeTool && jsx(FormHelperText, Object.assign({
4697
+ variant: "filled",
4698
+ sx: styles$2.quitDrawModeMessage
4699
+ }, {
4700
+ children: t('geometry-exit-draw-mode-message')
4701
+ })), !!errors.startGeometry && jsx(FormHelperText, Object.assign({
4702
+ error: true,
4703
+ variant: "filled"
4704
+ }, {
4705
+ children: errors.startGeometry.message
4706
+ })), /* non-blocking warnings */
4707
+ showMaxFeaturePointsWarning && jsx(FormHelperText, Object.assign({
4708
+ variant: "filled"
4709
+ }, {
4710
+ children: t('geometry-max-feature-points-message')
4711
+ })), /* non-blocking warnings */
4712
+ showMoreThan6PointsWarning && jsx(FormHelperText, Object.assign({
4713
+ variant: "filled"
4714
+ }, {
4715
+ children: t('geometry-more-than-6-points-message', {
4716
+ totalDrawnPoints
4717
+ })
4718
+ })), /* non-blocking warnings */
4719
+ showIntersectionAbove6PointsWarning && jsx(FormHelperText, Object.assign({
4720
+ variant: "filled"
4721
+ }, {
4722
+ children: t('geometry-intersection-above-6-points-message', {
4723
+ intersectingPolygonPointsTotal
4724
+ })
4725
+ })), hasMulitpleIntersections(geoJSONIntersection) && !activeTool && !errors.startGeometry && !isFir(geoJSON) && jsx(FormHelperText, Object.assign({
4726
+ variant: "filled"
4727
+ }, {
4728
+ children: t('geometry-multi-intersections-message')
4729
+ })), jsx(ReactHookFormHiddenInput, {
4730
+ name: "startGeometry",
4731
+ rules: {
4732
+ validate: {
4733
+ maximumOneDrawing: value => isMaximumOneDrawing(value) || t('geometry-only-one-start-position-drawing'),
4734
+ intersectWithFIR: value => hasIntersectionWithFIR(value, watch('startGeometryIntersect')) || t('geometry-no-intersection-message'),
4735
+ coordinatesNotEmpty: value => isDraft() || isShortTest() ? true : isValidGeoJsonCoordinates(value) || t('geometry-coodinates-empty-message'),
4736
+ hasMaxFeaturePoints: value => isFir(value) ? true : !hasMaxFeaturePoints(value, maxPoints) || t('geometry-maximum-points-message', {
4737
+ maxPoints: maxPoints - 1
4738
+ })
4739
+ }
4740
+ }
4741
+ }), jsx(ReactHookFormHiddenInput, {
4742
+ name: "startGeometryIntersect"
4743
+ })]
4744
+ })) : null;
4745
+ };
4746
+
4187
4747
  const Type = ({
4188
4748
  productType,
4189
4749
  isReadOnly,
4190
4750
  isDisabled,
4191
4751
  onChange: _onChange = () => {}
4192
4752
  }) => {
4753
+ const {
4754
+ t
4755
+ } = useSigmetAirmetTranslation();
4193
4756
  const {
4194
4757
  getValues,
4195
4758
  trigger
4196
4759
  } = useFormContext();
4197
- const label = getFieldLabel('Type', isReadOnly);
4760
+ const label = getFieldLabel(t('type-title'), isReadOnly);
4198
4761
  const {
4199
4762
  onTypeChange
4200
4763
  } = useShortTestHelpers();
4201
4764
  const messageType = productType === 'airmet' ? AirmetType : SigmetType;
4202
4765
  return jsx(ProductFormFieldLayout, Object.assign({
4203
- title: "Type"
4766
+ title: t('type-title')
4204
4767
  }, {
4205
4768
  children: jsx(ReactHookFormSelect, Object.assign({
4206
4769
  name: "type",
@@ -4226,8 +4789,9 @@ const Type = ({
4226
4789
  }));
4227
4790
  };
4228
4791
 
4229
- const VALID_FROM_ERROR_BEFORE_CURRENT = 'Valid from time cannot be before current time';
4230
- const getValidFromXHoursBeforeMessage = hours => `Valid from time can be no more than ${hours} hours after current time`;
4792
+ const getValidFromXHoursBeforeMessage = hours => translateKeyOutsideComponents('valid-from-time-error', {
4793
+ hours
4794
+ });
4231
4795
  const getDefaultValidFromValue = productConfig => {
4232
4796
  const validFromDelayTimeMinutes = getValidFromDelayTimeMinutesFromConfig(productConfig);
4233
4797
  return dateUtils.dateToString(dateUtils.add(dateUtils.utc(), {
@@ -4240,6 +4804,9 @@ const ValidFrom = ({
4240
4804
  isReadOnly,
4241
4805
  onChange: _onChange = () => {}
4242
4806
  }) => {
4807
+ const {
4808
+ t
4809
+ } = useSigmetAirmetTranslation();
4243
4810
  const {
4244
4811
  getValues,
4245
4812
  trigger
@@ -4247,9 +4814,9 @@ const ValidFrom = ({
4247
4814
  const {
4248
4815
  isRequired
4249
4816
  } = useDraftFormHelpers();
4250
- const label = getFieldLabel('Date and time', isReadOnly);
4817
+ const label = getFieldLabel(t('date-and-time'), isReadOnly);
4251
4818
  return jsx(ProductFormFieldLayout, Object.assign({
4252
- title: "Valid from"
4819
+ title: t('valid-from')
4253
4820
  }, {
4254
4821
  children: jsx(ReactHookFormDateTime, {
4255
4822
  disablePast: true,
@@ -4261,7 +4828,7 @@ const ValidFrom = ({
4261
4828
  isRequired,
4262
4829
  isValidDate: dateUtils.isValidIsoDateString,
4263
4830
  // The validity start can not be before the current time
4264
- isValueBeforeCurrentTime: value => isXHoursBefore(value, dateUtils.getCurrentTimeAsString(), 0) || VALID_FROM_ERROR_BEFORE_CURRENT,
4831
+ isValueBeforeCurrentTime: value => isXHoursBefore(value, dateUtils.getCurrentTimeAsString(), 0) || t('valid-from-before-current-error'),
4265
4832
  // The current time can be no more than 4 hours before the validity start (12 for VA/TC SIGMET)
4266
4833
  isCurrentTimeXHoursBeforeValue: value => isXHoursBefore(dateUtils.getCurrentTimeAsString(), value, getHoursBeforeValidity(getValues('phenomenon'), getValues('locationIndicatorATSR'), productConfig)) || getValidFromXHoursBeforeMessage(getHoursBeforeValidity(getValues('phenomenon'), getValues('locationIndicatorATSR'), productConfig))
4267
4834
  }
@@ -4291,6 +4858,9 @@ const ValidUntil = ({
4291
4858
  isReadOnly,
4292
4859
  onChange: _onChange = () => {}
4293
4860
  }) => {
4861
+ const {
4862
+ t
4863
+ } = useSigmetAirmetTranslation();
4294
4864
  const {
4295
4865
  getValues,
4296
4866
  trigger
@@ -4298,9 +4868,10 @@ const ValidUntil = ({
4298
4868
  const {
4299
4869
  isRequired
4300
4870
  } = useDraftFormHelpers();
4301
- const label = getFieldLabel('Date and time', isReadOnly);
4871
+ const dateAndTime = t('date-and-time');
4872
+ const label = getFieldLabel(dateAndTime, isReadOnly);
4302
4873
  return jsx(ProductFormFieldLayout, Object.assign({
4303
- title: "Valid until"
4874
+ title: t('valid-until')
4304
4875
  }, {
4305
4876
  children: jsx(ReactHookFormDateTime, {
4306
4877
  disablePast: true,
@@ -4312,9 +4883,11 @@ const ValidUntil = ({
4312
4883
  isRequired,
4313
4884
  isValidDate: dateUtils.isValidIsoDateString,
4314
4885
  // Validity end has to be after validity start
4315
- isAfter: value => value ? dateUtils.isAfter(value, getValues('validDateStart')) || 'Valid until time has to be after Valid from time' : true,
4886
+ isAfter: value => value ? dateUtils.isAfter(value, getValues('validDateStart')) || t('valid-until-time') : true,
4316
4887
  // Validity end can be no more than 4 hours after validity start (6 for VA/TC SIGMET)
4317
- isXHoursAfter: value => isXHoursAfter(value, getValues('validDateStart'), getMaxHoursOfValidity(getValues('phenomenon'), getValues('locationIndicatorATSR'), productConfig)) || `Valid until time can be no more than ${getMaxHoursOfValidity(getValues('phenomenon'), getValues('locationIndicatorATSR'), productConfig)} hours after Valid from time`
4888
+ isXHoursAfter: value => isXHoursAfter(value, getValues('validDateStart'), getMaxHoursOfValidity(getValues('phenomenon'), getValues('locationIndicatorATSR'), productConfig)) || t('valid-until-time-error', {
4889
+ hours: getMaxHoursOfValidity(getValues('phenomenon'), getValues('locationIndicatorATSR'), productConfig)
4890
+ })
4318
4891
  }
4319
4892
  },
4320
4893
  disabled: isDisabled,
@@ -4333,6 +4906,9 @@ const VolcanicFields = ({
4333
4906
  isReadOnly,
4334
4907
  helperText
4335
4908
  }) => {
4909
+ const {
4910
+ t
4911
+ } = useSigmetAirmetTranslation();
4336
4912
  const {
4337
4913
  watch,
4338
4914
  trigger,
@@ -4361,7 +4937,7 @@ const VolcanicFields = ({
4361
4937
  }, {
4362
4938
  children: jsx(ReactHookFormTextField, {
4363
4939
  name: "vaSigmetVolcanoName",
4364
- label: "Volcano name",
4940
+ label: t('volcano-name'),
4365
4941
  rules: {
4366
4942
  required: false
4367
4943
  },
@@ -4378,7 +4954,7 @@ const VolcanicFields = ({
4378
4954
  children: jsx(ReactHookFormNumberField, {
4379
4955
  name: "vaSigmetVolcanoCoordinates.latitude",
4380
4956
  "data-testid": "vaSigmetVolcanoCoordinates.latitude",
4381
- label: "Latitude",
4957
+ label: t('latitude'),
4382
4958
  inputMode: "decimal",
4383
4959
  rules: {
4384
4960
  required: true,
@@ -4400,7 +4976,7 @@ const VolcanicFields = ({
4400
4976
  children: jsx(ReactHookFormNumberField, {
4401
4977
  name: "vaSigmetVolcanoCoordinates.longitude",
4402
4978
  "data-testid": "vaSigmetVolcanoCoordinates.longitude",
4403
- label: "Longitude",
4979
+ label: t('longitude'),
4404
4980
  inputMode: "decimal",
4405
4981
  size: "small",
4406
4982
  sx: Object.assign({}, styles$2.latitude),
@@ -4422,7 +4998,9 @@ const VolcanicFields = ({
4422
4998
 
4423
4999
  const DEFAULT_ROUNDING_SURFACE_VISIBLILITY_BELOW = 50;
4424
5000
  const DEFAULT_ROUNDING_SURFACE_VISIBLILITY_ABOVE = 100;
4425
- const getInvalidSurfaceVisibilityTill750StepsMessage = (value = DEFAULT_ROUNDING_SURFACE_VISIBLILITY_BELOW) => `A visibility below 750m must be rounded to the nearest ${value}m`;
5001
+ const getInvalidSurfaceVisibilityTill750StepsMessage = (value = DEFAULT_ROUNDING_SURFACE_VISIBLILITY_BELOW) => translateKeyOutsideComponents('invalid-surface-visibility-till-750-steps-message', {
5002
+ value
5003
+ });
4426
5004
  const getInvalidSurfaceVisibilityFrom750StepsMessage = (value = DEFAULT_ROUNDING_SURFACE_VISIBLILITY_ABOVE) => `A visibility above 750m must be rounded to the nearest ${value}m`;
4427
5005
  const validateSurfaceVisibility = (value, productConfig, selectedFIR) => {
4428
5006
  if (isEmpty(value)) {
@@ -4447,6 +5025,9 @@ const SurfaceVisibility = ({
4447
5025
  productConfig,
4448
5026
  onChange: _onChange = () => {}
4449
5027
  }) => {
5028
+ const {
5029
+ t
5030
+ } = useSigmetAirmetTranslation();
4450
5031
  const {
4451
5032
  isRequired
4452
5033
  } = useDraftFormHelpers();
@@ -4454,8 +5035,8 @@ const SurfaceVisibility = ({
4454
5035
  getValues
4455
5036
  } = useFormContext();
4456
5037
  const getFIRValue = () => getValues('locationIndicatorATSR');
4457
- const visibilityLabel = getFieldLabel('Visibility', isReadOnly);
4458
- const visibilityCauseLabel = getFieldLabel('Cause', isReadOnly);
5038
+ const visibilityLabel = getFieldLabel(t('surface-visibility'), isReadOnly);
5039
+ const visibilityCauseLabel = getFieldLabel(t('surface-visibility-cause'), isReadOnly);
4459
5040
  return jsxs(Grid, Object.assign({
4460
5041
  item: true,
4461
5042
  container: true,
@@ -4481,16 +5062,20 @@ const SurfaceVisibility = ({
4481
5062
  name: "visibilityValue",
4482
5063
  "data-testid": "surfaceVisibility-visibilityValue",
4483
5064
  label: visibilityLabel,
4484
- helperText: "Value in meters",
5065
+ helperText: t('surface-visibility-helper-text'),
4485
5066
  rules: {
4486
5067
  validate: {
4487
5068
  isRequired,
4488
5069
  min: value =>
4489
5070
  // The min level depends on the unit
4490
- isValidMin(value, getMinVisibilityValue(getFIRValue(), productConfig)) || `The minimum visibility in meters is ${getMinVisibilityValue(getFIRValue(), productConfig)}`,
5071
+ isValidMin(value, getMinVisibilityValue(getFIRValue(), productConfig)) || t('surface-visibility-minimum-visibility', {
5072
+ minimumVisibility: getMinVisibilityValue(getFIRValue(), productConfig)
5073
+ }),
4491
5074
  max: value =>
4492
5075
  // The max level depends on the unit
4493
- isValidMax(value, getMaxVisibilityValue(getFIRValue(), productConfig)) || `The maximum visibility in meters is ${getMaxVisibilityValue(getFIRValue(), productConfig)}`,
5076
+ isValidMax(value, getMaxVisibilityValue(getFIRValue(), productConfig)) || t('surface-visibility-maximum-visibility', {
5077
+ maximumVisibility: getMaxVisibilityValue(getFIRValue(), productConfig)
5078
+ }),
4494
5079
  validateSurfaceVisibility: value => validateSurfaceVisibility(value, productConfig, getFIRValue())
4495
5080
  }
4496
5081
  },
@@ -4531,7 +5116,9 @@ const SurfaceVisibility = ({
4531
5116
  };
4532
5117
 
4533
5118
  const DEFAULT_ROUNDING_SURFACE_WIND_DIRECTION = 10;
4534
- const invalidSurfaceWindDirectionStepsMessage = (value = DEFAULT_ROUNDING_SURFACE_WIND_DIRECTION) => `Direction must be rounded to the nearest ${value} deg.`;
5119
+ const invalidSurfaceWindDirectionStepsMessage = (value = DEFAULT_ROUNDING_SURFACE_WIND_DIRECTION) => translateKeyOutsideComponents('invalid-surface-wind-direction-message', {
5120
+ value
5121
+ });
4535
5122
  const validateSurfaceWindDirection = (value, productConfig, selectedFIR) => {
4536
5123
  if (isEmpty(value)) {
4537
5124
  return true;
@@ -4550,6 +5137,9 @@ const SurfaceWind = ({
4550
5137
  onChange: _onChange = () => null,
4551
5138
  productConfig
4552
5139
  }) => {
5140
+ const {
5141
+ t
5142
+ } = useSigmetAirmetTranslation();
4553
5143
  const {
4554
5144
  trigger,
4555
5145
  getValues
@@ -4560,8 +5150,8 @@ const SurfaceWind = ({
4560
5150
  const getFIRValue = () => getValues('locationIndicatorATSR');
4561
5151
  // Get allowed speed units based on selected FIR - if no FIR selected, allow all units
4562
5152
  const allowedWindUnitsForFir = getAllowedUnits(getFIRValue(), productConfig, 'surfacewind_unit', WindUnit);
4563
- const windLabel = getFieldLabel('Wind direction', isReadOnly, 'Set');
4564
- const speedLabel = getFieldLabel('Speed', isReadOnly, 'Set');
5153
+ const windLabel = getFieldLabel(t('surface-wind-label'), isReadOnly, t('set'));
5154
+ const speedLabel = getFieldLabel(t('surface-wind-speed-label'), isReadOnly, t('set'));
4565
5155
  return jsxs(Grid, Object.assign({
4566
5156
  item: true,
4567
5157
  container: true,
@@ -4586,15 +5176,15 @@ const SurfaceWind = ({
4586
5176
  children: jsx(ReactHookFormNumberField, {
4587
5177
  name: "windDirection",
4588
5178
  label: windLabel,
4589
- helperText: "Value in degrees",
5179
+ helperText: t('surface-wind-helper-text'),
4590
5180
  rules: {
4591
5181
  min: {
4592
5182
  value: 10,
4593
- message: 'Direction should be between 10 and 360 deg.'
5183
+ message: t('surface-wind-rule-min-max-message')
4594
5184
  },
4595
5185
  max: {
4596
5186
  value: 360,
4597
- message: 'Direction should be between 10 and 360 deg.'
5187
+ message: t('surface-wind-rule-min-max-message')
4598
5188
  },
4599
5189
  validate: {
4600
5190
  isRequired,
@@ -4617,7 +5207,7 @@ const SurfaceWind = ({
4617
5207
  }, {
4618
5208
  children: jsx(ReactHookFormSelect, Object.assign({
4619
5209
  name: "windUnit",
4620
- label: "Unit",
5210
+ label: t('unit-label'),
4621
5211
  rules: {
4622
5212
  validate: {
4623
5213
  isRequired
@@ -4653,10 +5243,16 @@ const SurfaceWind = ({
4653
5243
  isInteger,
4654
5244
  min: value =>
4655
5245
  // The min level depends on the unit
4656
- isValidMin(value, getMinWindSpeedValue(getValues('windUnit'), getFIRValue(), productConfig)) || `The minimum wind speed in ${WindUnit[getValues('windUnit')]} is ${getMinWindSpeedValue(getValues('windUnit'), getFIRValue(), productConfig)}`,
5246
+ isValidMin(value, getMinWindSpeedValue(getValues('windUnit'), getFIRValue(), productConfig)) || t('surface-wind-minimum-wind-speed', {
5247
+ windUnit: WindUnit[getValues('windUnit')],
5248
+ minWindSpeedValue: getMinWindSpeedValue(getValues('windUnit'), getFIRValue(), productConfig)
5249
+ }),
4657
5250
  max: value =>
4658
5251
  // The max level depends on the unit
4659
- isValidMax(value, getMaxWindSpeedValue(getValues('windUnit'), getFIRValue(), productConfig)) || `The maximum wind speed in ${WindUnit[getValues('windUnit')]} is ${getMaxWindSpeedValue(getValues('windUnit'), getFIRValue(), productConfig)}`
5252
+ isValidMax(value, getMaxWindSpeedValue(getValues('windUnit'), getFIRValue(), productConfig)) || t('surface-wind-maximum-wind-speed', {
5253
+ windUnit: WindUnit[getValues('windUnit')],
5254
+ maxWindSpeedValue: getMaxWindSpeedValue(getValues('windUnit'), getFIRValue(), productConfig)
5255
+ })
4660
5256
  }
4661
5257
  },
4662
5258
  size: "small",
@@ -4715,6 +5311,9 @@ const CloudLevels = ({
4715
5311
  const {
4716
5312
  isRequired
4717
5313
  } = useDraftFormHelpers();
5314
+ const {
5315
+ t
5316
+ } = useSigmetAirmetTranslation();
4718
5317
  const getFIRValue = () => getValues('locationIndicatorATSR');
4719
5318
  const cloudLevelInfoMode = watch('cloudLevelInfoMode');
4720
5319
  // Get allowed cloud level units based on selected FIR - if no FIR selected, allow all default units
@@ -4740,7 +5339,7 @@ const CloudLevels = ({
4740
5339
  variant: "subtitle1",
4741
5340
  sx: styles$2.label
4742
5341
  }, {
4743
- children: "Levels"
5342
+ children: t('levels')
4744
5343
  }))
4745
5344
  })), jsx(Grid, Object.assign({
4746
5345
  item: true,
@@ -4980,7 +5579,8 @@ const CloudLevels = ({
4980
5579
  }));
4981
5580
  };
4982
5581
 
4983
- const noTAC = 'Missing data: no TAC can be generated';
5582
+ // ToDo check if this can be transated here
5583
+ const noTAC = translateKeyOutsideComponents('tac-missing-data');
4984
5584
  const isLevelFieldsComplete = product => {
4985
5585
  var _a, _b, _c, _d, _e, _f;
4986
5586
  switch (product.phenomenon) {
@@ -5054,6 +5654,10 @@ const shouldRetrieveTAC = (product, omitChange) => {
5054
5654
  return false;
5055
5655
  };
5056
5656
  const useTAC = (initialProduct, getTAC, hasErrors = () => false, omitChange) => {
5657
+ const {
5658
+ t
5659
+ } = useSigmetAirmetTranslation();
5660
+ const noTAC = t('tac-missing-data');
5057
5661
  const [TAC, setTAC] = React__default.useState(noTAC);
5058
5662
  const {
5059
5663
  isMounted
@@ -5128,6 +5732,9 @@ const IssuedAt = ({
5128
5732
  date,
5129
5733
  isReadOnly
5130
5734
  }) => {
5735
+ const {
5736
+ t
5737
+ } = useSigmetAirmetTranslation();
5131
5738
  return jsx(ProductFormFieldLayout, Object.assign({
5132
5739
  sx: {
5133
5740
  paddingTop: 0,
@@ -5135,7 +5742,7 @@ const IssuedAt = ({
5135
5742
  paddingTop: 0
5136
5743
  }
5137
5744
  },
5138
- title: "Issued at"
5745
+ title: t('issued-at')
5139
5746
  }, {
5140
5747
  children: jsx(Grid, Object.assign({
5141
5748
  item: true,
@@ -9390,6 +9997,9 @@ const SigmetForm = ({
9390
9997
  productConfig: _productConfig = sigmetConfig,
9391
9998
  setDialogActionsDisabled
9392
9999
  }) => {
10000
+ const {
10001
+ t
10002
+ } = useSigmetAirmetTranslation();
9393
10003
  const {
9394
10004
  api
9395
10005
  } = useApiContext();
@@ -9625,7 +10235,7 @@ const SigmetForm = ({
9625
10235
  sx: styles$2.body,
9626
10236
  "data-testid": "vaSigmetMoveToFIR"
9627
10237
  }, {
9628
- children: ["Volcanic Cloud is moving in the direction of:", ' ', jsxs("b", {
10238
+ children: [t('vulcanic-cloud-moving-text'), ":", ' ', jsxs("b", {
9629
10239
  children: [" ", watch('vaSigmetMoveToFIR')]
9630
10240
  })]
9631
10241
  }))
@@ -9954,6 +10564,9 @@ const ContentDialog = _a => {
9954
10564
  alertBanner = null
9955
10565
  } = _a,
9956
10566
  other = __rest(_a, ["open", "toggleDialogStatus", "title", "children", "options", "onClose", "alertBanner"]);
10567
+ const {
10568
+ t
10569
+ } = useSigmetAirmetTranslation();
9957
10570
  const theme = useTheme();
9958
10571
  const handleClose = () => {
9959
10572
  if (onClose) {
@@ -10021,7 +10634,7 @@ const ContentDialog = _a => {
10021
10634
  }
10022
10635
  }
10023
10636
  }, {
10024
- children: "BACK"
10637
+ children: t('back')
10025
10638
  }))
10026
10639
  })), jsx(Grid, Object.assign({
10027
10640
  item: true,
@@ -10221,6 +10834,9 @@ const ProductListRow = ({
10221
10834
  product,
10222
10835
  productType
10223
10836
  }) => {
10837
+ const {
10838
+ t
10839
+ } = useSigmetAirmetTranslation();
10224
10840
  const {
10225
10841
  api
10226
10842
  } = useApiContext();
@@ -10311,7 +10927,7 @@ const ProductListRow = ({
10311
10927
  item: true
10312
10928
  }, {
10313
10929
  children: [jsx(ProductListRowHeader, {
10314
- title: "Issue time"
10930
+ title: t('issue-time')
10315
10931
  }), jsx(CustomTooltip, Object.assign({
10316
10932
  title: jsxs(Fragment, {
10317
10933
  children: [jsx(ProductListRowHeader, {
@@ -10352,7 +10968,7 @@ const ProductListRow = ({
10352
10968
  sx: styles.font,
10353
10969
  "data-testid": "issueTime"
10354
10970
  }, {
10355
- children: product.issueDate ? `${dateUtils.dateToString(dateUtils.utc(product.issueDate), dateUtils.DATE_FORMAT_NAME_OF_MONTH)} UTC` : '(Not published)'
10971
+ children: product.issueDate ? `${dateUtils.dateToString(dateUtils.utc(product.issueDate), dateUtils.DATE_FORMAT_NAME_OF_MONTH)} UTC` : t('not-published')
10356
10972
  }))
10357
10973
  }))]
10358
10974
  })), jsxs(Grid, Object.assign({
@@ -10360,7 +10976,7 @@ const ProductListRow = ({
10360
10976
  item: true
10361
10977
  }, {
10362
10978
  children: [jsx(ProductListRowHeader, {
10363
- title: "Valid time"
10979
+ title: t('valid-time')
10364
10980
  }), jsx(Typography, Object.assign({
10365
10981
  variant: "subtitle2",
10366
10982
  sx: styles.font,
@@ -10380,7 +10996,7 @@ const ProductListRow = ({
10380
10996
  variant: "flat",
10381
10997
  startIcon: jsx(Edit, {})
10382
10998
  }, {
10383
- children: "DRAFT"
10999
+ children: t('draft')
10384
11000
  })) : getStatusTagList(product, cancelsSeqId), product.status === 'PUBLISHED' && cancelsSeqId === null && getActiveStatus(product)]
10385
11001
  }))]
10386
11002
  }))
@@ -10388,97 +11004,6 @@ const ProductListRow = ({
10388
11004
  }));
10389
11005
  };
10390
11006
 
10391
- const ERROR_CONFIG = 'An error has occurred while loading the config';
10392
- const ERROR_BACKEND = 'An error has occurred while retrieving the list, please try again';
10393
- const ERROR_AUTH$1 = 'This feature is protected by authentication.';
10394
- const validateConfig = (productType, productConfig) => {
10395
- const validatedConfig = productType === 'sigmet' ? validateSigmet(productConfig) : validateAirmet(productConfig);
10396
- if (validatedConfig !== true && Array.isArray(validatedConfig)) {
10397
- const error = {
10398
- name: ERROR_CONFIG,
10399
- message: createReadableErrorMessage(validatedConfig)
10400
- };
10401
- return error;
10402
- }
10403
- return true;
10404
- };
10405
- const useProductApi = (productType, productConfig) => {
10406
- const [state, setState] = React__default.useState({
10407
- isLoading: false,
10408
- error: undefined,
10409
- result: []
10410
- });
10411
- const {
10412
- isMounted
10413
- } = useIsMounted();
10414
- const {
10415
- api
10416
- } = useApiContext();
10417
- const requestList = productType === 'sigmet' ? api.getSigmetList : api.getAirmetList;
10418
- const {
10419
- isLoggedIn
10420
- } = useAuthenticationContext();
10421
- const updateState = newState => {
10422
- if (isMounted.current) {
10423
- setState(currentState => Object.assign(Object.assign({}, currentState), newState));
10424
- }
10425
- };
10426
- const fetchNewData = () => __awaiter(void 0, void 0, void 0, function* () {
10427
- var _a;
10428
- // Check for authentication before fetching data
10429
- if (!isLoggedIn && Array.isArray(isLoggedIn)) {
10430
- const newError = {
10431
- name: ERROR_AUTH$1,
10432
- message: createReadableErrorMessage(isLoggedIn)
10433
- };
10434
- updateState(Object.assign(Object.assign({}, state), {
10435
- error: newError,
10436
- isLoading: false
10437
- }));
10438
- return;
10439
- }
10440
- // don't try to fetch when error coming from config or is loading already
10441
- if (((_a = state.error) === null || _a === void 0 ? void 0 : _a.name) === ERROR_CONFIG || state.isLoading) {
10442
- return;
10443
- }
10444
- updateState(Object.assign(Object.assign({}, state), {
10445
- isLoading: true,
10446
- error: undefined
10447
- }));
10448
- try {
10449
- const {
10450
- data
10451
- } = yield requestList();
10452
- updateState(Object.assign(Object.assign({}, state), {
10453
- result: data,
10454
- isLoading: false
10455
- }));
10456
- } catch (error) {
10457
- const newError = Object.assign(Object.assign({}, error), {
10458
- name: ERROR_BACKEND
10459
- });
10460
- updateState(Object.assign(Object.assign({}, state), {
10461
- error: newError,
10462
- isLoading: false
10463
- }));
10464
- }
10465
- });
10466
- React__default.useEffect(() => {
10467
- const validatedConfig = validateConfig(productType, productConfig);
10468
- if (validatedConfig !== true) {
10469
- updateState(Object.assign(Object.assign({}, state), {
10470
- error: validatedConfig
10471
- }));
10472
- } else {
10473
- fetchNewData();
10474
- }
10475
- // eslint-disable-next-line react-hooks/exhaustive-deps
10476
- }, []);
10477
- return Object.assign(Object.assign({}, state), {
10478
- fetchNewData
10479
- });
10480
- };
10481
-
10482
11007
  const ProductList = ({
10483
11008
  productType,
10484
11009
  productList,
@@ -10487,7 +11012,10 @@ const ProductList = ({
10487
11012
  onClickProductRow,
10488
11013
  onClickNewProduct
10489
11014
  }) => {
10490
- const shouldHideCreateNew = error && (error.name === ERROR_AUTH$1 || error.name === ERROR_CONFIG);
11015
+ const {
11016
+ t
11017
+ } = useSigmetAirmetTranslation();
11018
+ const shouldHideCreateNew = error && (error.name === t('error-auth') || error.name === t('error-config'));
10491
11019
  return jsxs(Grid, Object.assign({
10492
11020
  container: true,
10493
11021
  direction: "column",
@@ -10498,7 +11026,7 @@ const ProductList = ({
10498
11026
  item: true,
10499
11027
  justifyContent: "flex-end"
10500
11028
  }, {
10501
- children: !shouldHideCreateNew && jsxs(Button, Object.assign({
11029
+ children: !shouldHideCreateNew && jsx(Button, Object.assign({
10502
11030
  variant: "primary",
10503
11031
  "data-testid": "productListCreateButton",
10504
11032
  onClick: onClickNewProduct,
@@ -10506,7 +11034,9 @@ const ProductList = ({
10506
11034
  textTransform: 'initial'
10507
11035
  }
10508
11036
  }, {
10509
- children: ["Create a new ", productType.toUpperCase()]
11037
+ children: t('create-new-product', {
11038
+ product: productType.toUpperCase()
11039
+ })
10510
11040
  }))
10511
11041
  })), jsxs(Grid, Object.assign({
10512
11042
  item: true,
@@ -10563,14 +11093,17 @@ const CancelSigmetVolcanicMovements = ({
10563
11093
  productConfig
10564
11094
  }) => {
10565
11095
  const allFIRS = getAllFirAreas(productConfig);
11096
+ const {
11097
+ t
11098
+ } = useSigmetAirmetTranslation();
10566
11099
  const {
10567
11100
  isRequired
10568
11101
  } = useDraftFormHelpers();
10569
11102
  return jsxs(Fragment, {
10570
- children: [jsx(Typography, Object.assign({
11103
+ children: [jsxs(Typography, Object.assign({
10571
11104
  variant: "body1"
10572
11105
  }, {
10573
- children: "Use the FIR to indicate the direction the Volcanic Ash is moving to:"
11106
+ children: [t('vulcanic-ash-description'), ":"]
10574
11107
  })), jsxs(ReactHookFormRadioGroup, Object.assign({
10575
11108
  name: "vaSigmetMoveToFIR",
10576
11109
  rules: {
@@ -10579,7 +11112,7 @@ const CancelSigmetVolcanicMovements = ({
10579
11112
  }
10580
11113
  },
10581
11114
  row: true,
10582
- defaultValue: "UNKNOWN"
11115
+ defaultValue: t('unknown').toUpperCase()
10583
11116
  }, {
10584
11117
  children: [allFIRS[sigmet.locationIndicatorATSR].adjacent_firs.map(adjacentFIR => {
10585
11118
  return jsx(FormControlLabel, {
@@ -10590,7 +11123,7 @@ const CancelSigmetVolcanicMovements = ({
10590
11123
  }), jsx(FormControlLabel, {
10591
11124
  value: "UNKNOWN",
10592
11125
  control: jsx(Radio, {}),
10593
- label: "Cancel VA SIGMET without VA MOV TO information"
11126
+ label: t('vulcanic-VA-SIGMET-text')
10594
11127
  }, "UNKNOWN")]
10595
11128
  }))]
10596
11129
  });
@@ -10837,6 +11370,94 @@ const ProductFormDialog = ({
10837
11370
  });
10838
11371
  };
10839
11372
 
11373
+ const validateConfig = (productType, productConfig) => {
11374
+ const validatedConfig = productType === 'sigmet' ? validateSigmet(productConfig) : validateAirmet(productConfig);
11375
+ if (validatedConfig !== true && Array.isArray(validatedConfig)) {
11376
+ const error = {
11377
+ name: translateKeyOutsideComponents('error-config'),
11378
+ message: createReadableErrorMessage(validatedConfig)
11379
+ };
11380
+ return error;
11381
+ }
11382
+ return true;
11383
+ };
11384
+ const useProductApi = (productType, productConfig) => {
11385
+ const [state, setState] = React__default.useState({
11386
+ isLoading: false,
11387
+ error: undefined,
11388
+ result: []
11389
+ });
11390
+ const {
11391
+ isMounted
11392
+ } = useIsMounted();
11393
+ const {
11394
+ api
11395
+ } = useApiContext();
11396
+ const requestList = productType === 'sigmet' ? api.getSigmetList : api.getAirmetList;
11397
+ const {
11398
+ isLoggedIn
11399
+ } = useAuthenticationContext();
11400
+ const updateState = newState => {
11401
+ if (isMounted.current) {
11402
+ setState(currentState => Object.assign(Object.assign({}, currentState), newState));
11403
+ }
11404
+ };
11405
+ const fetchNewData = () => __awaiter(void 0, void 0, void 0, function* () {
11406
+ var _a;
11407
+ // Check for authentication before fetching data
11408
+ if (!isLoggedIn && Array.isArray(isLoggedIn)) {
11409
+ const newError = {
11410
+ name: translateKeyOutsideComponents('error-auth'),
11411
+ message: createReadableErrorMessage(isLoggedIn)
11412
+ };
11413
+ updateState(Object.assign(Object.assign({}, state), {
11414
+ error: newError,
11415
+ isLoading: false
11416
+ }));
11417
+ return;
11418
+ }
11419
+ // don't try to fetch when error coming from config or is loading already
11420
+ if (((_a = state.error) === null || _a === void 0 ? void 0 : _a.name) === translateKeyOutsideComponents('error-config') || state.isLoading) {
11421
+ return;
11422
+ }
11423
+ updateState(Object.assign(Object.assign({}, state), {
11424
+ isLoading: true,
11425
+ error: undefined
11426
+ }));
11427
+ try {
11428
+ const {
11429
+ data
11430
+ } = yield requestList();
11431
+ updateState(Object.assign(Object.assign({}, state), {
11432
+ result: data,
11433
+ isLoading: false
11434
+ }));
11435
+ } catch (error) {
11436
+ const newError = Object.assign(Object.assign({}, error), {
11437
+ name: translateKeyOutsideComponents('error-backend')
11438
+ });
11439
+ updateState(Object.assign(Object.assign({}, state), {
11440
+ error: newError,
11441
+ isLoading: false
11442
+ }));
11443
+ }
11444
+ });
11445
+ React__default.useEffect(() => {
11446
+ const validatedConfig = validateConfig(productType, productConfig);
11447
+ if (validatedConfig !== true) {
11448
+ updateState(Object.assign(Object.assign({}, state), {
11449
+ error: validatedConfig
11450
+ }));
11451
+ } else {
11452
+ fetchNewData();
11453
+ }
11454
+ // eslint-disable-next-line react-hooks/exhaustive-deps
11455
+ }, []);
11456
+ return Object.assign(Object.assign({}, state), {
11457
+ fetchNewData
11458
+ });
11459
+ };
11460
+
10840
11461
  /**
10841
11462
  * Shows the list of Sigmets or Airmets and allows to create, edit and view Sigmets/Airmets.
10842
11463
  * Needs to be wrapped in the ApiProvider.
@@ -10909,12 +11530,13 @@ const MetInfoWrapper = ({
10909
11530
  }));
10910
11531
  };
10911
11532
 
10912
- const ERROR_TITLE = 'Something went wrong with loading the configuration file';
10913
- const ERROR_AUTH = 'This feature is protected by authentication. Please log in to proceed';
10914
11533
  const DownloadSigmetAirmetConfigWrapper = ({
10915
11534
  productType,
10916
11535
  productConfigKey
10917
11536
  }) => {
11537
+ const {
11538
+ t
11539
+ } = useSigmetAirmetTranslation();
10918
11540
  const {
10919
11541
  api
10920
11542
  } = useApiContext();
@@ -10942,8 +11564,8 @@ const DownloadSigmetAirmetConfigWrapper = ({
10942
11564
  }
10943
11565
  if (error) {
10944
11566
  return jsx(AlertBanner, {
10945
- title: ERROR_TITLE,
10946
- info: !isLoggedIn ? ERROR_AUTH : error.message
11567
+ title: t('error-title'),
11568
+ info: !isLoggedIn ? t('error-auth-login') : error.message
10947
11569
  });
10948
11570
  }
10949
11571
  return jsx(MetInfoWrapper, {
@@ -14596,6 +15218,4 @@ ConnectedModuleWrapper = null) => {
14596
15218
  }
14597
15219
  };
14598
15220
 
14599
- const SA_NAMESPACE = 'sigmetairmet';
14600
-
14601
15221
  export { AirmetComponentsLookUp, AirmetForm, AirmetPhenomena, AirmetType, CloudLevelUnits, ContentDialog, Direction, DownloadSigmetAirmetConfigWrapper, LevelUnits, MapViewGeoJson, MetInfoWrapper, MovementUnit, ProductList, ProductListRow, ProductStatusDescription, SA_NAMESPACE, SigmetComponentsLookUp, SigmetForm, SigmetPhenomena, SigmetType, StartOrEndDrawing, VisibilityCause, WindUnit, airmetConfig, createApi$1 as createApi, createApi as createFakeApi, isInstanceOfAirmet, isInstanceOfCancelAirmet, isInstanceOfCancelSigmet, isInstanceOfCancelSigmetOrAirmet, isInstanceOfSigmet, isInstanceOfSigmetOrAirmet, sigmetAirmetTranslations as saTranslations, sigmetConfig };