From 92e3713bb9e38d0449faf111d409ba26be07f4b0 Mon Sep 17 00:00:00 2001 From: Orka Arnest CRUZE <33525693+ocruze@users.noreply.github.com> Date: Fri, 13 Dec 2024 16:53:13 +0100 Subject: [PATCH] =?UTF-8?q?perf:=20s=C3=A9paration=20des=20textes=20de=20t?= =?UTF-8?q?raduction=20de=20leur=20composant=20#571=20#461=20(#577)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * perf: séparation des textes de traduction de leur composant #571 #461 * chore: déplace fichiers traductions proche de leur composant * chore: convention de nommage .locale pour les fichiers contenant les traductions #571 * fix: corrections suite rebase * chore: rangement dossiers --- assets/components/Layout/AppLayout.tsx | 4 +- assets/components/Layout/DatastoreLayout.tsx | 4 +- assets/components/Utils/LanguageSelector.tsx | 3 +- .../{ => navItems}/assistanceNavItems.ts | 4 +- .../navItems/datastoreNavItems.locale.tsx | 30 +++ .../{ => navItems}/datastoreNavItems.ts | 36 +-- assets/config/navItems/navItems.locale.tsx | 38 +++ assets/config/{ => navItems}/navItems.ts | 39 +-- .../AccessesRequest.locale.tsx | 54 ++++ .../AccessesRequest.tsx | 76 +----- .../AddMember/AddMember.locale.tsx | 28 ++ .../communities/{ => AddMember}/AddMember.tsx | 51 +--- .../pages/communities/CommunityList.tsx | 2 +- .../CommunityMembers.locale.tsx | 45 ++++ .../CommunityMembers.tsx | 76 ++---- .../pages/communities/Rights.locale.tsx} | 6 +- .../pages/dashboard/DashboardPro.locale.tsx | 18 ++ .../entrepot/pages/dashboard/DashboardPro.tsx | 19 +- .../DatasheetList/DatasheetList.locale.tsx | 40 +++ .../datasheet/DatasheetList/DatasheetList.tsx | 43 +-- .../DatasheetUploadForm.locale.tsx | 83 ++++++ .../DatasheetNew/DatasheetUploadForm.tsx | 85 +----- .../DatasheetUploadIntegrationDialog.tsx | 2 +- .../PyramidRasterList.locale.tsx | 50 ++++ .../PyramidRasterListItem.tsx | 53 +--- .../PyramidVectorList.locale.tsx | 34 +++ .../PyramidVectorListItem.tsx | 37 +-- .../VectorDbList/VectorDbList.locale.tsx | 70 +++++ .../VectorDbList/VectorDbListItem.tsx | 77 +----- .../DatasheetView/DatasheetThumbnail.tsx | 3 +- .../DatasheetView/DatasheetView.locale.tsx | 226 ++++++++++++++++ .../{ => DatasheetView}/DatasheetView.tsx | 252 +----------------- .../entrepot/pages/datastore/Confirmation.tsx | 2 +- .../pages/datastore/DatastoreCreationForm.tsx | 2 +- ...sTr.ts => DatastorePermissions.locale.tsx} | 6 +- .../ManagePermissions/ValidationSchemas.tsx | 4 +- .../DatastoreManageStorage.locale.tsx | 239 +++++++++++++++++ .../ManageStorage/DatastoreManageStorage.tsx | 243 +---------------- .../AccessRestrictions.locale.tsx | 44 +++ .../AccessRestrictions.tsx | 54 +--- .../TableSelection/TableSelection.locale.tsx | 15 ++ .../TableSelection}/TableSelection.tsx | 24 +- .../{ => common}/common-schemas-validation.ts | 6 +- .../service/{ => common}/default-values.ts | 12 +- .../AdditionalInfo.tsx | 0 .../{metadatas => metadata}/Description.tsx | 0 .../MetadataForm.locale.tsx} | 6 +- .../MetadataValidation.locale.tsx} | 16 +- .../{metadatas => metadata}/UploadMDFile.tsx | 0 .../service/tms/PyramidVectorGenerateForm.tsx | 2 +- .../PyramidVectorTmsServiceForm.locale.tsx | 62 +++++ .../PyramidVectorTmsServiceForm.tsx | 90 ++----- .../service/view/Style/Style.locale.tsx} | 6 +- .../service/wfs/WfsServiceForm.locale.tsx | 70 +++++ .../pages/service/wfs/WfsServiceForm.tsx | 84 +----- .../PyramidRasterGenerateForm.locale.tsx | 66 +++++ .../PyramidRasterGenerateForm.tsx | 98 ++----- ...ramidRasterWmsRasterServiceForm.locale.tsx | 57 ++++ .../PyramidRasterWmsRasterServiceForm.tsx | 90 ++----- .../PyramidRasterWmtsServiceForm.locale.tsx | 57 ++++ .../PyramidRasterWmtsServiceForm.tsx | 90 ++----- .../wms-vector/UploadStyleFile.locale.tsx | 16 ++ .../service/wms-vector/UploadStyleFile.tsx | 16 +- .../WmsVectorServiceForm.locale.tsx | 65 +++++ .../wms-vector/WmsVectorServiceForm.tsx | 83 +----- assets/entrepot/pages/users/Me.tsx | 148 ---------- .../users/access-keys/MyAccessKeys.locale.tsx | 34 +++ .../users/{ => access-keys}/MyAccessKeys.tsx | 52 +--- .../{UserKeyTr.tsx => UserKey.locale.tsx} | 5 +- .../entrepot/pages/users/keys/UserKeyForm.tsx | 2 +- .../UserKeysListTab.locale.tsx | 43 +++ .../{ => UserKeysListTab}/UserKeysListTab.tsx | 61 +---- assets/entrepot/pages/users/me/Me.locale.tsx | 87 ++++++ assets/entrepot/pages/users/me/Me.tsx | 62 +++++ ...rmissionsTr.tsx => Permissions.locale.tsx} | 5 +- ...esTr.ts => EspaceCoCommunities.locale.tsx} | 6 +- assets/i18n/{Common.tsx => Common.locale.tsx} | 6 +- assets/i18n/i18n.ts | 87 ++---- assets/i18n/index.ts | 4 + assets/i18n/languages/en.tsx | 88 +++--- assets/i18n/languages/fr.tsx | 88 +++--- assets/i18n/types.ts | 60 +++++ assets/modules/Style/StyleFilesManager.ts | 2 +- .../TMSStyleFilesManager.locale.tsx | 16 ++ .../TMSStyleFilesManager.ts | 26 +- .../breadcrumbs/Breadcrumb.locale.tsx} | 6 +- .../Breadcrumb.ts} | 6 +- assets/pages/LoginDisabled.tsx | 42 --- .../LoginDisabled/LoginDisabled.locale.tsx | 19 ++ assets/pages/LoginDisabled/LoginDisabled.tsx | 25 ++ .../assistance/contact/Contact.locale.tsx | 93 +++++++ assets/pages/assistance/contact/Contact.tsx | 97 +------ assets/router/RouterRenderer.tsx | 22 +- assets/validations/index.ts | 6 +- .../mapbox/MapboxStyleValidator.locale.tsx | 29 ++ .../{ => mapbox}/MapboxStyleValidator.ts | 35 +-- .../SldStyleValidation.locale.tsx} | 5 +- .../{ => sld}/SldStyleValidator.ts | 6 +- assets/validations/{ => sld}/sldStyle.ts | 8 +- 99 files changed, 2284 insertions(+), 2210 deletions(-) rename assets/config/{ => navItems}/assistanceNavItems.ts (88%) create mode 100644 assets/config/navItems/datastoreNavItems.locale.tsx rename assets/config/{ => navItems}/datastoreNavItems.ts (59%) create mode 100644 assets/config/navItems/navItems.locale.tsx rename assets/config/{ => navItems}/navItems.ts (55%) create mode 100644 assets/entrepot/pages/accesses-request/AccessesRequest.locale.tsx rename assets/entrepot/pages/{ => accesses-request}/AccessesRequest.tsx (77%) create mode 100644 assets/entrepot/pages/communities/AddMember/AddMember.locale.tsx rename assets/entrepot/pages/communities/{ => AddMember}/AddMember.tsx (73%) create mode 100644 assets/entrepot/pages/communities/CommunityMembers/CommunityMembers.locale.tsx rename assets/entrepot/pages/communities/{ => CommunityMembers}/CommunityMembers.tsx (83%) rename assets/{i18n/Rights.tsx => entrepot/pages/communities/Rights.locale.tsx} (90%) create mode 100644 assets/entrepot/pages/dashboard/DashboardPro.locale.tsx create mode 100644 assets/entrepot/pages/datasheet/DatasheetList/DatasheetList.locale.tsx create mode 100644 assets/entrepot/pages/datasheet/DatasheetNew/DatasheetUploadForm.locale.tsx create mode 100644 assets/entrepot/pages/datasheet/DatasheetView/DatasetListTab/PyramidRasterList/PyramidRasterList.locale.tsx create mode 100644 assets/entrepot/pages/datasheet/DatasheetView/DatasetListTab/PyramidVectorList/PyramidVectorList.locale.tsx create mode 100644 assets/entrepot/pages/datasheet/DatasheetView/DatasetListTab/VectorDbList/VectorDbList.locale.tsx create mode 100644 assets/entrepot/pages/datasheet/DatasheetView/DatasheetView/DatasheetView.locale.tsx rename assets/entrepot/pages/datasheet/DatasheetView/{ => DatasheetView}/DatasheetView.tsx (50%) rename assets/entrepot/pages/datastore/ManagePermissions/{DatastorePermissionsTr.ts => DatastorePermissions.locale.tsx} (98%) create mode 100644 assets/entrepot/pages/datastore/ManageStorage/DatastoreManageStorage.locale.tsx create mode 100644 assets/entrepot/pages/service/common/AccessRestrictions/AccessRestrictions.locale.tsx rename assets/entrepot/pages/service/{ => common/AccessRestrictions}/AccessRestrictions.tsx (61%) create mode 100644 assets/entrepot/pages/service/common/TableSelection/TableSelection.locale.tsx rename assets/entrepot/pages/service/{ => common/TableSelection}/TableSelection.tsx (73%) rename assets/entrepot/pages/service/{ => common}/common-schemas-validation.ts (97%) rename assets/entrepot/pages/service/{ => common}/default-values.ts (95%) rename assets/entrepot/pages/service/{metadatas => metadata}/AdditionalInfo.tsx (100%) rename assets/entrepot/pages/service/{metadatas => metadata}/Description.tsx (100%) rename assets/entrepot/pages/service/{metadatas/metadatas-form-tr.tsx => metadata/MetadataForm.locale.tsx} (98%) rename assets/entrepot/pages/service/{metadatas/metadatas-validation-tr.ts => metadata/MetadataValidation.locale.tsx} (94%) rename assets/entrepot/pages/service/{metadatas => metadata}/UploadMDFile.tsx (100%) create mode 100644 assets/entrepot/pages/service/tms/PyramidVectorTmsServiceForm/PyramidVectorTmsServiceForm.locale.tsx rename assets/entrepot/pages/service/tms/{ => PyramidVectorTmsServiceForm}/PyramidVectorTmsServiceForm.tsx (78%) rename assets/{i18n/Style.tsx => entrepot/pages/service/view/Style/Style.locale.tsx} (88%) create mode 100644 assets/entrepot/pages/service/wfs/WfsServiceForm.locale.tsx create mode 100644 assets/entrepot/pages/service/wms-raster-wmts/PyramidRasterGenerateForm/PyramidRasterGenerateForm.locale.tsx rename assets/entrepot/pages/service/wms-raster-wmts/{ => PyramidRasterGenerateForm}/PyramidRasterGenerateForm.tsx (69%) create mode 100644 assets/entrepot/pages/service/wms-raster-wmts/PyramidRasterWmsRasterServiceForm/PyramidRasterWmsRasterServiceForm.locale.tsx rename assets/entrepot/pages/service/wms-raster-wmts/{ => PyramidRasterWmsRasterServiceForm}/PyramidRasterWmsRasterServiceForm.tsx (77%) create mode 100644 assets/entrepot/pages/service/wms-raster-wmts/PyramidRasterWmtsServiceForm/PyramidRasterWmtsServiceForm.locale.tsx rename assets/entrepot/pages/service/wms-raster-wmts/{ => PyramidRasterWmtsServiceForm}/PyramidRasterWmtsServiceForm.tsx (78%) create mode 100644 assets/entrepot/pages/service/wms-vector/UploadStyleFile.locale.tsx create mode 100644 assets/entrepot/pages/service/wms-vector/WmsVectorServiceForm.locale.tsx delete mode 100644 assets/entrepot/pages/users/Me.tsx create mode 100644 assets/entrepot/pages/users/access-keys/MyAccessKeys.locale.tsx rename assets/entrepot/pages/users/{ => access-keys}/MyAccessKeys.tsx (55%) rename assets/entrepot/pages/users/keys/{UserKeyTr.tsx => UserKey.locale.tsx} (97%) create mode 100644 assets/entrepot/pages/users/keys/UserKeysListTab/UserKeysListTab.locale.tsx rename assets/entrepot/pages/users/keys/{ => UserKeysListTab}/UserKeysListTab.tsx (82%) create mode 100644 assets/entrepot/pages/users/me/Me.locale.tsx create mode 100644 assets/entrepot/pages/users/me/Me.tsx rename assets/entrepot/pages/users/permissions/{PermissionsTr.tsx => Permissions.locale.tsx} (91%) rename assets/espaceco/pages/communities/{EspaceCoCommunitiesTr.ts => EspaceCoCommunities.locale.tsx} (92%) rename assets/i18n/{Common.tsx => Common.locale.tsx} (93%) create mode 100644 assets/i18n/index.ts create mode 100644 assets/i18n/types.ts create mode 100644 assets/modules/Style/TMSStyleFilesManager/TMSStyleFilesManager.locale.tsx rename assets/modules/Style/{ => TMSStyleFilesManager}/TMSStyleFilesManager.ts (83%) rename assets/{i18n/Breadcrumb.tsx => modules/entrepot/breadcrumbs/Breadcrumb.locale.tsx} (97%) rename assets/modules/entrepot/{breadcrumbs.ts => breadcrumbs/Breadcrumb.ts} (98%) delete mode 100644 assets/pages/LoginDisabled.tsx create mode 100644 assets/pages/LoginDisabled/LoginDisabled.locale.tsx create mode 100644 assets/pages/LoginDisabled/LoginDisabled.tsx create mode 100644 assets/pages/assistance/contact/Contact.locale.tsx create mode 100644 assets/validations/mapbox/MapboxStyleValidator.locale.tsx rename assets/validations/{ => mapbox}/MapboxStyleValidator.ts (64%) rename assets/validations/{SldStyleValidationErrorsTr.tsx => sld/SldStyleValidation.locale.tsx} (95%) rename assets/validations/{ => sld}/SldStyleValidator.ts (93%) rename assets/validations/{ => sld}/sldStyle.ts (95%) diff --git a/assets/components/Layout/AppLayout.tsx b/assets/components/Layout/AppLayout.tsx index b9e8101c..c55de02c 100644 --- a/assets/components/Layout/AppLayout.tsx +++ b/assets/components/Layout/AppLayout.tsx @@ -7,13 +7,13 @@ import { useQuery } from "@tanstack/react-query"; import { FC, PropsWithChildren, ReactNode, memo, useMemo } from "react"; import { ConsentBannerAndConsentManagement } from "../../config/consentManagement"; -import { defaultNavItems } from "../../config/navItems"; +import { defaultNavItems } from "../../config/navItems/navItems"; import api from "../../entrepot/api"; import useDocumentTitle from "../../hooks/useDocumentTitle"; import { useTranslation } from "../../i18n/i18n"; import Translator from "../../modules/Translator"; import RQKeys from "../../modules/entrepot/RQKeys"; -import getBreadcrumb from "../../modules/entrepot/breadcrumbs"; +import getBreadcrumb from "../../modules/entrepot/breadcrumbs/Breadcrumb"; import { useRoute } from "../../router/router"; import SessionExpiredAlert from "../Utils/SessionExpiredAlert"; import SnackbarMessage from "../Utils/SnackbarMessage"; diff --git a/assets/components/Layout/DatastoreLayout.tsx b/assets/components/Layout/DatastoreLayout.tsx index 89014b74..c561c1f5 100644 --- a/assets/components/Layout/DatastoreLayout.tsx +++ b/assets/components/Layout/DatastoreLayout.tsx @@ -2,8 +2,8 @@ import { BreadcrumbProps } from "@codegouvfr/react-dsfr/Breadcrumb"; import { useQuery } from "@tanstack/react-query"; import { FC, PropsWithChildren, memo, useMemo } from "react"; -import type { Datastore } from "../../@types/app"; -import { datastoreNavItems } from "../../config/datastoreNavItems"; +import { Datastore } from "../../@types/app"; +import { datastoreNavItems } from "../../config/navItems/datastoreNavItems"; import api from "../../entrepot/api"; import RQKeys from "../../modules/entrepot/RQKeys"; import { CartesApiException } from "../../modules/jsonFetch"; diff --git a/assets/components/Utils/LanguageSelector.tsx b/assets/components/Utils/LanguageSelector.tsx index eff44344..06817b24 100644 --- a/assets/components/Utils/LanguageSelector.tsx +++ b/assets/components/Utils/LanguageSelector.tsx @@ -2,7 +2,8 @@ import { fr } from "@codegouvfr/react-dsfr"; import { memo, useId } from "react"; import { symToStr } from "tsafe/symToStr"; -import { languagesDisplayNames, languages, type Language } from "../../i18n/i18n"; +import { Language } from "../../i18n"; +import { languages, languagesDisplayNames } from "../../i18n/types"; type Props = { lang: Language; diff --git a/assets/config/assistanceNavItems.ts b/assets/config/navItems/assistanceNavItems.ts similarity index 88% rename from assets/config/assistanceNavItems.ts rename to assets/config/navItems/assistanceNavItems.ts index da22b2d5..ca02f461 100644 --- a/assets/config/assistanceNavItems.ts +++ b/assets/config/navItems/assistanceNavItems.ts @@ -1,8 +1,8 @@ import { MainNavigationProps } from "@codegouvfr/react-dsfr/MainNavigation"; import { TranslationFunction } from "i18nifty/typeUtils/TranslationFunction"; -import { ComponentKey } from "../i18n/i18n"; -import { routes } from "../router/router"; +import { ComponentKey } from "../../i18n/types"; +import { routes } from "../../router/router"; export const assistanceNavItems = (t: TranslationFunction<"navItems", ComponentKey>): MainNavigationProps.Item.Menu => { return { diff --git a/assets/config/navItems/datastoreNavItems.locale.tsx b/assets/config/navItems/datastoreNavItems.locale.tsx new file mode 100644 index 00000000..90b29086 --- /dev/null +++ b/assets/config/navItems/datastoreNavItems.locale.tsx @@ -0,0 +1,30 @@ +import { declareComponentKeys } from "i18nifty"; + +import { Translations } from "../../i18n/types"; + +const { i18n } = declareComponentKeys< + "dashboard" | "data" | "members" | "manage_storage" | "consumption_monitoring" | "permissions_granted" | "my_account" | "my_access_keys" +>()("datastoreNavItems"); +export type I18n = typeof i18n; + +export const datastoreNavItemsFrTranslations: Translations<"fr">["datastoreNavItems"] = { + dashboard: "Tableau de bord", + data: "Données", + members: "Membres", + manage_storage: "Gérer l’espace de travail", + consumption_monitoring: "Suivi des consommations", + permissions_granted: "Permissions accordées", + my_account: "Mon compte", + my_access_keys: "Mes clés d’accès", +}; + +export const datastoreNavItemsEnTranslations: Translations<"en">["datastoreNavItems"] = { + dashboard: undefined, + data: undefined, + members: undefined, + manage_storage: undefined, + consumption_monitoring: undefined, + permissions_granted: undefined, + my_account: undefined, + my_access_keys: undefined, +}; diff --git a/assets/config/datastoreNavItems.ts b/assets/config/navItems/datastoreNavItems.ts similarity index 59% rename from assets/config/datastoreNavItems.ts rename to assets/config/navItems/datastoreNavItems.ts index 20746dd2..e80fbe48 100644 --- a/assets/config/datastoreNavItems.ts +++ b/assets/config/navItems/datastoreNavItems.ts @@ -1,10 +1,9 @@ import { type MainNavigationProps } from "@codegouvfr/react-dsfr/MainNavigation/MainNavigation"; -import { declareComponentKeys } from "i18nifty"; -import { Datastore } from "../@types/app"; -import { Translations, getTranslation } from "../i18n/i18n"; -import { routes } from "../router/router"; -import { useAuthStore } from "../stores/AuthStore"; +import { Datastore } from "../../@types/app"; +import { getTranslation } from "../../i18n/i18n"; +import { routes } from "../../router/router"; +import { useAuthStore } from "../../stores/AuthStore"; import { assistanceNavItems } from "./assistanceNavItems"; const { t } = getTranslation("datastoreNavItems"); @@ -59,30 +58,3 @@ export const datastoreNavItems = (currentDatastore?: Datastore): MainNavigationP return navItems; }; - -// traductions -export const { i18n } = declareComponentKeys< - "dashboard" | "data" | "members" | "manage_storage" | "consumption_monitoring" | "permissions_granted" | "my_account" | "my_access_keys" ->()("datastoreNavItems"); - -export const datastoreNavItemsFrTranslations: Translations<"fr">["datastoreNavItems"] = { - dashboard: "Tableau de bord", - data: "Données", - members: "Membres", - manage_storage: "Gérer l’espace de travail", - consumption_monitoring: "Suivi des consommations", - permissions_granted: "Permissions accordées", - my_account: "Mon compte", - my_access_keys: "Mes clés d’accès", -}; - -export const datastoreNavItemsEnTranslations: Translations<"en">["datastoreNavItems"] = { - dashboard: undefined, - data: undefined, - members: undefined, - manage_storage: undefined, - consumption_monitoring: undefined, - permissions_granted: undefined, - my_account: undefined, - my_access_keys: undefined, -}; diff --git a/assets/config/navItems/navItems.locale.tsx b/assets/config/navItems/navItems.locale.tsx new file mode 100644 index 00000000..40bd78dd --- /dev/null +++ b/assets/config/navItems/navItems.locale.tsx @@ -0,0 +1,38 @@ +import { declareComponentKeys } from "i18nifty"; + +import { Translations } from "../../i18n/types"; + +const { i18n } = declareComponentKeys< + "documentation" | "offer" | "join" | "faq" | "nous écrire" | "start" | "maps" | "catalog" | "news" | "assistance" | "service status" | "about" +>()("navItems"); +export type I18n = typeof i18n; + +export const navItemsFrTranslations: Translations<"fr">["navItems"] = { + "nous écrire": "Nous écrire", + documentation: "Documentation", + offer: "Offre", + join: "Nous rejoindre", + faq: "Questions fréquentes", + start: "Commencer avec cartes.gouv", + catalog: "Catalogue", + maps: "Cartes", + news: "Actualités", + assistance: "Assistance", + "service status": "Niveau de service", + about: "À propos", +}; + +export const navItemsEnTranslations: Translations<"en">["navItems"] = { + "nous écrire": "Contact us", + documentation: "Documentation", + offer: "Offer", + join: "Join us", + faq: "Frequently asked questions", + start: "Start with cartes.gouv", + catalog: "Catalog", + maps: "Maps", + news: "News", + assistance: "Assistance", + "service status": "Level of service", + about: "About", +}; diff --git a/assets/config/navItems.ts b/assets/config/navItems/navItems.ts similarity index 55% rename from assets/config/navItems.ts rename to assets/config/navItems/navItems.ts index b3bf276b..39466e0c 100644 --- a/assets/config/navItems.ts +++ b/assets/config/navItems/navItems.ts @@ -1,8 +1,8 @@ import { MainNavigationProps } from "@codegouvfr/react-dsfr/MainNavigation"; import { TranslationFunction } from "i18nifty/typeUtils/TranslationFunction"; -import { ComponentKey, Translations, declareComponentKeys } from "../i18n/i18n"; -import { routes } from "../router/router"; +import { ComponentKey } from "../../i18n/types"; +import { routes } from "../../router/router"; import { assistanceNavItems } from "./assistanceNavItems"; // dans ce cas précise, getTranslation ne marche pas parce que les traductions sont pas encore chargées, on est donc obglié de passer la fonction t en paramètre @@ -46,38 +46,3 @@ export const defaultNavItems = (t: TranslationFunction<"navItems", ComponentKey> return navItems; }; - -// traductions -export const { i18n } = declareComponentKeys< - "documentation" | "offer" | "join" | "faq" | "nous écrire" | "start" | "maps" | "catalog" | "news" | "assistance" | "service status" | "about" ->()("navItems"); - -export const navItemsFrTranslations: Translations<"fr">["navItems"] = { - "nous écrire": "Nous écrire", - documentation: "Documentation", - offer: "Offre", - join: "Nous rejoindre", - faq: "Questions fréquentes", - start: "Commencer avec cartes.gouv", - catalog: "Catalogue", - maps: "Cartes", - news: "Actualités", - assistance: "Assistance", - "service status": "Niveau de service", - about: "À propos", -}; - -export const navItemsEnTranslations: Translations<"en">["navItems"] = { - "nous écrire": "Contact us", - documentation: "Documentation", - offer: "Offer", - join: "Join us", - faq: "Frequently asked questions", - start: "Start with cartes.gouv", - catalog: "Catalog", - maps: "Maps", - news: "News", - assistance: "Assistance", - "service status": "Level of service", - about: "About", -}; diff --git a/assets/entrepot/pages/accesses-request/AccessesRequest.locale.tsx b/assets/entrepot/pages/accesses-request/AccessesRequest.locale.tsx new file mode 100644 index 00000000..8394b499 --- /dev/null +++ b/assets/entrepot/pages/accesses-request/AccessesRequest.locale.tsx @@ -0,0 +1,54 @@ +import { declareComponentKeys } from "i18nifty"; +import { Translations } from "../../../i18n/types"; + +const { i18n } = declareComponentKeys< + | "title" + | { K: "explain"; P: { url: string }; R: JSX.Element } + | "explain_no_access" + | "back_to_dashboard" + | "beneficiaries" + | { K: "beneficiaries_hintext"; R: JSX.Element } + | "myself" + | { K: "community"; P: { name: string }; R: string } + | "min_layers_error" + | "sending_message" +>()("AccessesRequest"); +export type I18n = typeof i18n; + +export const AccessesRequestFrTranslations: Translations<"fr">["AccessesRequest"] = { + title: "Demande d’accès", + explain: ({ url }) => ( +

+ Vous souhaitez demander au producteur des données décrites sur cette fiche du catalogue un accès aux services de diffusion de + données dont l'accès est restreint. Sélectionnez les couches de données et types de services auxquels vous souhaitez accéder : (sélectionner au + moins une couche) +

+ ), + explain_no_access: "Cette fiche ne décrit aucun service de diffusion dont l’accès est restreint. Vous avez déjà accès à toutes les données décrites.", + back_to_dashboard: "Retour au tableau de bord", + beneficiaries: "Bénéficiaires", + beneficiaries_hintext: ( + + Vous pouvez demander au producteur des données de vous accorder une permission d'accès personnelle ou +
+ demander qu'il accorde cette permission à tous les membres d'une communauté à laquelle vous appartenez. +
+ ), + myself: "Moi-même", + community: ({ name }) => `La communauté ${name}`, + min_layers_error: "Vous devez sélectionner au moins une couche", + sending_message: "Votre message est en cours d’envoi ...", +}; + +export const AccessesRequestEnTranslations: Translations<"en">["AccessesRequest"] = { + title: undefined, + explain: undefined, + explain_no_access: undefined, + back_to_dashboard: undefined, + beneficiaries: "Bénéficiaries", + beneficiaries_hintext: undefined, + myself: "Myself", + community: ({ name }) => `Community ${name}`, + min_layers_error: undefined, + sending_message: undefined, +}; diff --git a/assets/entrepot/pages/AccessesRequest.tsx b/assets/entrepot/pages/accesses-request/AccessesRequest.tsx similarity index 77% rename from assets/entrepot/pages/AccessesRequest.tsx rename to assets/entrepot/pages/accesses-request/AccessesRequest.tsx index b1755a57..5b2469cd 100644 --- a/assets/entrepot/pages/AccessesRequest.tsx +++ b/assets/entrepot/pages/accesses-request/AccessesRequest.tsx @@ -10,17 +10,17 @@ import { ComponentProps, FC, ReactNode, useMemo, useState } from "react"; import { useForm } from "react-hook-form"; import * as yup from "yup"; -import type { GeonetworkMetadataResponse } from "../../@types/app"; -import AppLayout from "../../components/Layout/AppLayout"; -import LoadingText from "../../components/Utils/LoadingText"; -import Wait from "../../components/Utils/Wait"; -import { Translations, declareComponentKeys, useTranslation } from "../../i18n/i18n"; -import SymfonyRouting from "../../modules/Routing"; -import RQKeys from "../../modules/entrepot/RQKeys"; -import { CartesApiException, jsonFetch } from "../../modules/jsonFetch"; -import { catalogueUrl, routes } from "../../router/router"; -import { useAuthStore } from "../../stores/AuthStore"; -import api from "../api"; +import { GeonetworkMetadataResponse } from "../../../@types/app"; +import AppLayout from "../../../components/Layout/AppLayout"; +import LoadingText from "../../../components/Utils/LoadingText"; +import Wait from "../../../components/Utils/Wait"; +import { useTranslation } from "../../../i18n/i18n"; +import SymfonyRouting from "../../../modules/Routing"; +import RQKeys from "../../../modules/entrepot/RQKeys"; +import { CartesApiException, jsonFetch } from "../../../modules/jsonFetch"; +import { catalogueUrl, routes } from "../../../router/router"; +import { useAuthStore } from "../../../stores/AuthStore"; +import api from "../../api"; type AskForAccesses = { fileIdentifier: string; @@ -227,57 +227,3 @@ const AccessesRequest: FC = ({ fileIdentifier }) => { }; export default AccessesRequest; - -// traductions -export const { i18n } = declareComponentKeys< - | "title" - | { K: "explain"; P: { url: string }; R: JSX.Element } - | "explain_no_access" - | "back_to_dashboard" - | "beneficiaries" - | { K: "beneficiaries_hintext"; R: JSX.Element } - | "myself" - | { K: "community"; P: { name: string }; R: string } - | "min_layers_error" - | "sending_message" ->()({ - AccessesRequest, -}); - -export const AccessesRequestFrTranslations: Translations<"fr">["AccessesRequest"] = { - title: "Demande d’accès", - explain: ({ url }) => ( -

- Vous souhaitez demander au producteur des données décrites sur cette fiche du catalogue un accès aux services de diffusion de - données dont l'accès est restreint. Sélectionnez les couches de données et types de services auxquels vous souhaitez accéder : (sélectionner au - moins une couche) -

- ), - explain_no_access: "Cette fiche ne décrit aucun service de diffusion dont l’accès est restreint. Vous avez déjà accès à toutes les données décrites.", - back_to_dashboard: "Retour au tableau de bord", - beneficiaries: "Bénéficiaires", - beneficiaries_hintext: ( - - Vous pouvez demander au producteur des données de vous accorder une permission d'accès personnelle ou -
- demander qu'il accorde cette permission à tous les membres d'une communauté à laquelle vous appartenez. -
- ), - myself: "Moi-même", - community: ({ name }) => `La communauté ${name}`, - min_layers_error: "Vous devez sélectionner au moins une couche", - sending_message: "Votre message est en cours d’envoi ...", -}; - -export const AccessesRequestEnTranslations: Translations<"en">["AccessesRequest"] = { - title: undefined, - explain: undefined, - explain_no_access: undefined, - back_to_dashboard: undefined, - beneficiaries: "Bénéficiaries", - beneficiaries_hintext: undefined, - myself: "Myself", - community: ({ name }) => `Community ${name}`, - min_layers_error: undefined, - sending_message: undefined, -}; diff --git a/assets/entrepot/pages/communities/AddMember/AddMember.locale.tsx b/assets/entrepot/pages/communities/AddMember/AddMember.locale.tsx new file mode 100644 index 00000000..fe798341 --- /dev/null +++ b/assets/entrepot/pages/communities/AddMember/AddMember.locale.tsx @@ -0,0 +1,28 @@ +import { declareComponentKeys } from "i18nifty"; + +import { Translations } from "../../../../i18n/types"; + +const { i18n } = declareComponentKeys< + "add_user_title" | "user_id" | "rights_granted" | "id_mandatory" | "id_must_be_uuid" | { K: "already_member"; P: { userId: string }; R: string } | "running" +>()("AddMember"); +export type I18n = typeof i18n; + +export const AddMemberFrTranslations: Translations<"fr">["AddMember"] = { + add_user_title: "Ajouter un utilisateur", + user_id: "Identifiant de l’utilisateur", + rights_granted: "Permissions accordées", + id_mandatory: "L’identifiant est obligatoire", + id_must_be_uuid: "L’Identifiant doit être un UUID", + already_member: ({ userId }) => `l’utilisateur ${userId} est déjà membre de cet espace de travail`, + running: "Ajout d’utilisateur en cours ...", +}; + +export const AddMemberEnTranslations: Translations<"en">["AddMember"] = { + add_user_title: "Add user", + user_id: "User identifier", + rights_granted: "Rights granted", + id_mandatory: "Identifier is mandatory", + id_must_be_uuid: "Identifier must be an UUID", + already_member: ({ userId }) => `User ${userId} is already a member of this community`, + running: "Ajout d’utilisateur running ...", +}; diff --git a/assets/entrepot/pages/communities/AddMember.tsx b/assets/entrepot/pages/communities/AddMember/AddMember.tsx similarity index 73% rename from assets/entrepot/pages/communities/AddMember.tsx rename to assets/entrepot/pages/communities/AddMember/AddMember.tsx index 1a9c8b7c..201636c1 100644 --- a/assets/entrepot/pages/communities/AddMember.tsx +++ b/assets/entrepot/pages/communities/AddMember/AddMember.tsx @@ -11,15 +11,16 @@ import { createPortal } from "react-dom"; import { useForm } from "react-hook-form"; import * as yup from "yup"; -import type { UserRightsResponseDto } from "../../../@types/app"; -import LoadingIcon from "../../../components/Utils/LoadingIcon"; -import { ComponentKey, Translations, declareComponentKeys, getTranslation, useTranslation } from "../../../i18n/i18n"; -import RQKeys from "../../../modules/entrepot/RQKeys"; -import { CartesApiException } from "../../../modules/jsonFetch"; -import { routes } from "../../../router/router"; -import { regex } from "../../../utils"; -import api from "../../api"; -import { getRights, rightTypes } from "./UserRights"; +import type { UserRightsResponseDto } from "../../../../@types/app"; +import LoadingIcon from "../../../../components/Utils/LoadingIcon"; +import { useTranslation } from "../../../../i18n/i18n"; +import { ComponentKey } from "../../../../i18n/types"; +import RQKeys from "../../../../modules/entrepot/RQKeys"; +import { CartesApiException } from "../../../../modules/jsonFetch"; +import { routes } from "../../../../router/router"; +import { regex } from "../../../../utils"; +import api from "../../../api"; +import { getRights, rightTypes } from "../UserRights"; const addMemberModal = createModal({ id: "add-member-modal", @@ -32,11 +33,10 @@ type AddMemberProps = { userId?: string; }; -const { t: tCommon } = getTranslation("Common"); -const { t: translateRights } = getTranslation("Rights"); - const AddMember: FC = ({ communityId, communityMemberIds, userId }) => { const { t } = useTranslation({ AddMember }); + const { t: tCommon } = useTranslation("Common"); + const { t: translateRights } = useTranslation("Rights"); const schema = (t: TranslationFunction<"AddMember", ComponentKey>) => { return yup.object({ @@ -152,30 +152,3 @@ const AddMember: FC = ({ communityId, communityMemberIds, userId }; export { AddMember, addMemberModal }; - -// traductions -export const { i18n } = declareComponentKeys< - "add_user_title" | "user_id" | "rights_granted" | "id_mandatory" | "id_must_be_uuid" | { K: "already_member"; P: { userId: string }; R: string } | "running" ->()({ - AddMember, -}); - -export const AddMemberFrTranslations: Translations<"fr">["AddMember"] = { - add_user_title: "Ajouter un utilisateur", - user_id: "Identifiant de l’utilisateur", - rights_granted: "Permissions accordées", - id_mandatory: "L’identifiant est obligatoire", - id_must_be_uuid: "L’Identifiant doit être un UUID", - already_member: ({ userId }) => `l’utilisateur ${userId} est déjà membre de cet espace de travail`, - running: "Ajout d’utilisateur en cours ...", -}; - -export const AddMemberEnTranslations: Translations<"en">["AddMember"] = { - add_user_title: "Add user", - user_id: "User identifier", - rights_granted: "Rights granted", - id_mandatory: "Identifier is mandatory", - id_must_be_uuid: "Identifier must be an UUID", - already_member: ({ userId }) => `User ${userId} is already a member of this community`, - running: "Ajout d’utilisateur running ...", -}; diff --git a/assets/entrepot/pages/communities/CommunityList.tsx b/assets/entrepot/pages/communities/CommunityList.tsx index 957e29fd..61b26bf2 100644 --- a/assets/entrepot/pages/communities/CommunityList.tsx +++ b/assets/entrepot/pages/communities/CommunityList.tsx @@ -12,7 +12,7 @@ import api from "../../api"; import AppLayout from "../../../components/Layout/AppLayout"; import LoadingText from "../../../components/Utils/LoadingText"; import Wait from "../../../components/Utils/Wait"; -import { datastoreNavItems } from "../../../config/datastoreNavItems"; +import { datastoreNavItems } from "../../../config/navItems/datastoreNavItems"; import RQKeys from "../../../modules/entrepot/RQKeys"; import Translator from "../../../modules/Translator"; import { CartesApiException } from "../../../modules/jsonFetch"; diff --git a/assets/entrepot/pages/communities/CommunityMembers/CommunityMembers.locale.tsx b/assets/entrepot/pages/communities/CommunityMembers/CommunityMembers.locale.tsx new file mode 100644 index 00000000..b756ca1e --- /dev/null +++ b/assets/entrepot/pages/communities/CommunityMembers/CommunityMembers.locale.tsx @@ -0,0 +1,45 @@ +import { declareComponentKeys } from "i18nifty"; +import { Translations } from "../../../../i18n/types"; + +const { i18n } = declareComponentKeys< + | { K: "community_members"; P: { communityName: string }; R: string } + | { K: "already_member"; P: { userId: string }; R: string } + | "rights" + | "name" + | "me" + | "supervisor" + | "add_user" + | "remove_user" + | "confirm_remove" + | { K: "add_remove_right_title"; P: { right: string }; R: string } + | "no_necessary_rights" +>()("CommunityMembers"); +export type I18n = typeof i18n; + +export const CommunityMembersFrTranslations: Translations<"fr">["CommunityMembers"] = { + community_members: ({ communityName }) => `Membres de ${communityName}`, + already_member: ({ userId }) => `l’utilisateur ${userId} est déjà membre de cet espace de travail`, + rights: "Permissions du compte", + name: "Nom", + me: "moi", + supervisor: "superviseur", + add_user: "Ajouter un utilisateur", + remove_user: "Supprimer cet utilisateur", + confirm_remove: "Êtes-vous sûr de vouloir supprimer cet utilisateur ?", + add_remove_right_title: ({ right }) => `Ajouter/supprimer le droit ${right}`, + no_necessary_rights: "Vous n'avez pas les droits nécessaires pour visualiser les membres de cet espace de travail.", +}; + +export const CommunityMembersEnTranslations: Translations<"en">["CommunityMembers"] = { + community_members: ({ communityName }) => `Members of ${communityName}`, + already_member: ({ userId }) => `User ${userId} is already a member of this community`, + rights: "User rights", + name: "Name", + me: "me", + supervisor: "supervisor", + add_user: "Add user", + remove_user: "Remove this user", + confirm_remove: "Are you sure you want to delete this user ?", + add_remove_right_title: ({ right }) => `Add/remove right ${right} to user`, + no_necessary_rights: "You do not have the necessary rights to view and modify the users of this community.", +}; diff --git a/assets/entrepot/pages/communities/CommunityMembers.tsx b/assets/entrepot/pages/communities/CommunityMembers/CommunityMembers.tsx similarity index 83% rename from assets/entrepot/pages/communities/CommunityMembers.tsx rename to assets/entrepot/pages/communities/CommunityMembers/CommunityMembers.tsx index 70e06a62..64cfa873 100644 --- a/assets/entrepot/pages/communities/CommunityMembers.tsx +++ b/assets/entrepot/pages/communities/CommunityMembers/CommunityMembers.tsx @@ -5,21 +5,22 @@ import { ToggleSwitch } from "@codegouvfr/react-dsfr/ToggleSwitch"; import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query"; import { FC, useEffect, useMemo, useState } from "react"; -import { UserRightsResponseDto } from "../../../@types/app"; -import { CommunityMemberDtoRightsEnum, CommunityUserResponseDto, UserDto } from "../../../@types/entrepot"; -import DatastoreLayout from "../../../components/Layout/DatastoreLayout"; -import ConfirmDialog, { ConfirmDialogModal } from "../../../components/Utils/ConfirmDialog"; -import LoadingText from "../../../components/Utils/LoadingText"; -import Wait from "../../../components/Utils/Wait"; -import { declareComponentKeys, Translations, useTranslation } from "../../../i18n/i18n"; -import RQKeys from "../../../modules/entrepot/RQKeys"; -import { CartesApiException } from "../../../modules/jsonFetch"; -import { routes } from "../../../router/router"; -import "../../../sass/pages/community_members.scss"; -import { useAuthStore } from "../../../stores/AuthStore"; -import api from "../../api"; -import { AddMember, addMemberModal } from "./AddMember"; -import { complete, getTranslatedRightTypes, UserRights } from "./UserRights"; +import { UserRightsResponseDto } from "../../../../@types/app"; +import { CommunityMemberDtoRightsEnum, CommunityUserResponseDto, UserDto } from "../../../../@types/entrepot"; +import DatastoreLayout from "../../../../components/Layout/DatastoreLayout"; +import ConfirmDialog, { ConfirmDialogModal } from "../../../../components/Utils/ConfirmDialog"; +import LoadingText from "../../../../components/Utils/LoadingText"; +import Wait from "../../../../components/Utils/Wait"; +import { useTranslation } from "../../../../i18n/i18n"; +import RQKeys from "../../../../modules/entrepot/RQKeys"; +import { CartesApiException } from "../../../../modules/jsonFetch"; +import { routes } from "../../../../router/router"; +import { useAuthStore } from "../../../../stores/AuthStore"; +import api from "../../../api"; +import { AddMember, addMemberModal } from "../AddMember/AddMember"; +import { complete, getTranslatedRightTypes, UserRights } from "../UserRights"; + +import "../../../../sass/pages/community_members.scss"; type CommunityMembersProps = { communityId: string; @@ -306,48 +307,3 @@ const CommunityMembers: FC = ({ communityId, userId }) => }; export default CommunityMembers; - -// traductions -export const { i18n } = declareComponentKeys< - | { K: "community_members"; P: { communityName: string }; R: string } - | { K: "already_member"; P: { userId: string }; R: string } - | "rights" - | "name" - | "me" - | "supervisor" - | "add_user" - | "remove_user" - | "confirm_remove" - | { K: "add_remove_right_title"; P: { right: string }; R: string } - | "no_necessary_rights" ->()({ - CommunityMembers, -}); - -export const CommunityMembersFrTranslations: Translations<"fr">["CommunityMembers"] = { - community_members: ({ communityName }) => `Membres de ${communityName}`, - already_member: ({ userId }) => `l’utilisateur ${userId} est déjà membre de cet espace de travail`, - rights: "Permissions du compte", - name: "Nom", - me: "moi", - supervisor: "superviseur", - add_user: "Ajouter un utilisateur", - remove_user: "Supprimer cet utilisateur", - confirm_remove: "Êtes-vous sûr de vouloir supprimer cet utilisateur ?", - add_remove_right_title: ({ right }) => `Ajouter/supprimer le droit ${right}`, - no_necessary_rights: "Vous n'avez pas les droits nécessaires pour visualiser les membres de cet espace de travail.", -}; - -export const CommunityMembersEnTranslations: Translations<"en">["CommunityMembers"] = { - community_members: ({ communityName }) => `Members of ${communityName}`, - already_member: ({ userId }) => `User ${userId} is already a member of this community`, - rights: "User rights", - name: "Name", - me: "me", - supervisor: "supervisor", - add_user: "Add user", - remove_user: "Remove this user", - confirm_remove: "Are you sure you want to delete this user ?", - add_remove_right_title: ({ right }) => `Add/remove right ${right} to user`, - no_necessary_rights: "You do not have the necessary rights to view and modify the users of this community.", -}; diff --git a/assets/i18n/Rights.tsx b/assets/entrepot/pages/communities/Rights.locale.tsx similarity index 90% rename from assets/i18n/Rights.tsx rename to assets/entrepot/pages/communities/Rights.locale.tsx index 1f603409..fc0f1c43 100644 --- a/assets/i18n/Rights.tsx +++ b/assets/entrepot/pages/communities/Rights.locale.tsx @@ -1,6 +1,7 @@ -import { declareComponentKeys, type Translations } from "./i18n"; +import { declareComponentKeys } from "../../../i18n/i18n"; +import { type Translations } from "../../../i18n/types"; -export const { i18n } = declareComponentKeys< +const { i18n } = declareComponentKeys< | "annex" | "broadcast" | "community" @@ -12,6 +13,7 @@ export const { i18n } = declareComponentKeys< | "processing_explain" | "upload_explain" >()("Rights"); +export type I18n = typeof i18n; export const RightsFrTranslations: Translations<"fr">["Rights"] = { annex: "Annexes", diff --git a/assets/entrepot/pages/dashboard/DashboardPro.locale.tsx b/assets/entrepot/pages/dashboard/DashboardPro.locale.tsx new file mode 100644 index 00000000..87ead024 --- /dev/null +++ b/assets/entrepot/pages/dashboard/DashboardPro.locale.tsx @@ -0,0 +1,18 @@ +import { declareComponentKeys } from "i18nifty"; + +import { Translations } from "../../../i18n/types"; + +const { i18n } = declareComponentKeys<"document_title" | "espaceco_frontoffice_list" | "datastore_for_tests">()("DashboardPro"); +export type I18n = typeof i18n; + +export const DashboardProFrTranslations: Translations<"fr">["DashboardPro"] = { + document_title: "Tableau de bord professionnel", + espaceco_frontoffice_list: "Liste des guichets de l’espace collaboratif", + datastore_for_tests: "À des fins de test", +}; + +export const DashboardProEnTranslations: Translations<"en">["DashboardPro"] = { + document_title: "Professional dashboard", + espaceco_frontoffice_list: "List of collaborative space front offices", + datastore_for_tests: "For testing purposes", +}; diff --git a/assets/entrepot/pages/dashboard/DashboardPro.tsx b/assets/entrepot/pages/dashboard/DashboardPro.tsx index 3499feb1..88ae618f 100644 --- a/assets/entrepot/pages/dashboard/DashboardPro.tsx +++ b/assets/entrepot/pages/dashboard/DashboardPro.tsx @@ -2,15 +2,14 @@ import { fr } from "@codegouvfr/react-dsfr"; import Button from "@codegouvfr/react-dsfr/Button"; import { Tile } from "@codegouvfr/react-dsfr/Tile"; import { useMutation, useQuery } from "@tanstack/react-query"; -import { declareComponentKeys } from "i18nifty"; import { useEffect } from "react"; import { CartesUser, Datastore } from "../../../@types/app"; import AppLayout from "../../../components/Layout/AppLayout"; import LoadingIcon from "../../../components/Utils/LoadingIcon"; import Skeleton from "../../../components/Utils/Skeleton"; -import { datastoreNavItems } from "../../../config/datastoreNavItems"; -import { Translations, useTranslation } from "../../../i18n/i18n"; +import { datastoreNavItems } from "../../../config/navItems/datastoreNavItems"; +import { useTranslation } from "../../../i18n/i18n"; import Translator from "../../../modules/Translator"; import RQKeys from "../../../modules/entrepot/RQKeys"; import { CartesApiException } from "../../../modules/jsonFetch"; @@ -193,17 +192,3 @@ const DashboardPro = () => { }; export default DashboardPro; - -export const { i18n } = declareComponentKeys<"document_title" | "espaceco_frontoffice_list" | "datastore_for_tests">()("DashboardPro"); - -export const DashboardProFrTranslations: Translations<"fr">["DashboardPro"] = { - document_title: "Tableau de bord professionnel", - espaceco_frontoffice_list: "Liste des guichets de l’espace collaboratif", - datastore_for_tests: "À des fins de test", -}; - -export const DashboardProEnTranslations: Translations<"en">["DashboardPro"] = { - document_title: "Professional dashboard", - espaceco_frontoffice_list: "List of collaborative space front offices", - datastore_for_tests: "For testing purposes", -}; diff --git a/assets/entrepot/pages/datasheet/DatasheetList/DatasheetList.locale.tsx b/assets/entrepot/pages/datasheet/DatasheetList/DatasheetList.locale.tsx new file mode 100644 index 00000000..cb2e663f --- /dev/null +++ b/assets/entrepot/pages/datasheet/DatasheetList/DatasheetList.locale.tsx @@ -0,0 +1,40 @@ +import { declareComponentKeys } from "i18nifty"; +import { ReactNode } from "react"; +import { Translations } from "../../../../i18n/types"; + +const { i18n } = declareComponentKeys< + | { K: "title"; P: { datastoreName?: string }; R: string } + | "create_datasheet" + | "datasheet_creation_impossible" + | "metadata_endpoint_quota_reached" + | { K: "services_published"; P: { nbServices?: number }; R: string } + | "no_services_published" + | { K: "sandbox_datastore_explanation"; R: ReactNode } +>()("DatasheetList"); +export type I18n = typeof i18n; + +export const DatasheetListFrTranslations: Translations<"fr">["DatasheetList"] = { + title: ({ datastoreName }) => `Données ${datastoreName ?? ""}`, + create_datasheet: "Créer une fiche de données", + datasheet_creation_impossible: "Création d’une nouvelle fiche de données impossible", + metadata_endpoint_quota_reached: "Quota du point d’accès de métadonnées atteint", + services_published: ({ nbServices }) => `Publié (${nbServices})`, + no_services_published: "Non publié", + sandbox_datastore_explanation: ( +

+ { + "Cet espace permet de tester les fonctions d’alimentation et de diffusion de la Géoplateforme. Les services publiés dans cet espace ne sont pas visibles sur le catalogue." + } +

+ ), +}; + +export const DatasheetListEnTranslations: Translations<"en">["DatasheetList"] = { + title: undefined, + create_datasheet: undefined, + datasheet_creation_impossible: undefined, + metadata_endpoint_quota_reached: undefined, + services_published: undefined, + no_services_published: undefined, + sandbox_datastore_explanation: undefined, +}; diff --git a/assets/entrepot/pages/datasheet/DatasheetList/DatasheetList.tsx b/assets/entrepot/pages/datasheet/DatasheetList/DatasheetList.tsx index 7328050e..14d6ab29 100644 --- a/assets/entrepot/pages/datasheet/DatasheetList/DatasheetList.tsx +++ b/assets/entrepot/pages/datasheet/DatasheetList/DatasheetList.tsx @@ -2,14 +2,13 @@ import { fr } from "@codegouvfr/react-dsfr"; import Alert from "@codegouvfr/react-dsfr/Alert"; import Button from "@codegouvfr/react-dsfr/Button"; import { useQuery } from "@tanstack/react-query"; -import { declareComponentKeys } from "i18nifty"; -import { FC, ReactNode, useMemo } from "react"; +import { FC, useMemo } from "react"; import { Datasheet, EndpointTypeEnum } from "../../../../@types/app"; import DatastoreLayout from "../../../../components/Layout/DatastoreLayout"; import LoadingIcon from "../../../../components/Utils/LoadingIcon"; import Skeleton from "../../../../components/Utils/Skeleton"; -import { Translations, useTranslation } from "../../../../i18n/i18n"; +import { useTranslation } from "../../../../i18n/i18n"; import RQKeys from "../../../../modules/entrepot/RQKeys"; import { routes } from "../../../../router/router"; import api from "../../../api"; @@ -77,41 +76,3 @@ const DatasheetList: FC = ({ datastoreId }) => { }; export default DatasheetList; - -export const { i18n } = declareComponentKeys< - | { K: "title"; P: { datastoreName?: string }; R: string } - | "create_datasheet" - | "datasheet_creation_impossible" - | "metadata_endpoint_quota_reached" - | { K: "services_published"; P: { nbServices?: number }; R: string } - | "no_services_published" - | { K: "sandbox_datastore_explanation"; R: ReactNode } ->()({ - DatasheetList, -}); - -export const DatasheetListFrTranslations: Translations<"fr">["DatasheetList"] = { - title: ({ datastoreName }) => `Données ${datastoreName ?? ""}`, - create_datasheet: "Créer une fiche de données", - datasheet_creation_impossible: "Création d’une nouvelle fiche de données impossible", - metadata_endpoint_quota_reached: "Quota du point d’accès de métadonnées atteint", - services_published: ({ nbServices }) => `Publié (${nbServices})`, - no_services_published: "Non publié", - sandbox_datastore_explanation: ( -

- { - "Cet espace permet de tester les fonctions d’alimentation et de diffusion de la Géoplateforme. Les services publiés dans cet espace ne sont pas visibles sur le catalogue." - } -

- ), -}; - -export const DatasheetListEnTranslations: Translations<"en">["DatasheetList"] = { - title: undefined, - create_datasheet: undefined, - datasheet_creation_impossible: undefined, - metadata_endpoint_quota_reached: undefined, - services_published: undefined, - no_services_published: undefined, - sandbox_datastore_explanation: undefined, -}; diff --git a/assets/entrepot/pages/datasheet/DatasheetNew/DatasheetUploadForm.locale.tsx b/assets/entrepot/pages/datasheet/DatasheetNew/DatasheetUploadForm.locale.tsx new file mode 100644 index 00000000..e2ad9919 --- /dev/null +++ b/assets/entrepot/pages/datasheet/DatasheetNew/DatasheetUploadForm.locale.tsx @@ -0,0 +1,83 @@ +import { declareComponentKeys } from "i18nifty"; +import { Translations } from "../../../../i18n/types"; + +const { i18n } = declareComponentKeys< + | { K: "title"; P: { datasheetName: string | undefined }; R: string } + | { K: "back_to"; P: { datasheetName: string | undefined }; R: string } + | "datasheet.name" + | "datasheet.name_hint" + | "datasheet.name_mandatory_error" + | "datasheet.name_max_length_error" + | "datasheet.name_regex_error" + | { K: "datasheet.name_already_exists_error"; P: { datasheetName: string }; R: string } + | "datasheet.creation_running" + | "upload" + | "upload_hint" + | "upload_nofile_error" + | { K: "upload_extension_error"; P: { filename: string }; R: string } + | { K: "upload_max_size_error"; P: { maxSize: number }; R: string } + | "upload_running" + | "technical_name" + | "technical_name_hint" + | "technical_name_mandatory_error" + | "projection" + | "projection_mandatory_error" + | "select_projection" + | "upload_file" + | "data_infos_title" +>()("DatasheetUploadForm"); +export type I18n = typeof i18n; + +export const DatasheetUploadFormFrTranslations: Translations<"fr">["DatasheetUploadForm"] = { + title: ({ datasheetName }) => (datasheetName === undefined ? "Créer une fiche de données" : "Ajouter un fichier de données"), + back_to: ({ datasheetName }) => (datasheetName === undefined ? "Retour à ma liste de données" : "Retour à ma fiche de données"), + "datasheet.name": "Nom de votre fiche de donnée", + "datasheet.name_hint": "Ce nom vous permettra d’identifier votre donnée dans la géoplateforme, soyez aussi clair que possible.", + "datasheet.name_mandatory_error": "Le nom de la donnée est obligatoire", + "datasheet.name_max_length_error": "Le nombre maximal de caractères pour le nom de la fiche de donnée est de 99", + "datasheet.name_regex_error": + "Le nom de la fiche de donnée ne peut contenir que des caractères alphanumériques, espaces blancs et certains caractères spéciaux", + "datasheet.name_already_exists_error": ({ datasheetName }) => `Une fiche de donnée existe déjà avec le nom "${datasheetName}"`, + "datasheet.creation_running": "Création de la fiche en cours ...", + upload: "Déposez votre fichier de données", + // NB: la taille maximale doit correspondre à celle effectivement implémentée dans DatasheetUploadForm + upload_hint: "Taille maximale : 1 Go. Formats de fichiers autorisés : Geopackage ou archive zip contenant un Geopackage (recommandé)", + upload_nofile_error: "Aucun fichier téléversé", + upload_extension_error: ({ filename }) => `L’extension du fichier ${filename} n'est pas correcte`, + upload_max_size_error: ({ maxSize }) => `La taille maximale pour un fichier est de ${maxSize}`, + upload_running: "Téléversement en cours ...", + technical_name: "Nom technique de votre donnée", + technical_name_hint: "Ce nom technique est invisible par votre utilisateur final. Il apparaitra uniquement dans votre espace de travail", + technical_name_mandatory_error: "Le nom technique de la donnée est obligatoire", + projection: "Projection de vos données", + projection_mandatory_error: "La projection (srid) est obligatoire", + select_projection: "Selectionnez une projection", + upload_file: "Déposer votre fichier", + data_infos_title: "Les données suivantes ont été détectées. Modifiez les si besoin", +}; + +export const DatasheetUploadFormEnTranslations: Translations<"en">["DatasheetUploadForm"] = { + title: undefined, + back_to: undefined, + "datasheet.name": undefined, + "datasheet.name_hint": undefined, + "datasheet.name_mandatory_error": undefined, + "datasheet.name_max_length_error": undefined, + "datasheet.name_regex_error": undefined, + "datasheet.name_already_exists_error": undefined, + "datasheet.creation_running": undefined, + upload: undefined, + upload_hint: undefined, + upload_nofile_error: undefined, + upload_extension_error: undefined, + upload_max_size_error: undefined, + upload_running: undefined, + technical_name: undefined, + technical_name_hint: undefined, + technical_name_mandatory_error: undefined, + projection: undefined, + projection_mandatory_error: undefined, + select_projection: undefined, + upload_file: undefined, + data_infos_title: undefined, +}; diff --git a/assets/entrepot/pages/datasheet/DatasheetNew/DatasheetUploadForm.tsx b/assets/entrepot/pages/datasheet/DatasheetNew/DatasheetUploadForm.tsx index c1b85614..da73e950 100644 --- a/assets/entrepot/pages/datasheet/DatasheetNew/DatasheetUploadForm.tsx +++ b/assets/entrepot/pages/datasheet/DatasheetNew/DatasheetUploadForm.tsx @@ -20,7 +20,7 @@ import Progress from "../../../../components/Utils/Progress"; import Wait from "../../../../components/Utils/Wait"; import defaultProjections from "../../../../data/default_projections.json"; import ignfProjections from "../../../../data/ignf_projections.json"; -import { Translations, declareComponentKeys, useTranslation } from "../../../../i18n/i18n"; +import { useTranslation } from "../../../../i18n/i18n"; import FileUploader from "../../../../modules/FileUploader"; import RQKeys from "../../../../modules/entrepot/RQKeys"; import { routes, useRoute } from "../../../../router/router"; @@ -352,86 +352,3 @@ const DatasheetUploadForm: FC = ({ datastoreId }) => { DatasheetUploadForm.displayName = symToStr({ DatasheetUploadForm }); export default DatasheetUploadForm; - -// traductions -export const { i18n } = declareComponentKeys< - | { K: "title"; P: { datasheetName: string | undefined }; R: string } - | { K: "back_to"; P: { datasheetName: string | undefined }; R: string } - | "datasheet.name" - | "datasheet.name_hint" - | "datasheet.name_mandatory_error" - | "datasheet.name_max_length_error" - | "datasheet.name_regex_error" - | { K: "datasheet.name_already_exists_error"; P: { datasheetName: string }; R: string } - | "datasheet.creation_running" - | "upload" - | "upload_hint" - | "upload_nofile_error" - | { K: "upload_extension_error"; P: { filename: string }; R: string } - | { K: "upload_max_size_error"; P: { maxSize: number }; R: string } - | "upload_running" - | "technical_name" - | "technical_name_hint" - | "technical_name_mandatory_error" - | "projection" - | "projection_mandatory_error" - | "select_projection" - | "upload_file" - | "data_infos_title" ->()({ - DatasheetUploadForm, -}); - -export const DatasheetUploadFormFrTranslations: Translations<"fr">["DatasheetUploadForm"] = { - title: ({ datasheetName }) => (datasheetName === undefined ? "Créer une fiche de données" : "Ajouter un fichier de données"), - back_to: ({ datasheetName }) => (datasheetName === undefined ? "Retour à ma liste de données" : "Retour à ma fiche de données"), - "datasheet.name": "Nom de votre fiche de donnée", - "datasheet.name_hint": "Ce nom vous permettra d’identifier votre donnée dans la géoplateforme, soyez aussi clair que possible.", - "datasheet.name_mandatory_error": "Le nom de la donnée est obligatoire", - "datasheet.name_max_length_error": "Le nombre maximal de caractères pour le nom de la fiche de donnée est de 99", - "datasheet.name_regex_error": - "Le nom de la fiche de donnée ne peut contenir que des caractères alphanumériques, espaces blancs et certains caractères spéciaux", - "datasheet.name_already_exists_error": ({ datasheetName }) => `Une fiche de donnée existe déjà avec le nom "${datasheetName}"`, - "datasheet.creation_running": "Création de la fiche en cours ...", - upload: "Déposez votre fichier de données", - // NB: la taille maximale doit correspondre à celle effectivement implémentée dans DatasheetUploadForm - upload_hint: "Taille maximale : 1 Go. Formats de fichiers autorisés : Geopackage ou archive zip contenant un Geopackage (recommandé)", - upload_nofile_error: "Aucun fichier téléversé", - upload_extension_error: ({ filename }) => `L’extension du fichier ${filename} n'est pas correcte`, - upload_max_size_error: ({ maxSize }) => `La taille maximale pour un fichier est de ${maxSize}`, - upload_running: "Téléversement en cours ...", - technical_name: "Nom technique de votre donnée", - technical_name_hint: "Ce nom technique est invisible par votre utilisateur final. Il apparaitra uniquement dans votre espace de travail", - technical_name_mandatory_error: "Le nom technique de la donnée est obligatoire", - projection: "Projection de vos données", - projection_mandatory_error: "La projection (srid) est obligatoire", - select_projection: "Selectionnez une projection", - upload_file: "Déposer votre fichier", - data_infos_title: "Les données suivantes ont été détectées. Modifiez les si besoin", -}; - -export const DatasheetUploadFormEnTranslations: Translations<"en">["DatasheetUploadForm"] = { - title: undefined, - back_to: undefined, - "datasheet.name": undefined, - "datasheet.name_hint": undefined, - "datasheet.name_mandatory_error": undefined, - "datasheet.name_max_length_error": undefined, - "datasheet.name_regex_error": undefined, - "datasheet.name_already_exists_error": undefined, - "datasheet.creation_running": undefined, - upload: undefined, - upload_hint: undefined, - upload_nofile_error: undefined, - upload_extension_error: undefined, - upload_max_size_error: undefined, - upload_running: undefined, - technical_name: undefined, - technical_name_hint: undefined, - technical_name_mandatory_error: undefined, - projection: undefined, - projection_mandatory_error: undefined, - select_projection: undefined, - upload_file: undefined, - data_infos_title: undefined, -}; diff --git a/assets/entrepot/pages/datasheet/DatasheetNew/DatasheetUploadIntegration/DatasheetUploadIntegrationDialog.tsx b/assets/entrepot/pages/datasheet/DatasheetNew/DatasheetUploadIntegration/DatasheetUploadIntegrationDialog.tsx index 7c16fd68..7e5eb701 100644 --- a/assets/entrepot/pages/datasheet/DatasheetNew/DatasheetUploadIntegration/DatasheetUploadIntegrationDialog.tsx +++ b/assets/entrepot/pages/datasheet/DatasheetNew/DatasheetUploadIntegration/DatasheetUploadIntegrationDialog.tsx @@ -8,7 +8,7 @@ import RQKeys from "../../../../../modules/entrepot/RQKeys"; import Translator from "../../../../../modules/Translator"; import { routes } from "../../../../../router/router"; import api from "../../../../api"; -import { DatasheetViewActiveTabEnum } from "../../DatasheetView/DatasheetView"; +import { DatasheetViewActiveTabEnum } from "../../DatasheetView/DatasheetView/DatasheetView"; const getStepIcon = (status: string) => { let icon = ; diff --git a/assets/entrepot/pages/datasheet/DatasheetView/DatasetListTab/PyramidRasterList/PyramidRasterList.locale.tsx b/assets/entrepot/pages/datasheet/DatasheetView/DatasetListTab/PyramidRasterList/PyramidRasterList.locale.tsx new file mode 100644 index 00000000..94829adb --- /dev/null +++ b/assets/entrepot/pages/datasheet/DatasheetView/DatasetListTab/PyramidRasterList/PyramidRasterList.locale.tsx @@ -0,0 +1,50 @@ +import { declareComponentKeys } from "i18nifty"; + +import { Translations } from "../../../../../../i18n/types"; + +const { i18n } = declareComponentKeys< + | "show_linked_datas" + | "other_actions" + | "show_details" + | "publish_pyramid_raster" + | "choose_service_type" + | "wms_raster_label" + | "wms_raster_hint_text" + | "wmts_label" + | "wmts_hint_text" + | { K: "confirm_delete_modal.title"; P: { pyramidName: string }; R: string } + | "following_services_deleted" + | { K: "error_deleting"; P: { pyramidName: string }; R: string } +>()("PyramidRasterList"); +export type I18n = typeof i18n; + +export const PyramidRasterListFrTranslations: Translations<"fr">["PyramidRasterList"] = { + show_linked_datas: "Voir les données liées", + other_actions: "Autres actions", + show_details: "Voir les détails", + publish_pyramid_raster: "Publier", + choose_service_type: "Choisir le service à configurer", + wms_raster_hint_text: + "Création puis publication d'images à partir d'une pyramide de tuiles raster. Ce service s'appuie sur le protocole WMS en version 1.3.0.", + wms_raster_label: "Service d'images (Web Map Service - WMS)", + wmts_hint_text: "Création puis publication d'images à partir d'une pyramide de tuiles raster. Ce service s'appuie sur le protocole WMTS en version 1.0.0.", + wmts_label: "Services d'images tuilées (Web Map Tile Service - WMTS)", + "confirm_delete_modal.title": ({ pyramidName }) => `Êtes-vous sûr de vouloir supprimer la pyramide ${pyramidName} ?`, + following_services_deleted: "Les services suivants seront aussi supprimés :", + error_deleting: ({ pyramidName }) => `La suppression de la pyramide ${pyramidName} a échoué`, +}; + +export const PyramidRasterListEnTranslations: Translations<"en">["PyramidRasterList"] = { + show_linked_datas: "Show linked datas", + other_actions: "Other actions", + show_details: "Show details", + publish_pyramid_raster: "Publish", + choose_service_type: "Define service to create", + wms_raster_hint_text: undefined, + wms_raster_label: undefined, + wmts_hint_text: undefined, + wmts_label: undefined, + "confirm_delete_modal.title": ({ pyramidName }) => `Are you sure you want to delete pyramid ${pyramidName} ?`, + following_services_deleted: "The following services will be deleted :", + error_deleting: ({ pyramidName }) => `Deleting ${pyramidName} pyramid failed`, +}; diff --git a/assets/entrepot/pages/datasheet/DatasheetView/DatasetListTab/PyramidRasterList/PyramidRasterListItem.tsx b/assets/entrepot/pages/datasheet/DatasheetView/DatasetListTab/PyramidRasterList/PyramidRasterListItem.tsx index 0bf3aae3..b4cbeb0e 100644 --- a/assets/entrepot/pages/datasheet/DatasheetView/DatasetListTab/PyramidRasterList/PyramidRasterListItem.tsx +++ b/assets/entrepot/pages/datasheet/DatasheetView/DatasetListTab/PyramidRasterList/PyramidRasterListItem.tsx @@ -14,7 +14,7 @@ import LoadingText from "../../../../../../components/Utils/LoadingText"; import MenuList from "../../../../../../components/Utils/MenuList"; import Wait from "../../../../../../components/Utils/Wait"; import useToggle from "../../../../../../hooks/useToggle"; -import { declareComponentKeys, Translations, useTranslation } from "../../../../../../i18n/i18n"; +import { useTranslation } from "../../../../../../i18n/i18n"; import RQKeys from "../../../../../../modules/entrepot/RQKeys"; import { routes } from "../../../../../../router/router"; import { formatDateFromISO, offeringTypeDisplayName } from "../../../../../../utils"; @@ -48,7 +48,7 @@ type PyramidRasterListItemProps = { }; const PyramidRasterListItem: FC = ({ datasheetName, datastoreId, pyramid }) => { - const { t } = useTranslation({ PyramidRasterListItem }); + const { t } = useTranslation("PyramidRasterList"); const { t: tCommon } = useTranslation("Common"); const [showDescription, toggleShowDescription] = useToggle(false); @@ -263,52 +263,3 @@ const PyramidRasterListItem: FC = ({ datasheetName, }; export default memo(PyramidRasterListItem); - -// traductions -export const { i18n } = declareComponentKeys< - | "show_linked_datas" - | "other_actions" - | "show_details" - | "publish_pyramid_raster" - | "choose_service_type" - | "wms_raster_label" - | "wms_raster_hint_text" - | "wmts_label" - | "wmts_hint_text" - | { K: "confirm_delete_modal.title"; P: { pyramidName: string }; R: string } - | "following_services_deleted" - | { K: "error_deleting"; P: { pyramidName: string }; R: string } ->()({ - PyramidRasterListItem, -}); - -export const PyramidRasterListItemFrTranslations: Translations<"fr">["PyramidRasterListItem"] = { - show_linked_datas: "Voir les données liées", - other_actions: "Autres actions", - show_details: "Voir les détails", - publish_pyramid_raster: "Publier", - choose_service_type: "Choisir le service à configurer", - wms_raster_hint_text: - "Création puis publication d'images à partir d'une pyramide de tuiles raster. Ce service s'appuie sur le protocole WMS en version 1.3.0.", - wms_raster_label: "Service d'images (Web Map Service - WMS)", - wmts_hint_text: "Création puis publication d'images à partir d'une pyramide de tuiles raster. Ce service s'appuie sur le protocole WMTS en version 1.0.0.", - wmts_label: "Services d'images tuilées (Web Map Tile Service - WMTS)", - "confirm_delete_modal.title": ({ pyramidName }) => `Êtes-vous sûr de vouloir supprimer la pyramide ${pyramidName} ?`, - following_services_deleted: "Les services suivants seront aussi supprimés :", - error_deleting: ({ pyramidName }) => `La suppression de la pyramide ${pyramidName} a échoué`, -}; - -export const PyramidRasterListItemEnTranslations: Translations<"en">["PyramidRasterListItem"] = { - show_linked_datas: "Show linked datas", - other_actions: "Other actions", - show_details: "Show details", - publish_pyramid_raster: "Publish", - choose_service_type: "Define service to create", - wms_raster_hint_text: undefined, - wms_raster_label: undefined, - wmts_hint_text: undefined, - wmts_label: undefined, - "confirm_delete_modal.title": ({ pyramidName }) => `Are you sure you want to delete pyramid ${pyramidName} ?`, - following_services_deleted: "The following services will be deleted :", - error_deleting: ({ pyramidName }) => `Deleting ${pyramidName} pyramid failed`, -}; diff --git a/assets/entrepot/pages/datasheet/DatasheetView/DatasetListTab/PyramidVectorList/PyramidVectorList.locale.tsx b/assets/entrepot/pages/datasheet/DatasheetView/DatasetListTab/PyramidVectorList/PyramidVectorList.locale.tsx new file mode 100644 index 00000000..6b81a661 --- /dev/null +++ b/assets/entrepot/pages/datasheet/DatasheetView/DatasetListTab/PyramidVectorList/PyramidVectorList.locale.tsx @@ -0,0 +1,34 @@ +import { declareComponentKeys } from "i18nifty"; + +import { Translations } from "../../../../../../i18n/types"; + +const { i18n } = declareComponentKeys< + | "show_linked_datas" + | "other_actions" + | "show_details" + | "publish_tms_service" + | { K: "confirm_delete_modal.title"; P: { pyramidName: string }; R: string } + | "following_services_deleted" + | { K: "error_deleting"; P: { pyramidName: string }; R: string } +>()("PyramidVectorList"); +export type I18n = typeof i18n; + +export const PyramidVectorListFrTranslations: Translations<"fr">["PyramidVectorList"] = { + show_linked_datas: "Voir les données liées", + other_actions: "Autres actions", + show_details: "Voir les détails", + publish_tms_service: "Publier le service TMS", + "confirm_delete_modal.title": ({ pyramidName }) => `Êtes-vous sûr de vouloir supprimer la pyramide ${pyramidName} ?`, + following_services_deleted: "Les services suivants seront aussi supprimés :", + error_deleting: ({ pyramidName }) => `La suppression de la pyramide ${pyramidName} a échoué`, +}; + +export const PyramidVectorListEnTranslations: Translations<"en">["PyramidVectorList"] = { + show_linked_datas: "Show linked datas", + other_actions: "Other actions", + show_details: "Show details", + publish_tms_service: "Publish TMS service", + "confirm_delete_modal.title": ({ pyramidName }) => `Are you sure you want to delete pyramid ${pyramidName} ?`, + following_services_deleted: "The following services will be deleted :", + error_deleting: ({ pyramidName }) => `Deleting ${pyramidName} pyramid failed`, +}; diff --git a/assets/entrepot/pages/datasheet/DatasheetView/DatasetListTab/PyramidVectorList/PyramidVectorListItem.tsx b/assets/entrepot/pages/datasheet/DatasheetView/DatasetListTab/PyramidVectorList/PyramidVectorListItem.tsx index 5d049dad..0cce965a 100644 --- a/assets/entrepot/pages/datasheet/DatasheetView/DatasetListTab/PyramidVectorList/PyramidVectorListItem.tsx +++ b/assets/entrepot/pages/datasheet/DatasheetView/DatasetListTab/PyramidVectorList/PyramidVectorListItem.tsx @@ -14,7 +14,7 @@ import LoadingText from "../../../../../../components/Utils/LoadingText"; import MenuList from "../../../../../../components/Utils/MenuList"; import Wait from "../../../../../../components/Utils/Wait"; import useToggle from "../../../../../../hooks/useToggle"; -import { Translations, declareComponentKeys, getTranslation, useTranslation } from "../../../../../../i18n/i18n"; +import { getTranslation, useTranslation } from "../../../../../../i18n/i18n"; import RQKeys from "../../../../../../modules/entrepot/RQKeys"; import { routes } from "../../../../../../router/router"; import { formatDateFromISO, offeringTypeDisplayName } from "../../../../../../utils"; @@ -30,7 +30,7 @@ type PyramidVectorListItemProps = { const { t: tCommon } = getTranslation("Common"); const PyramidVectorListItem: FC = ({ datasheetName, datastoreId, pyramid }) => { - const { t } = useTranslation({ PyramidVectorListItem }); + const { t } = useTranslation("PyramidVectorList"); const [showDescription, toggleShowDescription] = useToggle(false); @@ -186,36 +186,3 @@ const PyramidVectorListItem: FC = ({ datasheetName, }; export default memo(PyramidVectorListItem); - -// traductions -export const { i18n } = declareComponentKeys< - | "show_linked_datas" - | "other_actions" - | "show_details" - | "publish_tms_service" - | { K: "confirm_delete_modal.title"; P: { pyramidName: string }; R: string } - | "following_services_deleted" - | { K: "error_deleting"; P: { pyramidName: string }; R: string } ->()({ - PyramidVectorListItem, -}); - -export const PyramidVectorListItemFrTranslations: Translations<"fr">["PyramidVectorListItem"] = { - show_linked_datas: "Voir les données liées", - other_actions: "Autres actions", - show_details: "Voir les détails", - publish_tms_service: "Publier le service TMS", - "confirm_delete_modal.title": ({ pyramidName }) => `Êtes-vous sûr de vouloir supprimer la pyramide ${pyramidName} ?`, - following_services_deleted: "Les services suivants seront aussi supprimés :", - error_deleting: ({ pyramidName }) => `La suppression de la pyramide ${pyramidName} a échoué`, -}; - -export const PyramidVectorListItemEnTranslations: Translations<"en">["PyramidVectorListItem"] = { - show_linked_datas: "Show linked datas", - other_actions: "Other actions", - show_details: "Show details", - publish_tms_service: "Publish TMS service", - "confirm_delete_modal.title": ({ pyramidName }) => `Are you sure you want to delete pyramid ${pyramidName} ?`, - following_services_deleted: "The following services will be deleted :", - error_deleting: ({ pyramidName }) => `Deleting ${pyramidName} pyramid failed`, -}; diff --git a/assets/entrepot/pages/datasheet/DatasheetView/DatasetListTab/VectorDbList/VectorDbList.locale.tsx b/assets/entrepot/pages/datasheet/DatasheetView/DatasetListTab/VectorDbList/VectorDbList.locale.tsx new file mode 100644 index 00000000..344c92bf --- /dev/null +++ b/assets/entrepot/pages/datasheet/DatasheetView/DatasetListTab/VectorDbList/VectorDbList.locale.tsx @@ -0,0 +1,70 @@ +import { declareComponentKeys } from "i18nifty"; +import { Translations } from "../../../../../../i18n/types"; + +const { i18n } = declareComponentKeys< + | "create_service" + | "define_service" + | "show_linked_datas" + | "other_actions" + | "replace_datas" + | "show_details" + | "tms_label" + | "wfs_label" + | "wmsv_label" + | "tms_hint_text" + | "wfs_hint_text" + | "wmsv_hint_text" + | "tile_technical_name" + | "tile_technical_name_hint_text" + | "technical_name_is_mandatory" + | { K: "confirm_delete_modal.title"; P: { dbname: string }; R: string } + | "following_services_deleted" + | { K: "error_deleting"; P: { dbname: string }; R: string } +>()("VectorDbList"); +export type I18n = typeof i18n; + +export const VectorDbListFrTranslations: Translations<"fr">["VectorDbList"] = { + create_service: "Créer un service", + define_service: "Choisir le service à configurer", + show_linked_datas: "Voir les données liées", + other_actions: "Autres actions", + replace_datas: "Remplacer les données", + show_details: "Voir les détails", + tms_label: "Service de tuiles vectorielles (Tile Map Service - TMS)", + wfs_label: "Service de sélection WFS (Web Feature Service - WFS)", + wmsv_label: "Service d’images (Web Map Service - WMS)", + tms_hint_text: + "Création puis publication d’une pyramide de tuiles vectorielles dont le rendu peut être personnalisable avec des fichiers de style proposés par vos soins ou définis par un utilisateur final. Ce service s'appuie sur le protocole TMS en version 1.0.0.", + wfs_hint_text: + "Création puis publication d’un service permettant de manipuler des objets géographiques. Ce service s'appuie sur le protocole WFS en version 2.0.0", + wmsv_hint_text: "Création puis publication d’images à partir de données vectorielles. Ce service s'appuie sur le protocole WMS en version 1.3.0", + tile_technical_name: "Nom technique de la pyramide de tuiles vectorielles", + tile_technical_name_hint_text: + "II s'agit du nom technique du service qui apparaitra dans votre espace de travail, il ne sera pas publié en ligne. Si vous le renommez, choisissez un nom explicite.", + technical_name_is_mandatory: "Le nom technique est obligatoire", + "confirm_delete_modal.title": ({ dbname }) => `Êtes-vous sûr de vouloir supprimer la base de données ${dbname} ?`, + following_services_deleted: "Les services suivants seront aussi supprimés :", + error_deleting: ({ dbname }) => `La suppression de la base de données ${dbname} a échoué`, +}; + +export const VectorDbListEnTranslations: Translations<"en">["VectorDbList"] = { + create_service: "Create service", + define_service: "Define service to create", + show_linked_datas: "Show linked datas", + other_actions: "Other actions", + replace_datas: "Replace datas", + show_details: "Show details", + tms_label: undefined, + wfs_label: undefined, + wmsv_label: undefined, + tms_hint_text: undefined, + wfs_hint_text: undefined, + wmsv_hint_text: undefined, + tile_technical_name: "Technical name of vector tile pyramid [TODO]", + tile_technical_name_hint_text: + "This is the technical name of the service which will appear in your workspace, it will not be published online. If you rename it, choose a meaningful name. [TODO]", + technical_name_is_mandatory: "Technical name is mandatory", + "confirm_delete_modal.title": ({ dbname }) => `Are you sure you want to delete database ${dbname} ?`, + following_services_deleted: "The following services will be deleted :", + error_deleting: ({ dbname }) => `Deleting ${dbname} database failed`, +}; diff --git a/assets/entrepot/pages/datasheet/DatasheetView/DatasetListTab/VectorDbList/VectorDbListItem.tsx b/assets/entrepot/pages/datasheet/DatasheetView/DatasetListTab/VectorDbList/VectorDbListItem.tsx index 089f3cfa..f1edf89e 100644 --- a/assets/entrepot/pages/datasheet/DatasheetView/DatasetListTab/VectorDbList/VectorDbListItem.tsx +++ b/assets/entrepot/pages/datasheet/DatasheetView/DatasetListTab/VectorDbList/VectorDbListItem.tsx @@ -19,7 +19,8 @@ import LoadingText from "../../../../../../components/Utils/LoadingText"; import MenuList from "../../../../../../components/Utils/MenuList"; import Wait from "../../../../../../components/Utils/Wait"; import useToggle from "../../../../../../hooks/useToggle"; -import { ComponentKey, Translations, declareComponentKeys, getTranslation, useTranslation } from "../../../../../../i18n/i18n"; +import { getTranslation, useTranslation } from "../../../../../../i18n/i18n"; +import { ComponentKey } from "../../../../../../i18n/types"; import RQKeys from "../../../../../../modules/entrepot/RQKeys"; import { routes } from "../../../../../../router/router"; import { formatDateFromISO, offeringTypeDisplayName } from "../../../../../../utils"; @@ -46,7 +47,7 @@ type QuotaType = { const getHintText = ( quotas: Record, type: EndpointDetailResponseDtoTypeEnum, - t: TranslationFunction<"VectorDbListItem", ComponentKey> + t: TranslationFunction<"VectorDbList", ComponentKey> ): JSX.Element => { const parts: { reactNode: ReactNode; @@ -97,7 +98,7 @@ const getHintText = ( }; const VectorDbListItem: FC = ({ datasheetName, datastoreId, vectorDb }) => { - const { t } = useTranslation({ VectorDbListItem }); + const { t } = useTranslation("VectorDbList"); // création d'un service const [serviceType, setServiceType] = useState(); @@ -407,73 +408,3 @@ const VectorDbListItem: FC = ({ datasheetName, datastoreI VectorDbListItem.displayName = symToStr({ VectorDbListItem }); export default memo(VectorDbListItem); - -// traductions -export const { i18n } = declareComponentKeys< - | "create_service" - | "define_service" - | "show_linked_datas" - | "other_actions" - | "replace_datas" - | "show_details" - | "tms_label" - | "wfs_label" - | "wmsv_label" - | "tms_hint_text" - | "wfs_hint_text" - | "wmsv_hint_text" - | "tile_technical_name" - | "tile_technical_name_hint_text" - | "technical_name_is_mandatory" - | { K: "confirm_delete_modal.title"; P: { dbname: string }; R: string } - | "following_services_deleted" - | { K: "error_deleting"; P: { dbname: string }; R: string } ->()({ - VectorDbListItem, -}); - -export const VectorDbListItemFrTranslations: Translations<"fr">["VectorDbListItem"] = { - create_service: "Créer un service", - define_service: "Choisir le service à configurer", - show_linked_datas: "Voir les données liées", - other_actions: "Autres actions", - replace_datas: "Remplacer les données", - show_details: "Voir les détails", - tms_label: "Service de tuiles vectorielles (Tile Map Service - TMS)", - wfs_label: "Service de sélection WFS (Web Feature Service - WFS)", - wmsv_label: "Service d’images (Web Map Service - WMS)", - tms_hint_text: - "Création puis publication d’une pyramide de tuiles vectorielles dont le rendu peut être personnalisable avec des fichiers de style proposés par vos soins ou définis par un utilisateur final. Ce service s'appuie sur le protocole TMS en version 1.0.0.", - wfs_hint_text: - "Création puis publication d’un service permettant de manipuler des objets géographiques. Ce service s'appuie sur le protocole WFS en version 2.0.0", - wmsv_hint_text: "Création puis publication d’images à partir de données vectorielles. Ce service s'appuie sur le protocole WMS en version 1.3.0", - tile_technical_name: "Nom technique de la pyramide de tuiles vectorielles", - tile_technical_name_hint_text: - "II s'agit du nom technique du service qui apparaitra dans votre espace de travail, il ne sera pas publié en ligne. Si vous le renommez, choisissez un nom explicite.", - technical_name_is_mandatory: "Le nom technique est obligatoire", - "confirm_delete_modal.title": ({ dbname }) => `Êtes-vous sûr de vouloir supprimer la base de données ${dbname} ?`, - following_services_deleted: "Les services suivants seront aussi supprimés :", - error_deleting: ({ dbname }) => `La suppression de la base de données ${dbname} a échoué`, -}; - -export const VectorDbListItemEnTranslations: Translations<"en">["VectorDbListItem"] = { - create_service: "Create service", - define_service: "Define service to create", - show_linked_datas: "Show linked datas", - other_actions: "Other actions", - replace_datas: "Replace datas", - show_details: "Show details", - tms_label: undefined, - wfs_label: undefined, - wmsv_label: undefined, - tms_hint_text: undefined, - wfs_hint_text: undefined, - wmsv_hint_text: undefined, - tile_technical_name: "Technical name of vector tile pyramid [TODO]", - tile_technical_name_hint_text: - "This is the technical name of the service which will appear in your workspace, it will not be published online. If you rename it, choose a meaningful name. [TODO]", - technical_name_is_mandatory: "Technical name is mandatory", - "confirm_delete_modal.title": ({ dbname }) => `Are you sure you want to delete database ${dbname} ?`, - following_services_deleted: "The following services will be deleted :", - error_deleting: ({ dbname }) => `Deleting ${dbname} database failed`, -}; diff --git a/assets/entrepot/pages/datasheet/DatasheetView/DatasheetThumbnail.tsx b/assets/entrepot/pages/datasheet/DatasheetView/DatasheetThumbnail.tsx index 8e3b3fc1..394a5924 100644 --- a/assets/entrepot/pages/datasheet/DatasheetView/DatasheetThumbnail.tsx +++ b/assets/entrepot/pages/datasheet/DatasheetView/DatasheetThumbnail.tsx @@ -16,7 +16,8 @@ import * as yup from "yup"; import type { Datasheet, DatasheetDetailed, DatasheetThumbnailAnnexe } from "../../../../@types/app"; import { ConfirmDialog, ConfirmDialogModal } from "../../../../components/Utils/ConfirmDialog"; import Wait from "../../../../components/Utils/Wait"; -import { ComponentKey, useTranslation } from "../../../../i18n/i18n"; +import { useTranslation } from "../../../../i18n/i18n"; +import { ComponentKey } from "../../../../i18n/types"; import RQKeys from "../../../../modules/entrepot/RQKeys"; import { CartesApiException } from "../../../../modules/jsonFetch"; import { getFileExtension } from "../../../../utils"; diff --git a/assets/entrepot/pages/datasheet/DatasheetView/DatasheetView/DatasheetView.locale.tsx b/assets/entrepot/pages/datasheet/DatasheetView/DatasheetView/DatasheetView.locale.tsx new file mode 100644 index 00000000..d7261ca7 --- /dev/null +++ b/assets/entrepot/pages/datasheet/DatasheetView/DatasheetView/DatasheetView.locale.tsx @@ -0,0 +1,226 @@ +import { declareComponentKeys } from "i18nifty"; +import { ThumbnailAction } from "../DatasheetThumbnail"; +import { DatasheetDocument, DatasheetDocumentTypeEnum } from "../../../../../@types/app"; +import { Translations } from "../../../../../i18n/types"; +import { getFileExtension } from "../../../../../utils"; + +const { i18n } = declareComponentKeys< + | "tab_label.metadata" + | { K: "tab_label.datasets"; P: { num: number }; R: string } + | { K: "tab_label.services"; P: { num: number }; R: string } + | { K: "tab_label.documents"; P: { num: number }; R: string } + | "datasheet.back_to_list" + | "datasheet.remove" + | { K: "datasheet.being_removed"; P: { datasheetName: string }; R: string } + | "file_validation.required_error" + | "file_validation.size_error" + | "file_validation.format_error" + | "button.title" + | "thumbnail_modal.title" + | "thumbnail_modal.file_hint" + | { K: "thumbnail_modal.action_being"; P: { action: ThumbnailAction }; R: string } + | { K: "thumbnail_action"; P: { action: ThumbnailAction }; R: string } + | "thumbnail_confirm_delete_modal.title" + | { K: "datasheet_confirm_delete_modal.title"; P: { datasheetName: string }; R: string } + | "datasheet_confirm_delete_modal.text" + | "metadata_tab.metadata.absent" + | "metadata_tab.metadata.is_loading" + | "documents_tab.documents_list.is_loading" + | "documents_tab.add_document" + | "documents_tab.add_document.type.label" + | { K: "documents_tab.add_document.type.options.label"; P: { docType: DatasheetDocumentTypeEnum }; R: string } + | "documents_tab.add_document.in_progress" + | "documents_tab.add_document.error.name_required" + | { K: "documents_tab.add_document.error.extention_incorrect"; P: { fileExtension: string; acceptedExtensions: string[] }; R: string } + | "documents_tab.add_document.error.extension_missing" + | "documents_tab.add_document.error.file_required" + | { K: "documents_tab.add_document.error.file_too_large"; P: { maxFileSize: number }; R: string } + | "documents_tab.add_document.error.url_required" + | "documents_tab.add_document.error.url_invalid" + | "documents_tab.add_document.name.label" + | "documents_tab.add_document.description.label" + | "documents_tab.add_document.file.label" + | { K: "documents_tab.add_document.file.hint"; P: { acceptedExtensions: string[] }; R: string } + | "documents_tab.add_document.link.label" + | { K: "documents_tab.delete_document.confirmation"; P: { display?: string }; R: string } + | "documents_tab.delete_document.in_progress" + | "documents_tab.list.no_documents" + | { K: "documents_tab.list.document_type"; P: { doc: DatasheetDocument }; R: string } + | { K: "documents_tab.edit_document"; P: { name?: string }; R: string } + | "documents_tab.edit_document.in_progress" +>()("DatasheetView"); +export type I18n = typeof i18n; + +export const DatasheetViewFrTranslations: Translations<"fr">["DatasheetView"] = { + "tab_label.metadata": "Métadonnées", + "tab_label.datasets": ({ num }) => `Jeux de données (${num})`, + "tab_label.services": ({ num }) => `Services (${num})`, + "tab_label.documents": ({ num }) => `Documents (${num})`, + "datasheet.back_to_list": "Retour à ma liste de données", + "datasheet.remove": "Supprimer la fiche de données", + "datasheet.being_removed": ({ datasheetName }) => `Suppression de la fiche de données ${datasheetName} en cours ...`, + "file_validation.required_error": "Aucun fichier n'a été choisi", + "file_validation.size_error": "La taille du fichier ne peut excéder 2 Mo", + "file_validation.format_error": "Le fichier doit être au format jpeg ou png", + "button.title": "Ajouter, modifier ou supprimer la vignette", + "thumbnail_modal.title": "Vignette pour la fiche de données", + "thumbnail_modal.file_hint": "Taille maximale : 2 Mo. Formats acceptés : jpg, png", + "thumbnail_modal.action_being": ({ action }) => { + switch (action) { + case "add": + return "Ajout de la vignette en cours ..."; + case "modify": + return "Remplacement de la vignette en cours ..."; + case "delete": + return "Suppression de la vignette en cours ..."; + } + }, + thumbnail_action: ({ action }) => { + switch (action) { + case "add": + return "Ajouter une vignette"; + case "modify": + return "Remplacer la vignette"; + case "delete": + return "Supprimer la vignette"; + } + }, + "thumbnail_confirm_delete_modal.title": "Êtes-vous sûr de vouloir supprimer la vignette de cette fiche de données ?", + "datasheet_confirm_delete_modal.title": ({ datasheetName }) => `Êtes-vous sûr de supprimer la fiche de données ${datasheetName} ?`, + "datasheet_confirm_delete_modal.text": "Les éléments suivants seront supprimés :", + "metadata_tab.metadata.absent": + "Les métadonnées de cette fiche ne sont pas encore disponibles. Créez un premier service à partir d’un de vos jeux de données pour les compléter.", + "metadata_tab.metadata.is_loading": "Les métadonnées sont en cours de chargement", + "documents_tab.documents_list.is_loading": "Les documents sont en cours de chargement", + "documents_tab.add_document": "Ajouter un document", + "documents_tab.add_document.type.label": "Type de document", + "documents_tab.add_document.type.options.label": ({ docType }) => { + switch (docType) { + case DatasheetDocumentTypeEnum.File: + return "Fichier"; + case DatasheetDocumentTypeEnum.Link: + return "Lien externe"; + } + }, + "documents_tab.add_document.in_progress": "Ajout de document en cours", + "documents_tab.add_document.error.name_required": "Le nom est obligatoire", + "documents_tab.add_document.error.extention_incorrect": ({ fileExtension, acceptedExtensions }) => { + let str = `L'extension ${fileExtension} n'est pas acceptée, `; + + if (acceptedExtensions.length === 1) { + str += ` l'extension acceptée est ${acceptedExtensions[0]}`; + } else { + const lastExtension = acceptedExtensions.pop(); + + str += `les extensions acceptées sont ${acceptedExtensions.join(", ")} et ${lastExtension}`; + } + + return str; + }, + "documents_tab.add_document.error.extension_missing": "Extension du fichier manquante", + "documents_tab.add_document.error.file_required": "Le fichier est obligatoire", + "documents_tab.add_document.error.file_too_large": ({ maxFileSize }) => `La taille du fichier téléversé ne peux excéder ${maxFileSize} Mo`, + "documents_tab.add_document.error.url_required": "L'URL est obligatoire", + "documents_tab.add_document.error.url_invalid": "L'URL est invalide", + "documents_tab.add_document.name.label": "Nom du document", + "documents_tab.add_document.description.label": "Description du document (optionnelle)", + "documents_tab.add_document.file.label": "Téléverser un fichier", + "documents_tab.add_document.file.hint": ({ acceptedExtensions }) => { + let acceptedExtensionsStr: string; + + if (acceptedExtensions.length === 1) { + acceptedExtensionsStr = acceptedExtensions[0]; + } else { + const lastExtension = acceptedExtensions.pop(); + acceptedExtensionsStr = `${acceptedExtensions.join(", ")} ou ${lastExtension}`; + } + + return `Fichier ${acceptedExtensionsStr} de moins de 5 Mo uniquement`; + }, + "documents_tab.add_document.link.label": "Lien vers le document", + "documents_tab.delete_document.confirmation": ({ display }) => `Êtes-vous sûr de vouloir supprimer le document ${display} ?`, + "documents_tab.delete_document.in_progress": "Suppression du document en cours", + "documents_tab.list.no_documents": "Il n'y a pas encore de documents liés à cette fiche de données.", + "documents_tab.list.document_type": ({ doc }) => { + if (doc.type === DatasheetDocumentTypeEnum.Link.valueOf()) { + return "Lien externe"; + } + + const fileExtension = getFileExtension(doc.url)?.toLowerCase(); + + switch (fileExtension) { + case "pdf": + return "PDF"; + case "qgz": + return "Projet QGIS"; + default: + return doc.type.toUpperCase(); + } + }, + "documents_tab.edit_document": ({ name }) => `Modifier le document ${name}`, + "documents_tab.edit_document.in_progress": "Modification du document en cours", +}; + +export const DatasheetViewEnTranslations: Translations<"en">["DatasheetView"] = { + "tab_label.metadata": "Metadata", + "tab_label.datasets": ({ num }) => `Datasets (${num})`, + "tab_label.services": ({ num }) => `Services (${num})`, + "tab_label.documents": ({ num }) => `Documents (${num})`, + "datasheet.back_to_list": "Back to my data list", + "datasheet.remove": "Delete datasheet", + "datasheet.being_removed": ({ datasheetName }) => `Datasheet ${datasheetName} being removed ...`, + "file_validation.required_error": "No files have been chosen", + "file_validation.size_error": "File size cannot exceed 2 MB", + "file_validation.format_error": "Format required for file is jpeg or png", + "button.title": "Add, modify or remove thumbnail", + "thumbnail_modal.title": "Datasheet thumbnail", + "thumbnail_modal.file_hint": "Max size : 2 Mo. Accepted formats : jpg, png", + "thumbnail_modal.action_being": ({ action }) => { + switch (action) { + case "add": + return "Thumbnail being added ..."; + case "modify": + return "Thumbnail being replaced ..."; + case "delete": + return "Thumbnail being deleted ..."; + } + }, + thumbnail_action: ({ action }) => { + switch (action) { + case "add": + return "Add thumbnail"; + case "modify": + return "Replace thumbnail"; + case "delete": + return "Delete thumbnail"; + } + }, + "thumbnail_confirm_delete_modal.title": "Are you sure you want to remove the thumbnail from this data sheet", + "datasheet_confirm_delete_modal.title": ({ datasheetName }) => `Are you sure you want to delete datasheet ${datasheetName} ?`, + "datasheet_confirm_delete_modal.text": "The following items will be deleted :", + "metadata_tab.metadata.absent": undefined, + "metadata_tab.metadata.is_loading": undefined, + "documents_tab.documents_list.is_loading": undefined, + "documents_tab.add_document": undefined, + "documents_tab.add_document.type.label": undefined, + "documents_tab.add_document.type.options.label": undefined, + "documents_tab.add_document.in_progress": undefined, + "documents_tab.add_document.error.name_required": undefined, + "documents_tab.add_document.error.extention_incorrect": undefined, + "documents_tab.add_document.error.extension_missing": undefined, + "documents_tab.add_document.error.file_required": undefined, + "documents_tab.add_document.error.file_too_large": undefined, + "documents_tab.add_document.error.url_required": undefined, + "documents_tab.add_document.error.url_invalid": undefined, + "documents_tab.add_document.name.label": undefined, + "documents_tab.add_document.description.label": undefined, + "documents_tab.add_document.file.label": undefined, + "documents_tab.add_document.file.hint": undefined, + "documents_tab.add_document.link.label": undefined, + "documents_tab.delete_document.confirmation": undefined, + "documents_tab.delete_document.in_progress": undefined, + "documents_tab.list.no_documents": undefined, + "documents_tab.list.document_type": undefined, + "documents_tab.edit_document": undefined, + "documents_tab.edit_document.in_progress": undefined, +}; diff --git a/assets/entrepot/pages/datasheet/DatasheetView/DatasheetView.tsx b/assets/entrepot/pages/datasheet/DatasheetView/DatasheetView/DatasheetView.tsx similarity index 50% rename from assets/entrepot/pages/datasheet/DatasheetView/DatasheetView.tsx rename to assets/entrepot/pages/datasheet/DatasheetView/DatasheetView/DatasheetView.tsx index dcbdc527..ae6c8584 100644 --- a/assets/entrepot/pages/datasheet/DatasheetView/DatasheetView.tsx +++ b/assets/entrepot/pages/datasheet/DatasheetView/DatasheetView/DatasheetView.tsx @@ -10,21 +10,20 @@ import { FC } from "react"; import { createPortal } from "react-dom"; import { symToStr } from "tsafe/symToStr"; -import { DatasheetDocumentTypeEnum, type Datasheet, type DatasheetDetailed, type DatasheetDocument, type Metadata } from "../../../../@types/app"; -import DatastoreLayout from "../../../../components/Layout/DatastoreLayout"; -import LoadingIcon from "../../../../components/Utils/LoadingIcon"; -import Wait from "../../../../components/Utils/Wait"; -import { Translations, declareComponentKeys, useTranslation } from "../../../../i18n/i18n"; -import RQKeys from "../../../../modules/entrepot/RQKeys"; -import { type CartesApiException } from "../../../../modules/jsonFetch"; -import { routes, useRoute } from "../../../../router/router"; -import { getFileExtension } from "../../../../utils"; -import api from "../../../api"; -import DatasetListTab from "./DatasetListTab/DatasetListTab"; -import DatasheetThumbnail, { type ThumbnailAction } from "./DatasheetThumbnail"; -import DocumentsTab from "./DocumentsTab/DocumentsTab"; -import MetadataTab from "./MetadataTab/MetadataTab"; -import ServicesListTab from "./ServiceListTab/ServicesListTab"; +import { type Datasheet, type DatasheetDetailed, type Metadata } from "../../../../../@types/app"; +import DatastoreLayout from "../../../../../components/Layout/DatastoreLayout"; +import LoadingIcon from "../../../../../components/Utils/LoadingIcon"; +import Wait from "../../../../../components/Utils/Wait"; +import { useTranslation } from "../../../../../i18n/i18n"; +import RQKeys from "../../../../../modules/entrepot/RQKeys"; +import { type CartesApiException } from "../../../../../modules/jsonFetch"; +import { routes, useRoute } from "../../../../../router/router"; +import api from "../../../../api"; +import DatasetListTab from "../DatasetListTab/DatasetListTab"; +import DatasheetThumbnail from "../DatasheetThumbnail"; +import DocumentsTab from "../DocumentsTab/DocumentsTab"; +import MetadataTab from "../MetadataTab/MetadataTab"; +import ServicesListTab from "../ServiceListTab/ServicesListTab"; const deleteDataConfirmModal = createModal({ id: "delete-data-confirm-modal", @@ -271,226 +270,3 @@ const DatasheetView: FC = ({ datastoreId, datasheetName }) = DatasheetView.displayName = symToStr({ DatasheetView }); export default DatasheetView; - -// Traductions -export const { i18n } = declareComponentKeys< - | "tab_label.metadata" - | { K: "tab_label.datasets"; P: { num: number }; R: string } - | { K: "tab_label.services"; P: { num: number }; R: string } - | { K: "tab_label.documents"; P: { num: number }; R: string } - | "datasheet.back_to_list" - | "datasheet.remove" - | { K: "datasheet.being_removed"; P: { datasheetName: string }; R: string } - | "file_validation.required_error" - | "file_validation.size_error" - | "file_validation.format_error" - | "button.title" - | "thumbnail_modal.title" - | "thumbnail_modal.file_hint" - | { K: "thumbnail_modal.action_being"; P: { action: ThumbnailAction }; R: string } - | { K: "thumbnail_action"; P: { action: ThumbnailAction }; R: string } - | "thumbnail_confirm_delete_modal.title" - | { K: "datasheet_confirm_delete_modal.title"; P: { datasheetName: string }; R: string } - | "datasheet_confirm_delete_modal.text" - | "metadata_tab.metadata.absent" - | "metadata_tab.metadata.is_loading" - | "documents_tab.documents_list.is_loading" - | "documents_tab.add_document" - | "documents_tab.add_document.type.label" - | { K: "documents_tab.add_document.type.options.label"; P: { docType: DatasheetDocumentTypeEnum }; R: string } - | "documents_tab.add_document.in_progress" - | "documents_tab.add_document.error.name_required" - | { K: "documents_tab.add_document.error.extention_incorrect"; P: { fileExtension: string; acceptedExtensions: string[] }; R: string } - | "documents_tab.add_document.error.extension_missing" - | "documents_tab.add_document.error.file_required" - | { K: "documents_tab.add_document.error.file_too_large"; P: { maxFileSize: number }; R: string } - | "documents_tab.add_document.error.url_required" - | "documents_tab.add_document.error.url_invalid" - | "documents_tab.add_document.name.label" - | "documents_tab.add_document.description.label" - | "documents_tab.add_document.file.label" - | { K: "documents_tab.add_document.file.hint"; P: { acceptedExtensions: string[] }; R: string } - | "documents_tab.add_document.link.label" - | { K: "documents_tab.delete_document.confirmation"; P: { display?: string }; R: string } - | "documents_tab.delete_document.in_progress" - | "documents_tab.list.no_documents" - | { K: "documents_tab.list.document_type"; P: { doc: DatasheetDocument }; R: string } - | { K: "documents_tab.edit_document"; P: { name?: string }; R: string } - | "documents_tab.edit_document.in_progress" ->()({ - DatasheetView, -}); - -export const DatasheetViewFrTranslations: Translations<"fr">["DatasheetView"] = { - "tab_label.metadata": "Métadonnées", - "tab_label.datasets": ({ num }) => `Jeux de données (${num})`, - "tab_label.services": ({ num }) => `Services (${num})`, - "tab_label.documents": ({ num }) => `Documents (${num})`, - "datasheet.back_to_list": "Retour à ma liste de données", - "datasheet.remove": "Supprimer la fiche de données", - "datasheet.being_removed": ({ datasheetName }) => `Suppression de la fiche de données ${datasheetName} en cours ...`, - "file_validation.required_error": "Aucun fichier n'a été choisi", - "file_validation.size_error": "La taille du fichier ne peut excéder 2 Mo", - "file_validation.format_error": "Le fichier doit être au format jpeg ou png", - "button.title": "Ajouter, modifier ou supprimer la vignette", - "thumbnail_modal.title": "Vignette pour la fiche de données", - "thumbnail_modal.file_hint": "Taille maximale : 2 Mo. Formats acceptés : jpg, png", - "thumbnail_modal.action_being": ({ action }) => { - switch (action) { - case "add": - return "Ajout de la vignette en cours ..."; - case "modify": - return "Remplacement de la vignette en cours ..."; - case "delete": - return "Suppression de la vignette en cours ..."; - } - }, - thumbnail_action: ({ action }) => { - switch (action) { - case "add": - return "Ajouter une vignette"; - case "modify": - return "Remplacer la vignette"; - case "delete": - return "Supprimer la vignette"; - } - }, - "thumbnail_confirm_delete_modal.title": "Êtes-vous sûr de vouloir supprimer la vignette de cette fiche de données ?", - "datasheet_confirm_delete_modal.title": ({ datasheetName }) => `Êtes-vous sûr de supprimer la fiche de données ${datasheetName} ?`, - "datasheet_confirm_delete_modal.text": "Les éléments suivants seront supprimés :", - "metadata_tab.metadata.absent": - "Les métadonnées de cette fiche ne sont pas encore disponibles. Créez un premier service à partir d’un de vos jeux de données pour les compléter.", - "metadata_tab.metadata.is_loading": "Les métadonnées sont en cours de chargement", - "documents_tab.documents_list.is_loading": "Les documents sont en cours de chargement", - "documents_tab.add_document": "Ajouter un document", - "documents_tab.add_document.type.label": "Type de document", - "documents_tab.add_document.type.options.label": ({ docType }) => { - switch (docType) { - case DatasheetDocumentTypeEnum.File: - return "Fichier"; - case DatasheetDocumentTypeEnum.Link: - return "Lien externe"; - } - }, - "documents_tab.add_document.in_progress": "Ajout de document en cours", - "documents_tab.add_document.error.name_required": "Le nom est obligatoire", - "documents_tab.add_document.error.extention_incorrect": ({ fileExtension, acceptedExtensions }) => { - let str = `L'extension ${fileExtension} n'est pas acceptée, `; - - if (acceptedExtensions.length === 1) { - str += ` l'extension acceptée est ${acceptedExtensions[0]}`; - } else { - const lastExtension = acceptedExtensions.pop(); - - str += `les extensions acceptées sont ${acceptedExtensions.join(", ")} et ${lastExtension}`; - } - - return str; - }, - "documents_tab.add_document.error.extension_missing": "Extension du fichier manquante", - "documents_tab.add_document.error.file_required": "Le fichier est obligatoire", - "documents_tab.add_document.error.file_too_large": ({ maxFileSize }) => `La taille du fichier téléversé ne peux excéder ${maxFileSize} Mo`, - "documents_tab.add_document.error.url_required": "L'URL est obligatoire", - "documents_tab.add_document.error.url_invalid": "L'URL est invalide", - "documents_tab.add_document.name.label": "Nom du document", - "documents_tab.add_document.description.label": "Description du document (optionnelle)", - "documents_tab.add_document.file.label": "Téléverser un fichier", - "documents_tab.add_document.file.hint": ({ acceptedExtensions }) => { - let acceptedExtensionsStr: string; - - if (acceptedExtensions.length === 1) { - acceptedExtensionsStr = acceptedExtensions[0]; - } else { - const lastExtension = acceptedExtensions.pop(); - acceptedExtensionsStr = `${acceptedExtensions.join(", ")} ou ${lastExtension}`; - } - - return `Fichier ${acceptedExtensionsStr} de moins de 5 Mo uniquement`; - }, - "documents_tab.add_document.link.label": "Lien vers le document", - "documents_tab.delete_document.confirmation": ({ display }) => `Êtes-vous sûr de vouloir supprimer le document ${display} ?`, - "documents_tab.delete_document.in_progress": "Suppression du document en cours", - "documents_tab.list.no_documents": "Il n'y a pas encore de documents liés à cette fiche de données.", - "documents_tab.list.document_type": ({ doc }) => { - if (doc.type === DatasheetDocumentTypeEnum.Link.valueOf()) { - return "Lien externe"; - } - - const fileExtension = getFileExtension(doc.url)?.toLowerCase(); - - switch (fileExtension) { - case "pdf": - return "PDF"; - case "qgz": - return "Projet QGIS"; - default: - return doc.type.toUpperCase(); - } - }, - "documents_tab.edit_document": ({ name }) => `Modifier le document ${name}`, - "documents_tab.edit_document.in_progress": "Modification du document en cours", -}; - -export const DatasheetViewEnTranslations: Translations<"en">["DatasheetView"] = { - "tab_label.metadata": "Metadata", - "tab_label.datasets": ({ num }) => `Datasets (${num})`, - "tab_label.services": ({ num }) => `Services (${num})`, - "tab_label.documents": ({ num }) => `Documents (${num})`, - "datasheet.back_to_list": "Back to my data list", - "datasheet.remove": "Delete datasheet", - "datasheet.being_removed": ({ datasheetName }) => `Datasheet ${datasheetName} being removed ...`, - "file_validation.required_error": "No files have been chosen", - "file_validation.size_error": "File size cannot exceed 2 MB", - "file_validation.format_error": "Format required for file is jpeg or png", - "button.title": "Add, modify or remove thumbnail", - "thumbnail_modal.title": "Datasheet thumbnail", - "thumbnail_modal.file_hint": "Max size : 2 Mo. Accepted formats : jpg, png", - "thumbnail_modal.action_being": ({ action }) => { - switch (action) { - case "add": - return "Thumbnail being added ..."; - case "modify": - return "Thumbnail being replaced ..."; - case "delete": - return "Thumbnail being deleted ..."; - } - }, - thumbnail_action: ({ action }) => { - switch (action) { - case "add": - return "Add thumbnail"; - case "modify": - return "Replace thumbnail"; - case "delete": - return "Delete thumbnail"; - } - }, - "thumbnail_confirm_delete_modal.title": "Are you sure you want to remove the thumbnail from this data sheet", - "datasheet_confirm_delete_modal.title": ({ datasheetName }) => `Are you sure you want to delete datasheet ${datasheetName} ?`, - "datasheet_confirm_delete_modal.text": "The following items will be deleted :", - "metadata_tab.metadata.absent": undefined, - "metadata_tab.metadata.is_loading": undefined, - "documents_tab.documents_list.is_loading": undefined, - "documents_tab.add_document": undefined, - "documents_tab.add_document.type.label": undefined, - "documents_tab.add_document.type.options.label": undefined, - "documents_tab.add_document.in_progress": undefined, - "documents_tab.add_document.error.name_required": undefined, - "documents_tab.add_document.error.extention_incorrect": undefined, - "documents_tab.add_document.error.extension_missing": undefined, - "documents_tab.add_document.error.file_required": undefined, - "documents_tab.add_document.error.file_too_large": undefined, - "documents_tab.add_document.error.url_required": undefined, - "documents_tab.add_document.error.url_invalid": undefined, - "documents_tab.add_document.name.label": undefined, - "documents_tab.add_document.description.label": undefined, - "documents_tab.add_document.file.label": undefined, - "documents_tab.add_document.file.hint": undefined, - "documents_tab.add_document.link.label": undefined, - "documents_tab.delete_document.confirmation": undefined, - "documents_tab.delete_document.in_progress": undefined, - "documents_tab.list.no_documents": undefined, - "documents_tab.list.document_type": undefined, - "documents_tab.edit_document": undefined, - "documents_tab.edit_document.in_progress": undefined, -}; diff --git a/assets/entrepot/pages/datastore/Confirmation.tsx b/assets/entrepot/pages/datastore/Confirmation.tsx index 5858767d..691d5721 100644 --- a/assets/entrepot/pages/datastore/Confirmation.tsx +++ b/assets/entrepot/pages/datastore/Confirmation.tsx @@ -2,7 +2,7 @@ import { fr } from "@codegouvfr/react-dsfr"; import Alert from "@codegouvfr/react-dsfr/Alert"; import Button from "@codegouvfr/react-dsfr/Button"; import AppLayout from "../../../components/Layout/AppLayout"; -import { datastoreNavItems } from "../../../config/datastoreNavItems"; +import { datastoreNavItems } from "../../../config/navItems/datastoreNavItems"; import Translator from "../../../modules/Translator"; import { routes } from "../../../router/router"; diff --git a/assets/entrepot/pages/datastore/DatastoreCreationForm.tsx b/assets/entrepot/pages/datastore/DatastoreCreationForm.tsx index 6c98f913..a65315ae 100644 --- a/assets/entrepot/pages/datastore/DatastoreCreationForm.tsx +++ b/assets/entrepot/pages/datastore/DatastoreCreationForm.tsx @@ -13,7 +13,7 @@ import { jsonFetch } from "../../../modules/jsonFetch"; import { removeDiacritics } from "../../../utils"; import Wait from "../../../components/Utils/Wait"; import Alert from "@codegouvfr/react-dsfr/Alert"; -import { datastoreNavItems } from "../../../config/datastoreNavItems"; +import { datastoreNavItems } from "../../../config/navItems/datastoreNavItems"; const DatastoreCreationForm: FC = () => { const schema = yup diff --git a/assets/entrepot/pages/datastore/ManagePermissions/DatastorePermissionsTr.ts b/assets/entrepot/pages/datastore/ManagePermissions/DatastorePermissions.locale.tsx similarity index 98% rename from assets/entrepot/pages/datastore/ManagePermissions/DatastorePermissionsTr.ts rename to assets/entrepot/pages/datastore/ManagePermissions/DatastorePermissions.locale.tsx index 8a578862..fc8421cc 100644 --- a/assets/entrepot/pages/datastore/ManagePermissions/DatastorePermissionsTr.ts +++ b/assets/entrepot/pages/datastore/ManagePermissions/DatastorePermissions.locale.tsx @@ -1,11 +1,12 @@ import { compareAsc } from "date-fns"; import { declareComponentKeys } from "i18nifty"; -import { Translations } from "../../../../i18n/i18n"; + import { DatastorePermissionResponseDto, PermissionBeneficiaryDto } from "../../../../@types/entrepot"; +import type { Translations } from "../../../../i18n/types"; import { formatDateFromISO } from "../../../../utils"; // traductions -export const { i18n } = declareComponentKeys< +const { i18n } = declareComponentKeys< | { K: "list.title"; P: { datastoreName?: string }; R: string } | "list.licence_header" | "list.expiration_date_header" @@ -48,6 +49,7 @@ export const { i18n } = declareComponentKeys< | { K: "info.granted_to"; P: { beneficiary?: PermissionBeneficiaryDto }; R: string } | "info.oauth_required" >()("DatastorePermissions"); +export type I18n = typeof i18n; const getExpiredDate = (lang: "fr" | "en", endDate?: string) => { if (endDate === undefined) { diff --git a/assets/entrepot/pages/datastore/ManagePermissions/ValidationSchemas.tsx b/assets/entrepot/pages/datastore/ManagePermissions/ValidationSchemas.tsx index 97f1f85b..5d9a75c8 100644 --- a/assets/entrepot/pages/datastore/ManagePermissions/ValidationSchemas.tsx +++ b/assets/entrepot/pages/datastore/ManagePermissions/ValidationSchemas.tsx @@ -1,8 +1,8 @@ +import { TranslationFunction } from "i18nifty/typeUtils/TranslationFunction"; import { isUUID } from "validator"; import * as yup from "yup"; import { PermissionCreateDtoTypeEnum } from "../../../../@types/entrepot"; -import { ComponentKey } from "../../../../i18n/i18n"; -import { TranslationFunction } from "i18nifty/typeUtils/TranslationFunction"; +import type { ComponentKey } from "../../../../i18n/types"; const types: string[] = Object.values(PermissionCreateDtoTypeEnum); diff --git a/assets/entrepot/pages/datastore/ManageStorage/DatastoreManageStorage.locale.tsx b/assets/entrepot/pages/datastore/ManageStorage/DatastoreManageStorage.locale.tsx new file mode 100644 index 00000000..6da9af05 --- /dev/null +++ b/assets/entrepot/pages/datastore/ManageStorage/DatastoreManageStorage.locale.tsx @@ -0,0 +1,239 @@ +import { declareComponentKeys } from "i18nifty"; +import { StoredDataTypeEnum, UploadTypeEnum } from "../../../../@types/app"; +import { Translations } from "../../../../i18n/types"; + +const { i18n } = declareComponentKeys< + // commun + | { K: "title"; P: { datastoreName?: string }; R: string } + | "explanation" + | "storage.not_found" + | "data.size.unknown" + | { K: "stored_data.type.title"; P: { type: StoredDataTypeEnum }; R: string } + + // FILESYSTEM + | { K: "storage.filesystem.label"; R: JSX.Element } + | "storage.filesystem.stored_data_list.loading" + | { K: "storage.filesystem.deletion.confirmation"; P: { storedDataName?: string; storedDataId?: string }; R: string } + | "storage.filesystem.deletion.in_progress" + | "storage.filesystem.explanation" + + // POSTGRES + | { K: "storage.postgresql.label"; R: JSX.Element } + | "storage.postgresql.vectordb.loading" + | { K: "storage.postgresql.deletion.confirmation"; P: { storedDataName?: string; storedDataId?: string }; R: string } + | "storage.postgresql.deletion.in_progress" + | "storage.postgresql.explanation" + + // S3 + | { K: "storage.s3.label"; R: JSX.Element } + | "storage.s3.stored_data_list.loading" + | { K: "storage.s3.deletion.confirmation"; P: { storedDataName?: string; storedDataId?: string }; R: string } + | "storage.s3.deletion.in_progress" + | "storage.s3.explanation" + + // upload + | { K: "storage.upload.label"; R: JSX.Element } + | "storage.upload.loading" + | { K: "storage.upload.deletion.confirmation"; P: { uploadName?: string; uploadId?: string }; R: string } + | "storage.upload.deletion.in_progress" + | "storage.upload.explanation" + | { K: "storage.upload.type.title"; P: { type: UploadTypeEnum }; R: string } + + // annexe + | { K: "storage.annexe.label"; R: JSX.Element } + | "storage.annexe.loading" + | { K: "storage.annexe.deletion.confirmation"; P: { annexeId?: string }; R: string } + | "storage.annexe.deletion.in_progress" + | "storage.annexe.explanation" + | { K: "storage.annexe.labels.type"; P: { type: string }; R: string } + + // endpoint + | { K: "storage.endpoints.label"; R: JSX.Element } + | "storage.endpoints.loading" + | { K: "storage.endpoints.deletion.confirmation"; P: { offeringName?: string; offeringId?: string }; R: string } + | "storage.endpoints.deletion.in_progress" + | "storage.endpoints.explanation" + + // endpoint metadata + | { K: "storage.endpoints.metadata.deletion.confirmation"; P: { metadataIdentifier?: string; metadataId?: string }; R: string } + | "storage.endpoints.metadata.deletion.in_progress" + + // statics + | { K: "storage.statics.label"; R: JSX.Element } + | "storage.statics.loading" + | { K: "storage.statics.deletion.confirmation"; P: { staticId?: string }; R: string } + | "storage.statics.deletion.in_progress" + | "storage.statics.explanation" +>()("DatastoreManageStorage"); +export type I18n = typeof i18n; + +export const DatastoreManageStorageFrTranslations: Translations<"fr">["DatastoreManageStorage"] = { + title: ({ datastoreName }) => `Suivi des consommations de l’espace de travail${datastoreName ? " " + datastoreName : ""}`, + explanation: + "Cette page vous permet de voir en un seul coup d'œil le volume de vos données et votre situation par rapport aux différents quotas qui vous sont alloués.", + "storage.not_found": "Aucun stockage de ce type n'est attribué à votre espace de travail.", + "data.size.unknown": "Taille inconnue", + "stored_data.type.title": ({ type }) => { + switch (type) { + case StoredDataTypeEnum.VECTORDB: + return "Données vectorielles en BD PostgreSQL"; + case StoredDataTypeEnum.ROK4PYRAMIDVECTOR: + return "Pyramide de tuiles vectorielles"; + case StoredDataTypeEnum.ROK4PYRAMIDRASTER: + return "Pyramide de tuiles raster"; + default: + return type; + } + }, + "storage.upload.type.title": ({ type }) => { + switch (type) { + case UploadTypeEnum.VECTOR: + return "Vecteur"; + case UploadTypeEnum.RASTER: + return "Raster"; + default: + return type; + } + }, + "storage.filesystem.label": ( + + Données intégrées sous
forme de fichiers +
+ ), + "storage.filesystem.stored_data_list.loading": "Chargement des données stockées sous forme de fichiers.", + "storage.filesystem.deletion.confirmation": ({ storedDataName, storedDataId }) => + `Êtes-vous sûr de vouloir supprimer la donnée stockée ${storedDataName} (${storedDataId}) ?`, + "storage.filesystem.deletion.in_progress": "Suppression de la donnée stockée en cours", + "storage.filesystem.explanation": "Cet espace est utilisé pour le stockage des pyramides de tuiles vectorielles.", + "storage.postgresql.label": ( + + Données intégrées
en base +
+ ), + "storage.postgresql.vectordb.loading": "Chargement des données vectorielles en BD PostgreSQL en cours", + "storage.postgresql.deletion.confirmation": ({ storedDataName, storedDataId }) => + `Êtes-vous sûr de vouloir supprimer la donnée stockée ${storedDataName} (${storedDataId}) ?`, + "storage.postgresql.deletion.in_progress": "Suppression de la donnée stockée en cours", + "storage.postgresql.explanation": + "Il s'agit de l’espace occupé par des données sur les serveurs PostgreSQL de votre espace de travail. Il s'agit de données intermédiaires qui ne sont pas directement visibles de vos utilisateurs.", + "storage.s3.label": ( + + Stockage
de masse +
+ ), + "storage.s3.stored_data_list.loading": "Chargement des données stockées dans le stockage de masse en cours", + "storage.s3.deletion.confirmation": ({ storedDataName, storedDataId }) => + `Êtes-vous sûr de vouloir supprimer la donnée stockée ${storedDataName} (${storedDataId}) ?`, + "storage.s3.deletion.in_progress": "Suppression de la donnée stockée en cours", + "storage.s3.explanation": + "Cet espace est utilisé pour le stockage des pyramides de tuiles vectorielles. Il est plus performant que le stockage sous forme de fichiers.", + "storage.upload.label": ( + + Données
déposées +
+ ), + "storage.upload.loading": "Chargement des données déposées en cours", + "storage.upload.deletion.confirmation": ({ uploadName, uploadId }) => `Êtes-vous sûr de vouloir supprimer la donnée déposée ${uploadName} (${uploadId}) ?`, + "storage.upload.deletion.in_progress": "Suppression de la donnée déposée en cours", + "storage.upload.explanation": + "Il s'agit de l’espace occupé par les fichiers de données bruts que vous avez téléversés (fichiers csv, geopackage...). Ces fichiers sont normalement supprimés dès l’intégration en base réussie de vos données. Il est possible qu'il reste des traces de fichiers dans cet espace lorsque les intégrations en base ont échoué.", + + "storage.annexe.label": ( + + Fichiers
annexes +
+ ), + "storage.annexe.loading": "Chargement des annexes", + "storage.annexe.deletion.confirmation": ({ annexeId }) => `Êtes-vous sûr de vouloir supprimer l’annexe ${annexeId} ?`, + "storage.annexe.deletion.in_progress": "Suppression de l’annexe en cours", + "storage.annexe.explanation": + "Cet espace est occupé par les fichiers mis à disposition de vos utilisateurs via des adresses publiques. Il s'agit généralement des fichiers de style au format JSON qui servent à symboliser vos pyramides de tuiles vectorielles.", + "storage.annexe.labels.type": ({ type }) => { + switch (type) { + case "style": + return "style"; + case "thumbnail": + return "vignette"; + default: + return type; + } + }, + "storage.endpoints.label": ( + + Points de
publication +
+ ), + "storage.endpoints.loading": "Chargement des flux publiés et des métadonnées en cours", + "storage.endpoints.deletion.confirmation": ({ offeringName, offeringId }) => `Êtes-vous sûr de vouloir dépublier le flux ${offeringName} (${offeringId}) ?`, + "storage.endpoints.deletion.in_progress": "Suppression du flux en cours", + "storage.endpoints.explanation": "Il s'agit du nombre de couches et de métadonnées publiées par point de publication dans votre espace de travail.", + + "storage.endpoints.metadata.deletion.confirmation": ({ metadataIdentifier, metadataId }) => + `Êtes-vous sûr de vouloir supprimer la métadonnée ${metadataIdentifier} (${metadataId}) ?`, + "storage.endpoints.metadata.deletion.in_progress": "Suppression de la métadonnée en cours", + + "storage.statics.label": ( + + Fichiers
statiques +
+ ), + "storage.statics.loading": "Chargement des fichiers statiques", + "storage.statics.deletion.confirmation": ({ staticId }) => `Êtes-vous sûr de vouloir supprimer le fichier statique ${staticId} ?`, + "storage.statics.deletion.in_progress": "Suppression du fichier statique en cours", + "storage.statics.explanation": + "Cet espace est occupé par des fichiers statiques. Il s'agit généralement des fichiers de styles au format SLD ou FTL déposés lors de la publication d'un service WMS-VECTOR.", +}; +export const DatastoreManageStorageEnTranslations: Translations<"en">["DatastoreManageStorage"] = { + title: undefined, + explanation: undefined, + "storage.not_found": undefined, + "data.size.unknown": undefined, + "stored_data.type.title": undefined, + "storage.upload.type.title": undefined, + + "storage.filesystem.label": undefined, + "storage.filesystem.stored_data_list.loading": undefined, + "storage.filesystem.deletion.confirmation": undefined, + "storage.filesystem.deletion.in_progress": undefined, + "storage.filesystem.explanation": undefined, + + "storage.postgresql.label": undefined, + "storage.postgresql.vectordb.loading": undefined, + "storage.postgresql.deletion.confirmation": undefined, + "storage.postgresql.deletion.in_progress": undefined, + "storage.postgresql.explanation": undefined, + + "storage.s3.label": undefined, + "storage.s3.stored_data_list.loading": undefined, + "storage.s3.deletion.confirmation": undefined, + "storage.s3.deletion.in_progress": undefined, + "storage.s3.explanation": undefined, + + "storage.upload.label": undefined, + "storage.upload.loading": undefined, + "storage.upload.deletion.confirmation": undefined, + "storage.upload.deletion.in_progress": undefined, + "storage.upload.explanation": undefined, + + "storage.annexe.label": undefined, + "storage.annexe.loading": undefined, + "storage.annexe.deletion.confirmation": undefined, + "storage.annexe.deletion.in_progress": undefined, + "storage.annexe.explanation": undefined, + "storage.annexe.labels.type": undefined, + + "storage.endpoints.label": undefined, + "storage.endpoints.loading": undefined, + "storage.endpoints.deletion.confirmation": undefined, + "storage.endpoints.deletion.in_progress": undefined, + "storage.endpoints.explanation": undefined, + + "storage.endpoints.metadata.deletion.confirmation": undefined, + "storage.endpoints.metadata.deletion.in_progress": undefined, + + "storage.statics.label": undefined, + "storage.statics.loading": undefined, + "storage.statics.deletion.confirmation": undefined, + "storage.statics.deletion.in_progress": undefined, + "storage.statics.explanation": undefined, +}; diff --git a/assets/entrepot/pages/datastore/ManageStorage/DatastoreManageStorage.tsx b/assets/entrepot/pages/datastore/ManageStorage/DatastoreManageStorage.tsx index 92eb1b57..9ddc67d7 100644 --- a/assets/entrepot/pages/datastore/ManageStorage/DatastoreManageStorage.tsx +++ b/assets/entrepot/pages/datastore/ManageStorage/DatastoreManageStorage.tsx @@ -1,13 +1,11 @@ import { fr } from "@codegouvfr/react-dsfr"; import Tabs, { TabsProps } from "@codegouvfr/react-dsfr/Tabs"; import { useQuery } from "@tanstack/react-query"; -import { declareComponentKeys } from "i18nifty"; -import { FC, JSX, useMemo } from "react"; +import { FC, useMemo } from "react"; -import { StoredDataTypeEnum, UploadTypeEnum } from "../../../../@types/app"; import DatastoreLayout from "../../../../components/Layout/DatastoreLayout"; import LoadingIcon from "../../../../components/Utils/LoadingIcon"; -import { useTranslation, type Translations } from "../../../../i18n/i18n"; +import { useTranslation } from "../../../../i18n/i18n"; import RQKeys from "../../../../modules/entrepot/RQKeys"; import api from "../../../api"; import AnnexeUsage from "./storages/AnnexeUsage"; @@ -97,240 +95,3 @@ const DatastoreManageStorage: FC = ({ datastoreId } }; export default DatastoreManageStorage; - -export const { i18n } = declareComponentKeys< - // commun - | { K: "title"; P: { datastoreName?: string }; R: string } - | "explanation" - | "storage.not_found" - | "data.size.unknown" - | { K: "stored_data.type.title"; P: { type: StoredDataTypeEnum }; R: string } - - // FILESYSTEM - | { K: "storage.filesystem.label"; R: JSX.Element } - | "storage.filesystem.stored_data_list.loading" - | { K: "storage.filesystem.deletion.confirmation"; P: { storedDataName?: string; storedDataId?: string }; R: string } - | "storage.filesystem.deletion.in_progress" - | "storage.filesystem.explanation" - - // POSTGRES - | { K: "storage.postgresql.label"; R: JSX.Element } - | "storage.postgresql.vectordb.loading" - | { K: "storage.postgresql.deletion.confirmation"; P: { storedDataName?: string; storedDataId?: string }; R: string } - | "storage.postgresql.deletion.in_progress" - | "storage.postgresql.explanation" - - // S3 - | { K: "storage.s3.label"; R: JSX.Element } - | "storage.s3.stored_data_list.loading" - | { K: "storage.s3.deletion.confirmation"; P: { storedDataName?: string; storedDataId?: string }; R: string } - | "storage.s3.deletion.in_progress" - | "storage.s3.explanation" - - // upload - | { K: "storage.upload.label"; R: JSX.Element } - | "storage.upload.loading" - | { K: "storage.upload.deletion.confirmation"; P: { uploadName?: string; uploadId?: string }; R: string } - | "storage.upload.deletion.in_progress" - | "storage.upload.explanation" - | { K: "storage.upload.type.title"; P: { type: UploadTypeEnum }; R: string } - - // annexe - | { K: "storage.annexe.label"; R: JSX.Element } - | "storage.annexe.loading" - | { K: "storage.annexe.deletion.confirmation"; P: { annexeId?: string }; R: string } - | "storage.annexe.deletion.in_progress" - | "storage.annexe.explanation" - | { K: "storage.annexe.labels.type"; P: { type: string }; R: string } - - // endpoint - | { K: "storage.endpoints.label"; R: JSX.Element } - | "storage.endpoints.loading" - | { K: "storage.endpoints.deletion.confirmation"; P: { offeringName?: string; offeringId?: string }; R: string } - | "storage.endpoints.deletion.in_progress" - | "storage.endpoints.explanation" - - // endpoint metadata - | { K: "storage.endpoints.metadata.deletion.confirmation"; P: { metadataIdentifier?: string; metadataId?: string }; R: string } - | "storage.endpoints.metadata.deletion.in_progress" - - // statics - | { K: "storage.statics.label"; R: JSX.Element } - | "storage.statics.loading" - | { K: "storage.statics.deletion.confirmation"; P: { staticId?: string }; R: string } - | "storage.statics.deletion.in_progress" - | "storage.statics.explanation" ->()({ - DatastoreManageStorage, -}); - -export const DatastoreManageStorageFrTranslations: Translations<"fr">["DatastoreManageStorage"] = { - title: ({ datastoreName }) => `Suivi des consommations de l’espace de travail${datastoreName ? " " + datastoreName : ""}`, - explanation: - "Cette page vous permet de voir en un seul coup d'œil le volume de vos données et votre situation par rapport aux différents quotas qui vous sont alloués.", - "storage.not_found": "Aucun stockage de ce type n'est attribué à votre espace de travail.", - "data.size.unknown": "Taille inconnue", - "stored_data.type.title": ({ type }) => { - switch (type) { - case StoredDataTypeEnum.VECTORDB: - return "Données vectorielles en BD PostgreSQL"; - case StoredDataTypeEnum.ROK4PYRAMIDVECTOR: - return "Pyramide de tuiles vectorielles"; - case StoredDataTypeEnum.ROK4PYRAMIDRASTER: - return "Pyramide de tuiles raster"; - default: - return type; - } - }, - "storage.upload.type.title": ({ type }) => { - switch (type) { - case UploadTypeEnum.VECTOR: - return "Vecteur"; - case UploadTypeEnum.RASTER: - return "Raster"; - default: - return type; - } - }, - "storage.filesystem.label": ( - - Données intégrées sous
forme de fichiers -
- ), - "storage.filesystem.stored_data_list.loading": "Chargement des données stockées sous forme de fichiers.", - "storage.filesystem.deletion.confirmation": ({ storedDataName, storedDataId }) => - `Êtes-vous sûr de vouloir supprimer la donnée stockée ${storedDataName} (${storedDataId}) ?`, - "storage.filesystem.deletion.in_progress": "Suppression de la donnée stockée en cours", - "storage.filesystem.explanation": "Cet espace est utilisé pour le stockage des pyramides de tuiles vectorielles.", - "storage.postgresql.label": ( - - Données intégrées
en base -
- ), - "storage.postgresql.vectordb.loading": "Chargement des données vectorielles en BD PostgreSQL en cours", - "storage.postgresql.deletion.confirmation": ({ storedDataName, storedDataId }) => - `Êtes-vous sûr de vouloir supprimer la donnée stockée ${storedDataName} (${storedDataId}) ?`, - "storage.postgresql.deletion.in_progress": "Suppression de la donnée stockée en cours", - "storage.postgresql.explanation": - "Il s'agit de l’espace occupé par des données sur les serveurs PostgreSQL de votre espace de travail. Il s'agit de données intermédiaires qui ne sont pas directement visibles de vos utilisateurs.", - "storage.s3.label": ( - - Stockage
de masse -
- ), - "storage.s3.stored_data_list.loading": "Chargement des données stockées dans le stockage de masse en cours", - "storage.s3.deletion.confirmation": ({ storedDataName, storedDataId }) => - `Êtes-vous sûr de vouloir supprimer la donnée stockée ${storedDataName} (${storedDataId}) ?`, - "storage.s3.deletion.in_progress": "Suppression de la donnée stockée en cours", - "storage.s3.explanation": - "Cet espace est utilisé pour le stockage des pyramides de tuiles vectorielles. Il est plus performant que le stockage sous forme de fichiers.", - "storage.upload.label": ( - - Données
déposées -
- ), - "storage.upload.loading": "Chargement des données déposées en cours", - "storage.upload.deletion.confirmation": ({ uploadName, uploadId }) => `Êtes-vous sûr de vouloir supprimer la donnée déposée ${uploadName} (${uploadId}) ?`, - "storage.upload.deletion.in_progress": "Suppression de la donnée déposée en cours", - "storage.upload.explanation": - "Il s'agit de l’espace occupé par les fichiers de données bruts que vous avez téléversés (fichiers csv, geopackage...). Ces fichiers sont normalement supprimés dès l’intégration en base réussie de vos données. Il est possible qu'il reste des traces de fichiers dans cet espace lorsque les intégrations en base ont échoué.", - - "storage.annexe.label": ( - - Fichiers
annexes -
- ), - "storage.annexe.loading": "Chargement des annexes", - "storage.annexe.deletion.confirmation": ({ annexeId }) => `Êtes-vous sûr de vouloir supprimer l’annexe ${annexeId} ?`, - "storage.annexe.deletion.in_progress": "Suppression de l’annexe en cours", - "storage.annexe.explanation": - "Cet espace est occupé par les fichiers mis à disposition de vos utilisateurs via des adresses publiques. Il s'agit généralement des fichiers de style au format JSON qui servent à symboliser vos pyramides de tuiles vectorielles.", - "storage.annexe.labels.type": ({ type }) => { - switch (type) { - case "style": - return "style"; - case "thumbnail": - return "vignette"; - default: - return type; - } - }, - "storage.endpoints.label": ( - - Points de
publication -
- ), - "storage.endpoints.loading": "Chargement des flux publiés et des métadonnées en cours", - "storage.endpoints.deletion.confirmation": ({ offeringName, offeringId }) => `Êtes-vous sûr de vouloir dépublier le flux ${offeringName} (${offeringId}) ?`, - "storage.endpoints.deletion.in_progress": "Suppression du flux en cours", - "storage.endpoints.explanation": "Il s'agit du nombre de couches et de métadonnées publiées par point de publication dans votre espace de travail.", - - "storage.endpoints.metadata.deletion.confirmation": ({ metadataIdentifier, metadataId }) => - `Êtes-vous sûr de vouloir supprimer la métadonnée ${metadataIdentifier} (${metadataId}) ?`, - "storage.endpoints.metadata.deletion.in_progress": "Suppression de la métadonnée en cours", - - "storage.statics.label": ( - - Fichiers
statiques -
- ), - "storage.statics.loading": "Chargement des fichiers statiques", - "storage.statics.deletion.confirmation": ({ staticId }) => `Êtes-vous sûr de vouloir supprimer le fichier statique ${staticId} ?`, - "storage.statics.deletion.in_progress": "Suppression du fichier statique en cours", - "storage.statics.explanation": - "Cet espace est occupé par des fichiers statiques. Il s'agit généralement des fichiers de styles au format SLD ou FTL déposés lors de la publication d'un service WMS-VECTOR.", -}; -export const DatastoreManageStorageEnTranslations: Translations<"en">["DatastoreManageStorage"] = { - title: undefined, - explanation: undefined, - "storage.not_found": undefined, - "data.size.unknown": undefined, - "stored_data.type.title": undefined, - "storage.upload.type.title": undefined, - - "storage.filesystem.label": undefined, - "storage.filesystem.stored_data_list.loading": undefined, - "storage.filesystem.deletion.confirmation": undefined, - "storage.filesystem.deletion.in_progress": undefined, - "storage.filesystem.explanation": undefined, - - "storage.postgresql.label": undefined, - "storage.postgresql.vectordb.loading": undefined, - "storage.postgresql.deletion.confirmation": undefined, - "storage.postgresql.deletion.in_progress": undefined, - "storage.postgresql.explanation": undefined, - - "storage.s3.label": undefined, - "storage.s3.stored_data_list.loading": undefined, - "storage.s3.deletion.confirmation": undefined, - "storage.s3.deletion.in_progress": undefined, - "storage.s3.explanation": undefined, - - "storage.upload.label": undefined, - "storage.upload.loading": undefined, - "storage.upload.deletion.confirmation": undefined, - "storage.upload.deletion.in_progress": undefined, - "storage.upload.explanation": undefined, - - "storage.annexe.label": undefined, - "storage.annexe.loading": undefined, - "storage.annexe.deletion.confirmation": undefined, - "storage.annexe.deletion.in_progress": undefined, - "storage.annexe.explanation": undefined, - "storage.annexe.labels.type": undefined, - - "storage.endpoints.label": undefined, - "storage.endpoints.loading": undefined, - "storage.endpoints.deletion.confirmation": undefined, - "storage.endpoints.deletion.in_progress": undefined, - "storage.endpoints.explanation": undefined, - - "storage.endpoints.metadata.deletion.confirmation": undefined, - "storage.endpoints.metadata.deletion.in_progress": undefined, - - "storage.statics.label": undefined, - "storage.statics.loading": undefined, - "storage.statics.deletion.confirmation": undefined, - "storage.statics.deletion.in_progress": undefined, - "storage.statics.explanation": undefined, -}; diff --git a/assets/entrepot/pages/service/common/AccessRestrictions/AccessRestrictions.locale.tsx b/assets/entrepot/pages/service/common/AccessRestrictions/AccessRestrictions.locale.tsx new file mode 100644 index 00000000..62deba39 --- /dev/null +++ b/assets/entrepot/pages/service/common/AccessRestrictions/AccessRestrictions.locale.tsx @@ -0,0 +1,44 @@ +import { declareComponentKeys } from "i18nifty"; +import { Translations } from "../../../../../i18n/types"; + +const { i18n } = declareComponentKeys< + | "title" + | "share_with" + | "share_with_all_public" + | "share_with_all_public_hint_text" + | "share_with_your_community" + | "share_with_your_community_hint_text" + | "share_with_value_change_warning_title" + | "share_with_value_change_warning_desc_restricted_to_public" + | "share_with_value_change_warning_desc_public_to_restricted" +>()("AccessRestrictions"); +export type I18n = typeof i18n; + +export const AccessRestrictionsFrTranslations: Translations<"fr">["AccessRestrictions"] = { + title: "Restrictions d’accès", + share_with: "A quel public souhaitez-vous que ce service soit accessible ?", + share_with_all_public: "Tout public", + share_with_all_public_hint_text: "Le service sera accessible à tout utilisateur sans restriction.", + share_with_your_community: "Restreint", + share_with_your_community_hint_text: + "Vous devrez accorder une permission aux communautés et/ou utilisateurs souhaités pour leur autoriser l’accès. Ils devront par la suite configurer une clé à partir de cette permission pour accéder au service. Une permission va être créée automatiquement votre propre communauté.", + share_with_value_change_warning_title: "Changement de restrictions d’accès", + share_with_value_change_warning_desc_restricted_to_public: + // eslint-disable-next-line quotes + 'Vous êtes sur le point de modifier les restrictions d\'accès de "Restreint" à "Tout public". Le service changera d\'adresse et les permissions que vous aviez configurées seront supprimées définitivement car elles ne seront plus nécessaires.', + share_with_value_change_warning_desc_public_to_restricted: + // eslint-disable-next-line quotes + 'Vous êtes sur le point de modifier les restrictions d\'accès de "Tout public" à "Restreint". Le service changera d\'adresse.', +}; + +export const AccessRestrictionsEnTranslations: Translations<"en">["AccessRestrictions"] = { + title: undefined, + share_with: undefined, + share_with_all_public: undefined, + share_with_all_public_hint_text: undefined, + share_with_your_community: undefined, + share_with_your_community_hint_text: undefined, + share_with_value_change_warning_title: undefined, + share_with_value_change_warning_desc_restricted_to_public: undefined, + share_with_value_change_warning_desc_public_to_restricted: undefined, +}; diff --git a/assets/entrepot/pages/service/AccessRestrictions.tsx b/assets/entrepot/pages/service/common/AccessRestrictions/AccessRestrictions.tsx similarity index 61% rename from assets/entrepot/pages/service/AccessRestrictions.tsx rename to assets/entrepot/pages/service/common/AccessRestrictions/AccessRestrictions.tsx index 7300a16c..8ab24b30 100644 --- a/assets/entrepot/pages/service/AccessRestrictions.tsx +++ b/assets/entrepot/pages/service/common/AccessRestrictions/AccessRestrictions.tsx @@ -1,15 +1,14 @@ import { fr } from "@codegouvfr/react-dsfr"; +import Alert from "@codegouvfr/react-dsfr/Alert"; import RadioButtons from "@codegouvfr/react-dsfr/RadioButtons"; import { useQuery } from "@tanstack/react-query"; -import { declareComponentKeys } from "i18nifty"; import { FC, useMemo } from "react"; import { UseFormReturn } from "react-hook-form"; -import { DatastoreEndpoint, EndpointTypeEnum, Service, ServiceFormValuesBaseType } from "../../../@types/app"; -import { Translations, useTranslation } from "../../../i18n/i18n"; -import RQKeys from "../../../modules/entrepot/RQKeys"; -import api from "../../api"; -import Alert from "@codegouvfr/react-dsfr/Alert"; +import { DatastoreEndpoint, EndpointTypeEnum, Service, ServiceFormValuesBaseType } from "../../../../../@types/app"; +import { useTranslation } from "../../../../../i18n/i18n"; +import RQKeys from "../../../../../modules/entrepot/RQKeys"; +import api from "../../../../api"; type AccessRestrictionProps = { datastoreId: string; @@ -110,46 +109,3 @@ const AccessRestrictions: FC = ({ datastoreId, endpointT }; export default AccessRestrictions; - -export const { i18n } = declareComponentKeys< - | "title" - | "share_with" - | "share_with_all_public" - | "share_with_all_public_hint_text" - | "share_with_your_community" - | "share_with_your_community_hint_text" - | "share_with_value_change_warning_title" - | "share_with_value_change_warning_desc_restricted_to_public" - | "share_with_value_change_warning_desc_public_to_restricted" ->()({ - AccessRestrictions, -}); - -export const AccessRestrictionsFrTranslations: Translations<"fr">["AccessRestrictions"] = { - title: "Restrictions d’accès", - share_with: "A quel public souhaitez-vous que ce service soit accessible ?", - share_with_all_public: "Tout public", - share_with_all_public_hint_text: "Le service sera accessible à tout utilisateur sans restriction.", - share_with_your_community: "Restreint", - share_with_your_community_hint_text: - "Vous devrez accorder une permission aux communautés et/ou utilisateurs souhaités pour leur autoriser l’accès. Ils devront par la suite configurer une clé à partir de cette permission pour accéder au service. Une permission va être créée automatiquement votre propre communauté.", - share_with_value_change_warning_title: "Changement de restrictions d’accès", - share_with_value_change_warning_desc_restricted_to_public: - // eslint-disable-next-line quotes - 'Vous êtes sur le point de modifier les restrictions d\'accès de "Restreint" à "Tout public". Le service changera d\'adresse et les permissions que vous aviez configurées seront supprimées définitivement car elles ne seront plus nécessaires.', - share_with_value_change_warning_desc_public_to_restricted: - // eslint-disable-next-line quotes - 'Vous êtes sur le point de modifier les restrictions d\'accès de "Tout public" à "Restreint". Le service changera d\'adresse.', -}; - -export const AccessRestrictionsEnTranslations: Translations<"en">["AccessRestrictions"] = { - title: undefined, - share_with: undefined, - share_with_all_public: undefined, - share_with_all_public_hint_text: undefined, - share_with_your_community: undefined, - share_with_your_community_hint_text: undefined, - share_with_value_change_warning_title: undefined, - share_with_value_change_warning_desc_restricted_to_public: undefined, - share_with_value_change_warning_desc_public_to_restricted: undefined, -}; diff --git a/assets/entrepot/pages/service/common/TableSelection/TableSelection.locale.tsx b/assets/entrepot/pages/service/common/TableSelection/TableSelection.locale.tsx new file mode 100644 index 00000000..05f5495d --- /dev/null +++ b/assets/entrepot/pages/service/common/TableSelection/TableSelection.locale.tsx @@ -0,0 +1,15 @@ +import { declareComponentKeys } from "i18nifty"; +import { Translations } from "../../../../../i18n/types"; + +const { i18n } = declareComponentKeys<"title" | { K: "tables_detected_hint"; P: { nbTables: number }; R: string }>()("TableSelection"); +export type I18n = typeof i18n; + +export const TableSelectionFrTranslations: Translations<"fr">["TableSelection"] = { + title: "Sélectionnez les tables nécessaires au service", + tables_detected_hint: ({ nbTables }) => (nbTables > 1 ? `${nbTables} tables détectées` : "1 table détectée"), +}; + +export const TableSelectionEnTranslations: Translations<"en">["TableSelection"] = { + title: undefined, + tables_detected_hint: undefined, +}; diff --git a/assets/entrepot/pages/service/TableSelection.tsx b/assets/entrepot/pages/service/common/TableSelection/TableSelection.tsx similarity index 73% rename from assets/entrepot/pages/service/TableSelection.tsx rename to assets/entrepot/pages/service/common/TableSelection/TableSelection.tsx index d267dd5c..b65601cc 100644 --- a/assets/entrepot/pages/service/TableSelection.tsx +++ b/assets/entrepot/pages/service/common/TableSelection/TableSelection.tsx @@ -3,11 +3,11 @@ import { Checkbox } from "@codegouvfr/react-dsfr/Checkbox"; import { FC, useCallback, useMemo } from "react"; import { useWatch, type UseFormReturn } from "react-hook-form"; -import { filterGeometricRelations } from "../../../helpers"; -import { type Translations, declareComponentKeys, useTranslation } from "../../../i18n/i18n"; -import { type VectorDb } from "../../../@types/app"; -import { type PyramidVectorGenerateFormValuesType } from "./tms/PyramidVectorGenerateForm"; -import { type WmsVectorServiceFormValuesType } from "./wms-vector/WmsVectorServiceForm"; +import { type VectorDb } from "../../../../../@types/app"; +import { filterGeometricRelations } from "../../../../../helpers"; +import { useTranslation } from "../../../../../i18n/i18n"; +import { type PyramidVectorGenerateFormValuesType } from "../../tms/PyramidVectorGenerateForm"; +import { type WmsVectorServiceFormValuesType } from "../../wms-vector/WmsVectorServiceForm"; type TablesSelectionProps = { filterGeometric?: boolean; @@ -78,17 +78,3 @@ const TableSelection: FC = ({ filterGeometric = false, vec }; export default TableSelection; - -export const { i18n } = declareComponentKeys<"title" | { K: "tables_detected_hint"; P: { nbTables: number }; R: string }>()({ - TableSelection, -}); - -export const TableSelectionFrTranslations: Translations<"fr">["TableSelection"] = { - title: "Sélectionnez les tables nécessaires au service", - tables_detected_hint: ({ nbTables }) => (nbTables > 1 ? `${nbTables} tables détectées` : "1 table détectée"), -}; - -export const TableSelectionEnTranslations: Translations<"en">["TableSelection"] = { - title: undefined, - tables_detected_hint: undefined, -}; diff --git a/assets/entrepot/pages/service/common-schemas-validation.ts b/assets/entrepot/pages/service/common/common-schemas-validation.ts similarity index 97% rename from assets/entrepot/pages/service/common-schemas-validation.ts rename to assets/entrepot/pages/service/common/common-schemas-validation.ts index 91590d67..ad39c304 100644 --- a/assets/entrepot/pages/service/common-schemas-validation.ts +++ b/assets/entrepot/pages/service/common/common-schemas-validation.ts @@ -1,8 +1,8 @@ import * as yup from "yup"; -import { getTranslation } from "../../../i18n/i18n"; -import { regex } from "../../../utils"; -import validations from "../../../validations"; +import { getTranslation } from "../../../../i18n/i18n"; +import { regex } from "../../../../utils"; +import validations from "../../../../validations"; const { t: tValidMD } = getTranslation("ValidationMetadatas"); export class CommonSchemasValidation { diff --git a/assets/entrepot/pages/service/default-values.ts b/assets/entrepot/pages/service/common/default-values.ts similarity index 95% rename from assets/entrepot/pages/service/default-values.ts rename to assets/entrepot/pages/service/common/default-values.ts index 3f6f7998..eef5c95b 100644 --- a/assets/entrepot/pages/service/default-values.ts +++ b/assets/entrepot/pages/service/common/default-values.ts @@ -1,11 +1,11 @@ import { format as datefnsFormat } from "date-fns"; -import { EndpointTypeEnum, Metadata, MetadataFormValuesType, MetadataHierarchyLevel, Service, StoredData } from "../../../@types/app"; -import { ConfigurationWfsDetailsContent, ConfigurationWmsVectorDetailsContent, ConfigurationWmtsTmsDetailsContent } from "../../../@types/entrepot"; -import { getProjectionCode, removeDiacritics } from "../../../utils"; -import { PyramidVectorTmsServiceFormValuesType } from "./tms/PyramidVectorTmsServiceForm"; -import { WfsServiceFormValuesType, WfsTableInfos } from "./wfs/WfsServiceForm"; -import { WmsVectorServiceFormValuesType } from "./wms-vector/WmsVectorServiceForm"; +import { EndpointTypeEnum, Metadata, MetadataFormValuesType, MetadataHierarchyLevel, Service, StoredData } from "../../../../@types/app"; +import { ConfigurationWfsDetailsContent, ConfigurationWmsVectorDetailsContent, ConfigurationWmtsTmsDetailsContent } from "../../../../@types/entrepot"; +import { getProjectionCode, removeDiacritics } from "../../../../utils"; +import { PyramidVectorTmsServiceFormValuesType } from "../tms/PyramidVectorTmsServiceForm/PyramidVectorTmsServiceForm"; +import { WfsServiceFormValuesType, WfsTableInfos } from "../wfs/WfsServiceForm"; +import { WmsVectorServiceFormValuesType } from "../wms-vector/WmsVectorServiceForm"; const DEFAULT_CHARSET = "utf8"; const DEFAULT_LANGUAGE = { language: "français", code: "fre" }; diff --git a/assets/entrepot/pages/service/metadatas/AdditionalInfo.tsx b/assets/entrepot/pages/service/metadata/AdditionalInfo.tsx similarity index 100% rename from assets/entrepot/pages/service/metadatas/AdditionalInfo.tsx rename to assets/entrepot/pages/service/metadata/AdditionalInfo.tsx diff --git a/assets/entrepot/pages/service/metadatas/Description.tsx b/assets/entrepot/pages/service/metadata/Description.tsx similarity index 100% rename from assets/entrepot/pages/service/metadatas/Description.tsx rename to assets/entrepot/pages/service/metadata/Description.tsx diff --git a/assets/entrepot/pages/service/metadatas/metadatas-form-tr.tsx b/assets/entrepot/pages/service/metadata/MetadataForm.locale.tsx similarity index 98% rename from assets/entrepot/pages/service/metadatas/metadatas-form-tr.tsx rename to assets/entrepot/pages/service/metadata/MetadataForm.locale.tsx index de838290..2047785b 100644 --- a/assets/entrepot/pages/service/metadatas/metadatas-form-tr.tsx +++ b/assets/entrepot/pages/service/metadata/MetadataForm.locale.tsx @@ -1,6 +1,7 @@ -import { declareComponentKeys, type Translations } from "../../../../i18n/i18n"; +import { declareComponentKeys } from "../../../../i18n/i18n"; +import { Translations } from "../../../../i18n/types"; -export const { i18n } = declareComponentKeys< +const { i18n } = declareComponentKeys< | "metadata.upload_form.title" | "metadata.upload_form.drag_and_drop_file" | "metadata.upload_form.used_format" @@ -56,6 +57,7 @@ export const { i18n } = declareComponentKeys< | "metadata.additionnal_infos_form.spatial_resolution" | { K: "metadata.additionnal_infos_form.hint_spatial_resolution"; R: JSX.Element } >()("MetadatasForm"); +export type I18n = typeof i18n; export const MetadatasFormFrTranslations: Translations<"fr">["MetadatasForm"] = { "metadata.upload_form.title": "Source des metadonnées", diff --git a/assets/entrepot/pages/service/metadatas/metadatas-validation-tr.ts b/assets/entrepot/pages/service/metadata/MetadataValidation.locale.tsx similarity index 94% rename from assets/entrepot/pages/service/metadatas/metadatas-validation-tr.ts rename to assets/entrepot/pages/service/metadata/MetadataValidation.locale.tsx index 00481bab..93a60235 100644 --- a/assets/entrepot/pages/service/metadatas/metadatas-validation-tr.ts +++ b/assets/entrepot/pages/service/metadata/MetadataValidation.locale.tsx @@ -1,12 +1,7 @@ -import { declareComponentKeys, type Translations } from "../../../../i18n/i18n"; +import { declareComponentKeys } from "../../../../i18n/i18n"; +import { Translations } from "../../../../i18n/types"; -const ValidationMetadatas = () => { - return null; -}; - -export default ValidationMetadatas; - -export const { i18n } = declareComponentKeys< +const { i18n } = declareComponentKeys< | "metadatas.technical_name_error" | "metadatas.technical_name_regex" | "metadatas.technical_name_unicity_error" @@ -30,9 +25,8 @@ export const { i18n } = declareComponentKeys< | "attribution.url_required_error" | "attribution.url_error" | "share_with_error" ->()({ - ValidationMetadatas, -}); +>()("ValidationMetadatas"); +export type I18n = typeof i18n; export const ValidationMetadatasFrTranslations: Translations<"fr">["ValidationMetadatas"] = { "metadatas.technical_name_error": "Le nom technique est obligatoire", diff --git a/assets/entrepot/pages/service/metadatas/UploadMDFile.tsx b/assets/entrepot/pages/service/metadata/UploadMDFile.tsx similarity index 100% rename from assets/entrepot/pages/service/metadatas/UploadMDFile.tsx rename to assets/entrepot/pages/service/metadata/UploadMDFile.tsx diff --git a/assets/entrepot/pages/service/tms/PyramidVectorGenerateForm.tsx b/assets/entrepot/pages/service/tms/PyramidVectorGenerateForm.tsx index 8b01c7a5..b718e5a1 100644 --- a/assets/entrepot/pages/service/tms/PyramidVectorGenerateForm.tsx +++ b/assets/entrepot/pages/service/tms/PyramidVectorGenerateForm.tsx @@ -20,7 +20,7 @@ import RQKeys from "../../../../modules/entrepot/RQKeys"; import { CartesApiException } from "../../../../modules/jsonFetch"; import { routes } from "../../../../router/router"; import api from "../../../api"; -import TableSelection from "../TableSelection"; +import TableSelection from "../common/TableSelection/TableSelection"; import formatForm from "./format-form"; import Sample, { type SampleType } from "./sample/Sample"; import TableAttributeSelection from "./tables/TableAttributeSelection"; diff --git a/assets/entrepot/pages/service/tms/PyramidVectorTmsServiceForm/PyramidVectorTmsServiceForm.locale.tsx b/assets/entrepot/pages/service/tms/PyramidVectorTmsServiceForm/PyramidVectorTmsServiceForm.locale.tsx new file mode 100644 index 00000000..9ba78805 --- /dev/null +++ b/assets/entrepot/pages/service/tms/PyramidVectorTmsServiceForm/PyramidVectorTmsServiceForm.locale.tsx @@ -0,0 +1,62 @@ +import { declareComponentKeys } from "i18nifty"; +import { Translations } from "../../../../../i18n/types"; + +const { i18n } = declareComponentKeys< + | { K: "title"; P: { editMode: boolean }; R: string } + | "stored_data.loading" + | "stored_data_and_offering.loading" + | "stored_data.fetch_failed" + | "offering.fetch_failed" + | { K: "step.title"; P: { stepNumber: number }; R: string } + | "previous_step" + | "continue" + | "publish" + | "publish.in_progress" + | "modify.in_progress" + | "back_to_data_list" +>()("PyramidVectorTmsServiceForm"); +export type I18n = typeof i18n; + +export const PyramidVectorTmsServiceFormFrTranslations: Translations<"fr">["PyramidVectorTmsServiceForm"] = { + title: ({ editMode }) => (editMode ? "Modifier le service TMS" : "Publier un service TMS"), + "stored_data.loading": "Chargement de la donnée stockée...", + "stored_data_and_offering.loading": "Chargement de la donnée stockée et du service à modifier...", + "stored_data.fetch_failed": "Récupération des informations sur la donnée stockée a échoué", + "offering.fetch_failed": "Récupération des informations sur le service à modifier a échoué", + "step.title": ({ stepNumber }) => { + switch (stepNumber) { + case 1: + return "Source des métadonnées"; + case 2: + return "Description de la ressource"; + case 3: + return "Informations supplémentaires"; + case 4: + return "Restrictions d’accès"; + + default: + return ""; + } + }, + previous_step: "Étape précédente", + continue: "Continuer", + publish: "Publier le service maintenant", + "publish.in_progress": "Création du service TMS en cours", + "modify.in_progress": "Modification des informations du service TMS en cours", + back_to_data_list: "Retour à mes données", +}; + +export const PyramidVectorTmsServiceFormEnTranslations: Translations<"en">["PyramidVectorTmsServiceForm"] = { + title: undefined, + "stored_data.loading": undefined, + "stored_data_and_offering.loading": undefined, + "stored_data.fetch_failed": undefined, + "offering.fetch_failed": undefined, + "step.title": undefined, + previous_step: undefined, + continue: undefined, + publish: undefined, + "publish.in_progress": undefined, + "modify.in_progress": undefined, + back_to_data_list: undefined, +}; diff --git a/assets/entrepot/pages/service/tms/PyramidVectorTmsServiceForm.tsx b/assets/entrepot/pages/service/tms/PyramidVectorTmsServiceForm/PyramidVectorTmsServiceForm.tsx similarity index 78% rename from assets/entrepot/pages/service/tms/PyramidVectorTmsServiceForm.tsx rename to assets/entrepot/pages/service/tms/PyramidVectorTmsServiceForm/PyramidVectorTmsServiceForm.tsx index 6ba76f46..8a6e0eb5 100644 --- a/assets/entrepot/pages/service/tms/PyramidVectorTmsServiceForm.tsx +++ b/assets/entrepot/pages/service/tms/PyramidVectorTmsServiceForm/PyramidVectorTmsServiceForm.tsx @@ -5,27 +5,26 @@ import ButtonsGroup from "@codegouvfr/react-dsfr/ButtonsGroup"; import Stepper from "@codegouvfr/react-dsfr/Stepper"; import { yupResolver } from "@hookform/resolvers/yup"; import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query"; -import { declareComponentKeys } from "i18nifty"; import { FC, useCallback, useMemo, useState } from "react"; import { useForm } from "react-hook-form"; -import { ConfigurationTypeEnum, EndpointTypeEnum, PyramidVector, Service, ServiceFormValuesBaseType } from "../../../../@types/app"; -import DatastoreLayout from "../../../../components/Layout/DatastoreLayout"; -import LoadingIcon from "../../../../components/Utils/LoadingIcon"; -import LoadingText from "../../../../components/Utils/LoadingText"; -import Wait from "../../../../components/Utils/Wait"; -import useScrollToTopEffect from "../../../../hooks/useScrollToTopEffect"; -import { Translations, useTranslation } from "../../../../i18n/i18n"; -import RQKeys from "../../../../modules/entrepot/RQKeys"; -import { CartesApiException } from "../../../../modules/jsonFetch"; -import { routes } from "../../../../router/router"; -import api from "../../../api"; -import AccessRestrictions from "../AccessRestrictions"; -import { CommonSchemasValidation } from "../common-schemas-validation"; -import { getPyramidVectorTmsServiceFormDefaultValues } from "../default-values"; -import AdditionalInfo from "../metadatas/AdditionalInfo"; -import Description from "../metadatas/Description"; -import UploadMDFile from "../metadatas/UploadMDFile"; +import { ConfigurationTypeEnum, EndpointTypeEnum, PyramidVector, Service, ServiceFormValuesBaseType } from "../../../../../@types/app"; +import DatastoreLayout from "../../../../../components/Layout/DatastoreLayout"; +import LoadingIcon from "../../../../../components/Utils/LoadingIcon"; +import LoadingText from "../../../../../components/Utils/LoadingText"; +import Wait from "../../../../../components/Utils/Wait"; +import useScrollToTopEffect from "../../../../../hooks/useScrollToTopEffect"; +import { useTranslation } from "../../../../../i18n/i18n"; +import RQKeys from "../../../../../modules/entrepot/RQKeys"; +import { CartesApiException } from "../../../../../modules/jsonFetch"; +import { routes } from "../../../../../router/router"; +import api from "../../../../api"; +import AccessRestrictions from "../../common/AccessRestrictions/AccessRestrictions"; +import { CommonSchemasValidation } from "../../common/common-schemas-validation"; +import { getPyramidVectorTmsServiceFormDefaultValues } from "../../common/default-values"; +import AdditionalInfo from "../../metadata/AdditionalInfo"; +import Description from "../../metadata/Description"; +import UploadMDFile from "../../metadata/UploadMDFile"; export type PyramidVectorTmsServiceFormValuesType = ServiceFormValuesBaseType; @@ -280,58 +279,3 @@ const PyramidVectorTmsServiceForm: FC = ({ dat }; export default PyramidVectorTmsServiceForm; - -export const { i18n } = declareComponentKeys< - | { K: "title"; P: { editMode: boolean }; R: string } - | "stored_data.loading" - | "stored_data_and_offering.loading" - | "stored_data.fetch_failed" - | "offering.fetch_failed" - | { K: "step.title"; P: { stepNumber: number }; R: string } - | "publish" - | "publish.in_progress" - | "modify.in_progress" - | "back_to_data_list" ->()({ - PyramidVectorTmsServiceForm, -}); - -export const PyramidVectorTmsServiceFormFrTranslations: Translations<"fr">["PyramidVectorTmsServiceForm"] = { - title: ({ editMode }) => (editMode ? "Modifier le service TMS" : "Publier un service TMS"), - "stored_data.loading": "Chargement de la donnée stockée", - "stored_data_and_offering.loading": "Chargement de la donnée stockée et du service à modifier", - "stored_data.fetch_failed": "Récupération des informations sur la donnée stockée a échoué", - "offering.fetch_failed": "Récupération des informations sur le service à modifier a échoué", - "step.title": ({ stepNumber }) => { - switch (stepNumber) { - case 1: - return "Source des métadonnées"; - case 2: - return "Description de la ressource"; - case 3: - return "Informations supplémentaires"; - case 4: - return "Restrictions d’accès"; - - default: - return ""; - } - }, - publish: "Publier le service maintenant", - "publish.in_progress": "Création du service TMS en cours", - "modify.in_progress": "Modification des informations du service TMS en cours", - back_to_data_list: "Retour à mes données", -}; - -export const PyramidVectorTmsServiceFormEnTranslations: Translations<"en">["PyramidVectorTmsServiceForm"] = { - title: undefined, - "stored_data.loading": undefined, - "stored_data_and_offering.loading": undefined, - "stored_data.fetch_failed": undefined, - "offering.fetch_failed": undefined, - "step.title": undefined, - publish: undefined, - "publish.in_progress": undefined, - "modify.in_progress": undefined, - back_to_data_list: undefined, -}; diff --git a/assets/i18n/Style.tsx b/assets/entrepot/pages/service/view/Style/Style.locale.tsx similarity index 88% rename from assets/i18n/Style.tsx rename to assets/entrepot/pages/service/view/Style/Style.locale.tsx index 661328ae..f9948412 100644 --- a/assets/i18n/Style.tsx +++ b/assets/entrepot/pages/service/view/Style/Style.locale.tsx @@ -1,6 +1,7 @@ -import { declareComponentKeys, type Translations } from "./i18n"; +import { declareComponentKeys } from "../../../../../i18n"; +import { type Translations } from "../../../../../i18n/types"; -export const { i18n } = declareComponentKeys< +const { i18n } = declareComponentKeys< | "my_styles" | "add_style" | { K: "add_file"; P: { format: string }; R: string } @@ -8,6 +9,7 @@ export const { i18n } = declareComponentKeys< | { K: "remove_style"; P: { styleName: string | undefined }; R: string } | "qml_message" >()("Style"); +export type I18n = typeof i18n; export const StyleFrTranslations: Translations<"fr">["Style"] = { my_styles: "Mes styles :", diff --git a/assets/entrepot/pages/service/wfs/WfsServiceForm.locale.tsx b/assets/entrepot/pages/service/wfs/WfsServiceForm.locale.tsx new file mode 100644 index 00000000..6dccf1ba --- /dev/null +++ b/assets/entrepot/pages/service/wfs/WfsServiceForm.locale.tsx @@ -0,0 +1,70 @@ +import { declareComponentKeys } from "i18nifty"; +import { Translations } from "../../../../i18n/types"; + +const { i18n } = declareComponentKeys< + | { K: "title"; P: { editMode: boolean }; R: string } + | "stored_data.loading" + | "stored_data_and_offering.loading" + | "stored_data.fetch_failed" + | "offering.fetch_failed" + | { K: "step.title"; P: { stepNumber: number }; R: string } + | "previous_step" + | "continue" + | "publish" + | "publish.in_progress" + | "modify.in_progress" + | "back_to_data_list" + | "trimmed_error" + | "public_name_regex" +>()("WfsServiceForm"); +export type I18n = typeof i18n; + +export const WfsServiceFormFrTranslations: Translations<"fr">["WfsServiceForm"] = { + title: ({ editMode }) => (editMode ? "Modifier le service WFS" : "Créer et publier un service WFS"), + "stored_data.loading": "Chargement de la donnée stockée...", + "stored_data_and_offering.loading": "Chargement de la donnée stockée et du service à modifier...", + "stored_data.fetch_failed": "Récupération des informations sur la donnée stockée a échoué", + "offering.fetch_failed": "Récupération des informations sur le service à modifier a échoué", + "step.title": ({ stepNumber }) => { + switch (stepNumber) { + case 1: + return "Tables"; + case 2: + return "Source des métadonnées"; + case 3: + return "Description de la ressource"; + case 4: + return "Informations supplémentaires"; + case 5: + return "Restrictions d'accès"; + default: + return ""; + } + }, + previous_step: "Étape précédente", + continue: "Continuer", + publish: "Publier le service maintenant", + "publish.in_progress": "Création du service WFS en cours", + "modify.in_progress": "Modification des informations du service WFS en cours", + back_to_data_list: "Retour à mes données", + trimmed_error: "La chaîne de caractères ne doit contenir aucun espace en début et fin", + public_name_regex: + "Le nom public de la table ne doit contenir que des lettres, chiffres, tirets (-), underscores (_), ou points (.) et ne peut commencer que par une lettre ou un underscore", +}; + +export const WfsServiceFormEnTranslations: Translations<"en">["WfsServiceForm"] = { + title: undefined, + "stored_data.loading": undefined, + "stored_data_and_offering.loading": undefined, + "stored_data.fetch_failed": undefined, + "offering.fetch_failed": undefined, + "step.title": undefined, + previous_step: undefined, + continue: undefined, + publish: undefined, + "publish.in_progress": undefined, + "modify.in_progress": undefined, + back_to_data_list: undefined, + trimmed_error: undefined, + public_name_regex: undefined, +}; diff --git a/assets/entrepot/pages/service/wfs/WfsServiceForm.tsx b/assets/entrepot/pages/service/wfs/WfsServiceForm.tsx index bb492061..1a3caae4 100644 --- a/assets/entrepot/pages/service/wfs/WfsServiceForm.tsx +++ b/assets/entrepot/pages/service/wfs/WfsServiceForm.tsx @@ -5,7 +5,6 @@ import ButtonsGroup from "@codegouvfr/react-dsfr/ButtonsGroup"; import Stepper from "@codegouvfr/react-dsfr/Stepper"; import { yupResolver } from "@hookform/resolvers/yup"; import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query"; -import { declareComponentKeys } from "i18nifty"; import { FC, useCallback, useMemo, useState } from "react"; import { useForm, useWatch } from "react-hook-form"; import { symToStr } from "tsafe/symToStr"; @@ -18,18 +17,18 @@ import LoadingText from "../../../../components/Utils/LoadingText"; import Wait from "../../../../components/Utils/Wait"; import { filterGeometricRelations } from "../../../../helpers"; import useScrollToTopEffect from "../../../../hooks/useScrollToTopEffect"; -import { Translations, useTranslation } from "../../../../i18n/i18n"; +import { useTranslation } from "../../../../i18n/i18n"; import RQKeys from "../../../../modules/entrepot/RQKeys"; import { CartesApiException } from "../../../../modules/jsonFetch"; import { routes } from "../../../../router/router"; import { trimObject } from "../../../../utils"; import api from "../../../api"; -import AccessRestrictions from "../AccessRestrictions"; -import { CommonSchemasValidation } from "../common-schemas-validation"; -import { getWfsServiceFormDefaultValues } from "../default-values"; -import AdditionalInfo from "../metadatas/AdditionalInfo"; -import Description from "../metadatas/Description"; -import UploadMDFile from "../metadatas/UploadMDFile"; +import AccessRestrictions from "../common/AccessRestrictions/AccessRestrictions"; +import { CommonSchemasValidation } from "../common/common-schemas-validation"; +import { getWfsServiceFormDefaultValues } from "../common/default-values"; +import AdditionalInfo from "../metadata/AdditionalInfo"; +import Description from "../metadata/Description"; +import UploadMDFile from "../metadata/UploadMDFile"; import TableInfosForm from "./TablesInfoForm"; import { regex } from "../../../../utils"; @@ -391,72 +390,3 @@ const WfsServiceForm: FC = ({ datastoreId, vectorDbId, offe WfsServiceForm.displayName = symToStr({ WfsServiceForm }); export default WfsServiceForm; - -export const { i18n } = declareComponentKeys< - | { K: "title"; P: { editMode: boolean }; R: string } - | "stored_data.loading" - | "stored_data_and_offering.loading" - | "stored_data.fetch_failed" - | "offering.fetch_failed" - | { K: "step.title"; P: { stepNumber: number }; R: string } - | "previous_step" - | "continue" - | "publish" - | "publish.in_progress" - | "modify.in_progress" - | "back_to_data_list" - | "trimmed_error" - | "public_name_regex" ->()({ - WfsServiceForm, -}); - -export const WfsServiceFormFrTranslations: Translations<"fr">["WfsServiceForm"] = { - title: ({ editMode }) => (editMode ? "Modifier le service WFS" : "Créer et publier un service WFS"), - "stored_data.loading": "Chargement de la donnée stockée...", - "stored_data_and_offering.loading": "Chargement de la donnée stockée et du service à modifier...", - "stored_data.fetch_failed": "Récupération des informations sur la donnée stockée a échoué", - "offering.fetch_failed": "Récupération des informations sur le service à modifier a échoué", - "step.title": ({ stepNumber }) => { - switch (stepNumber) { - case 1: - return "Tables"; - case 2: - return "Source des métadonnées"; - case 3: - return "Description de la ressource"; - case 4: - return "Informations supplémentaires"; - case 5: - return "Restrictions d'accès"; - default: - return ""; - } - }, - previous_step: "Étape précédente", - continue: "Continuer", - publish: "Publier le service maintenant", - "publish.in_progress": "Création du service WFS en cours", - "modify.in_progress": "Modification des informations du service WFS en cours", - back_to_data_list: "Retour à mes données", - trimmed_error: "La chaîne de caractères ne doit contenir aucun espace en début et fin", - public_name_regex: - "Le nom public de la table ne doit contenir que des lettres, chiffres, tirets (-), underscores (_), ou points (.) et ne peut commencer que par une lettre ou un underscore", -}; - -export const WfsServiceFormEnTranslations: Translations<"en">["WfsServiceForm"] = { - title: undefined, - "stored_data.loading": undefined, - "stored_data_and_offering.loading": undefined, - "stored_data.fetch_failed": undefined, - "offering.fetch_failed": undefined, - "step.title": undefined, - previous_step: undefined, - continue: undefined, - publish: undefined, - "publish.in_progress": undefined, - "modify.in_progress": undefined, - back_to_data_list: undefined, - trimmed_error: undefined, - public_name_regex: undefined, -}; diff --git a/assets/entrepot/pages/service/wms-raster-wmts/PyramidRasterGenerateForm/PyramidRasterGenerateForm.locale.tsx b/assets/entrepot/pages/service/wms-raster-wmts/PyramidRasterGenerateForm/PyramidRasterGenerateForm.locale.tsx new file mode 100644 index 00000000..15d139c7 --- /dev/null +++ b/assets/entrepot/pages/service/wms-raster-wmts/PyramidRasterGenerateForm/PyramidRasterGenerateForm.locale.tsx @@ -0,0 +1,66 @@ +import { declareComponentKeys } from "i18nifty"; + +import { Translations } from "../../../../../i18n/types"; + +const { i18n } = declareComponentKeys< + | "title" + | { K: "step.title"; P: { stepNumber: number }; R: string } + | "wmsv-service.loading" + | "wmsv-service.fetch_failed" + | "wmsv-service.bbox_not_found" + | "back_to_datasheet" + | "technical_name.lead_text" + | "technical_name.label" + | "technical_name.explanation" + | "technical_name.error.mandatory" + | "zoom_range.lead_text" + | "zoom_range.explanation" + | "zoom_range.error" + | "generate.in_progress" +>()("PyramidRasterGenerateForm"); +export type I18n = typeof i18n; + +export const PyramidRasterGenerateFormFrTranslations: Translations<"fr">["PyramidRasterGenerateForm"] = { + title: "Générer une pyramide de tuiles raster", + "step.title": ({ stepNumber }) => { + switch (stepNumber) { + case 1: + return "Nom de la pyramide de tuiles raster"; + case 2: + return "Niveaux de pyramide"; + default: + return ""; + } + }, + "wmsv-service.loading": "Chargement du service WMS-Vecteur...", + "wmsv-service.fetch_failed": "Récupération des informations sur le service WMS-Vecteur a échoué", + "wmsv-service.bbox_not_found": "La bbox du service WMS-Vecteur n'a pas été trouvée, veuillez vérifier le service et la donnée stockée utilisée", + back_to_datasheet: "Retour à la fiche de données", + "technical_name.lead_text": "Choisissez le nom technique de la pyramide de tuiles raster", + "technical_name.label": "Nom technique de la pyramide de tuiles raster", + "technical_name.explanation": + "II s'agit du nom technique du service qui apparaitra dans votre espace de travail, il ne sera pas publié en ligne. Si vous le renommez, choisissez un nom explicite.", + "technical_name.error.mandatory": "Le nom technique de la pyramide de tuiles raster est obligatoire", + "zoom_range.lead_text": "Choisissez les niveaux de pyramide à générer", + "zoom_range.explanation": + "Les niveaux de zoom de la pyramide de tuiles raster sont prédéfinis. Choisissez la borne minimum de votre pyramide de tuiles en vous aidant de la carte de gauche et le zoom maximum en vous aidant de la carte de droite. Tous les niveaux intermédiaires seront générés.", + "zoom_range.error": "Les bornes de la pyramide sont obligatoires.", + "generate.in_progress": "Génération de pyramide de tuiles raster en cours", +}; + +export const PyramidRasterGenerateFormEnTranslations: Translations<"en">["PyramidRasterGenerateForm"] = { + title: undefined, + "step.title": undefined, + "wmsv-service.loading": undefined, + "wmsv-service.fetch_failed": undefined, + "wmsv-service.bbox_not_found": undefined, + back_to_datasheet: undefined, + "technical_name.error.mandatory": undefined, + "technical_name.lead_text": undefined, + "technical_name.label": undefined, + "technical_name.explanation": undefined, + "zoom_range.lead_text": undefined, + "zoom_range.explanation": undefined, + "zoom_range.error": undefined, + "generate.in_progress": undefined, +}; diff --git a/assets/entrepot/pages/service/wms-raster-wmts/PyramidRasterGenerateForm.tsx b/assets/entrepot/pages/service/wms-raster-wmts/PyramidRasterGenerateForm/PyramidRasterGenerateForm.tsx similarity index 69% rename from assets/entrepot/pages/service/wms-raster-wmts/PyramidRasterGenerateForm.tsx rename to assets/entrepot/pages/service/wms-raster-wmts/PyramidRasterGenerateForm/PyramidRasterGenerateForm.tsx index e10a5fc6..e597f0b6 100644 --- a/assets/entrepot/pages/service/wms-raster-wmts/PyramidRasterGenerateForm.tsx +++ b/assets/entrepot/pages/service/wms-raster-wmts/PyramidRasterGenerateForm/PyramidRasterGenerateForm.tsx @@ -6,27 +6,26 @@ import Input from "@codegouvfr/react-dsfr/Input"; import Stepper from "@codegouvfr/react-dsfr/Stepper"; import { yupResolver } from "@hookform/resolvers/yup"; import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query"; -import { declareComponentKeys } from "i18nifty"; import { FC, useCallback, useState } from "react"; import { useForm } from "react-hook-form"; import * as yup from "yup"; -import type { PyramidRaster, Service } from "../../../../@types/app"; -import type { ConfigurationWmsVectorDetailsContent } from "../../../../@types/entrepot"; -import DatastoreLayout from "../../../../components/Layout/DatastoreLayout"; -import LoadingIcon from "../../../../components/Utils/LoadingIcon"; -import LoadingText from "../../../../components/Utils/LoadingText"; -import Wait from "../../../../components/Utils/Wait"; -import ZoomRange from "../../../../components/Utils/ZoomRange"; -import olDefaults from "../../../../data/ol-defaults.json"; -import useScrollToTopEffect from "../../../../hooks/useScrollToTopEffect"; -import { Translations, useTranslation } from "../../../../i18n/i18n"; -import RQKeys from "../../../../modules/entrepot/RQKeys"; -import { CartesApiException } from "../../../../modules/jsonFetch"; -import { routes } from "../../../../router/router"; -import { bboxToWkt } from "../../../../utils"; -import api from "../../../api"; -import { DatasheetViewActiveTabEnum } from "../../datasheet/DatasheetView/DatasheetView"; +import type { PyramidRaster, Service } from "../../../../../@types/app"; +import type { ConfigurationWmsVectorDetailsContent } from "../../../../../@types/entrepot"; +import DatastoreLayout from "../../../../../components/Layout/DatastoreLayout"; +import LoadingIcon from "../../../../../components/Utils/LoadingIcon"; +import LoadingText from "../../../../../components/Utils/LoadingText"; +import Wait from "../../../../../components/Utils/Wait"; +import ZoomRange from "../../../../../components/Utils/ZoomRange"; +import olDefaults from "../../../../../data/ol-defaults.json"; +import useScrollToTopEffect from "../../../../../hooks/useScrollToTopEffect"; +import { useTranslation } from "../../../../../i18n/i18n"; +import RQKeys from "../../../../../modules/entrepot/RQKeys"; +import { CartesApiException } from "../../../../../modules/jsonFetch"; +import { routes } from "../../../../../router/router"; +import { bboxToWkt } from "../../../../../utils"; +import api from "../../../../api"; +import { DatasheetViewActiveTabEnum } from "../../../datasheet/DatasheetView/DatasheetView/DatasheetView"; const STEPS = { TECHNICAL_NAME: 1, @@ -242,68 +241,3 @@ const PyramidRasterGenerateForm: FC = ({ datasto }; export default PyramidRasterGenerateForm; - -export const { i18n } = declareComponentKeys< - | "title" - | { K: "step.title"; P: { stepNumber: number }; R: string } - | "wmsv-service.loading" - | "wmsv-service.fetch_failed" - | "wmsv-service.bbox_not_found" - | "back_to_datasheet" - | "technical_name.lead_text" - | "technical_name.label" - | "technical_name.explanation" - | "technical_name.error.mandatory" - | "zoom_range.lead_text" - | "zoom_range.explanation" - | "zoom_range.error" - | "generate.in_progress" ->()({ - PyramidRasterGenerateForm, -}); - -export const PyramidRasterGenerateFormFrTranslations: Translations<"fr">["PyramidRasterGenerateForm"] = { - // title: "Créer un service raster WMS/WMTS", - title: "Générer une pyramide de tuiles raster", - "step.title": ({ stepNumber }) => { - switch (stepNumber) { - case 1: - return "Nom de la pyramide de tuiles raster"; - case 2: - return "Niveaux de pyramide"; - default: - return ""; - } - }, - "wmsv-service.loading": "Chargement du service WMS-Vecteur...", - "wmsv-service.fetch_failed": "Récupération des informations sur le service WMS-Vecteur a échoué", - "wmsv-service.bbox_not_found": "La bbox du service WMS-Vecteur n'a pas été trouvée, veuillez vérifier le service et la donnée stockée utilisée", - back_to_datasheet: "Retour à la fiche de données", - "technical_name.lead_text": "Choisissez le nom technique de la pyramide de tuiles raster", - "technical_name.label": "Nom technique de la pyramide de tuiles raster", - "technical_name.explanation": - "II s'agit du nom technique du service qui apparaitra dans votre espace de travail, il ne sera pas publié en ligne. Si vous le renommez, choisissez un nom explicite.", - "technical_name.error.mandatory": "Le nom technique de la pyramide de tuiles raster est obligatoire", - "zoom_range.lead_text": "Choisissez les niveaux de pyramide à générer", - "zoom_range.explanation": - "Les niveaux de zoom de la pyramide de tuiles raster sont prédéfinis. Choisissez la borne minimum de votre pyramide de tuiles en vous aidant de la carte de gauche et le zoom maximum en vous aidant de la carte de droite. Tous les niveaux intermédiaires seront générés.", - "zoom_range.error": "Les bornes de la pyramide sont obligatoires.", - "generate.in_progress": "Génération de pyramide de tuiles raster en cours", -}; - -export const PyramidRasterGenerateFormEnTranslations: Translations<"en">["PyramidRasterGenerateForm"] = { - title: undefined, - "step.title": undefined, - "wmsv-service.loading": undefined, - "wmsv-service.fetch_failed": undefined, - "wmsv-service.bbox_not_found": undefined, - back_to_datasheet: undefined, - "technical_name.error.mandatory": undefined, - "technical_name.lead_text": undefined, - "technical_name.label": undefined, - "technical_name.explanation": undefined, - "zoom_range.lead_text": undefined, - "zoom_range.explanation": undefined, - "zoom_range.error": undefined, - "generate.in_progress": undefined, -}; diff --git a/assets/entrepot/pages/service/wms-raster-wmts/PyramidRasterWmsRasterServiceForm/PyramidRasterWmsRasterServiceForm.locale.tsx b/assets/entrepot/pages/service/wms-raster-wmts/PyramidRasterWmsRasterServiceForm/PyramidRasterWmsRasterServiceForm.locale.tsx new file mode 100644 index 00000000..6efb4b1e --- /dev/null +++ b/assets/entrepot/pages/service/wms-raster-wmts/PyramidRasterWmsRasterServiceForm/PyramidRasterWmsRasterServiceForm.locale.tsx @@ -0,0 +1,57 @@ +import { declareComponentKeys } from "i18nifty"; + +import { Translations } from "../../../../../i18n/types"; + +const { i18n } = declareComponentKeys< + | { K: "title"; P: { editMode: boolean }; R: string } + | "stored_data.loading" + | "stored_data_and_offering.loading" + | "stored_data.fetch_failed" + | "offering.fetch_failed" + | { K: "step.title"; P: { stepNumber: number }; R: string } + | "publish" + | "publish.in_progress" + | "modify.in_progress" + | "back_to_data_list" +>()("PyramidRasterWmsRasterServiceForm"); +export type I18n = typeof i18n; + +export const PyramidRasterWmsRasterServiceFormFrTranslations: Translations<"fr">["PyramidRasterWmsRasterServiceForm"] = { + title: ({ editMode }) => (editMode ? "Modifier le service WMS-Raster" : "Publier un service WMS-Raster"), + "stored_data.loading": "Chargement de la donnée stockée", + "stored_data_and_offering.loading": "Chargement de la donnée stockée et du service à modifier", + "stored_data.fetch_failed": "Récupération des informations sur la donnée stockée a échoué", + "offering.fetch_failed": "Récupération des informations sur le service à modifier a échoué", + "step.title": ({ stepNumber }) => { + switch (stepNumber) { + case 1: + return "Source des métadonnées"; + case 2: + return "Description de la ressource"; + case 3: + return "Informations supplémentaires"; + case 4: + return "Restrictions d’accès"; + + default: + return ""; + } + }, + publish: "Publier le service maintenant", + "publish.in_progress": "Création du service WMS-Raster en cours", + "modify.in_progress": "Modification des informations du service WMS-Raster en cours", + back_to_data_list: "Retour à mes données", +}; + +export const PyramidRasterWmsRasterServiceFormEnTranslations: Translations<"en">["PyramidRasterWmsRasterServiceForm"] = { + title: undefined, + "stored_data.loading": undefined, + "stored_data_and_offering.loading": undefined, + "stored_data.fetch_failed": undefined, + "offering.fetch_failed": undefined, + "step.title": undefined, + publish: undefined, + "publish.in_progress": undefined, + "modify.in_progress": undefined, + back_to_data_list: undefined, +}; diff --git a/assets/entrepot/pages/service/wms-raster-wmts/PyramidRasterWmsRasterServiceForm.tsx b/assets/entrepot/pages/service/wms-raster-wmts/PyramidRasterWmsRasterServiceForm/PyramidRasterWmsRasterServiceForm.tsx similarity index 77% rename from assets/entrepot/pages/service/wms-raster-wmts/PyramidRasterWmsRasterServiceForm.tsx rename to assets/entrepot/pages/service/wms-raster-wmts/PyramidRasterWmsRasterServiceForm/PyramidRasterWmsRasterServiceForm.tsx index 167ae424..6862d91e 100644 --- a/assets/entrepot/pages/service/wms-raster-wmts/PyramidRasterWmsRasterServiceForm.tsx +++ b/assets/entrepot/pages/service/wms-raster-wmts/PyramidRasterWmsRasterServiceForm/PyramidRasterWmsRasterServiceForm.tsx @@ -5,28 +5,27 @@ import ButtonsGroup from "@codegouvfr/react-dsfr/ButtonsGroup"; import Stepper from "@codegouvfr/react-dsfr/Stepper"; import { yupResolver } from "@hookform/resolvers/yup"; import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query"; -import { declareComponentKeys } from "i18nifty"; import { FC, useCallback, useMemo, useState } from "react"; import { useForm } from "react-hook-form"; import { symToStr } from "tsafe/symToStr"; -import { ConfigurationTypeEnum, EndpointTypeEnum, PyramidRaster, Service, ServiceFormValuesBaseType } from "../../../../@types/app"; -import DatastoreLayout from "../../../../components/Layout/DatastoreLayout"; -import LoadingIcon from "../../../../components/Utils/LoadingIcon"; -import LoadingText from "../../../../components/Utils/LoadingText"; -import Wait from "../../../../components/Utils/Wait"; -import useScrollToTopEffect from "../../../../hooks/useScrollToTopEffect"; -import { Translations, useTranslation } from "../../../../i18n/i18n"; -import RQKeys from "../../../../modules/entrepot/RQKeys"; -import { CartesApiException } from "../../../../modules/jsonFetch"; -import { routes } from "../../../../router/router"; -import api from "../../../api"; -import AccessRestrictions from "../AccessRestrictions"; -import { CommonSchemasValidation } from "../common-schemas-validation"; -import { getPyramidRasterWmsRasterServiceFormDefaultValues } from "../default-values"; -import AdditionalInfo from "../metadatas/AdditionalInfo"; -import Description from "../metadatas/Description"; -import UploadMDFile from "../metadatas/UploadMDFile"; +import { ConfigurationTypeEnum, EndpointTypeEnum, PyramidRaster, Service, ServiceFormValuesBaseType } from "../../../../../@types/app"; +import DatastoreLayout from "../../../../../components/Layout/DatastoreLayout"; +import LoadingIcon from "../../../../../components/Utils/LoadingIcon"; +import LoadingText from "../../../../../components/Utils/LoadingText"; +import Wait from "../../../../../components/Utils/Wait"; +import useScrollToTopEffect from "../../../../../hooks/useScrollToTopEffect"; +import { useTranslation } from "../../../../../i18n/i18n"; +import RQKeys from "../../../../../modules/entrepot/RQKeys"; +import { CartesApiException } from "../../../../../modules/jsonFetch"; +import { routes } from "../../../../../router/router"; +import api from "../../../../api"; +import AccessRestrictions from "../../common/AccessRestrictions/AccessRestrictions"; +import { CommonSchemasValidation } from "../../common/common-schemas-validation"; +import { getPyramidRasterWmsRasterServiceFormDefaultValues } from "../../common/default-values"; +import AdditionalInfo from "../../metadata/AdditionalInfo"; +import Description from "../../metadata/Description"; +import UploadMDFile from "../../metadata/UploadMDFile"; const STEPS = { METADATA_UPLOAD: 1, @@ -263,58 +262,3 @@ const PyramidRasterWmsRasterServiceForm: FC()({ - PyramidRasterWmsRasterServiceForm, -}); - -export const PyramidRasterWmsRasterServiceFormFrTranslations: Translations<"fr">["PyramidRasterWmsRasterServiceForm"] = { - title: ({ editMode }) => (editMode ? "Modifier le service WMS-Raster" : "Publier un service WMS-Raster"), - "stored_data.loading": "Chargement de la donnée stockée", - "stored_data_and_offering.loading": "Chargement de la donnée stockée et du service à modifier", - "stored_data.fetch_failed": "Récupération des informations sur la donnée stockée a échoué", - "offering.fetch_failed": "Récupération des informations sur le service à modifier a échoué", - "step.title": ({ stepNumber }) => { - switch (stepNumber) { - case 1: - return "Source des métadonnées"; - case 2: - return "Description de la ressource"; - case 3: - return "Informations supplémentaires"; - case 4: - return "Restrictions d’accès"; - - default: - return ""; - } - }, - publish: "Publier le service maintenant", - "publish.in_progress": "Création du service WMS-Raster en cours", - "modify.in_progress": "Modification des informations du service WMS-Raster en cours", - back_to_data_list: "Retour à mes données", -}; - -export const PyramidRasterWmsRasterServiceFormEnTranslations: Translations<"en">["PyramidRasterWmsRasterServiceForm"] = { - title: undefined, - "stored_data.loading": undefined, - "stored_data_and_offering.loading": undefined, - "stored_data.fetch_failed": undefined, - "offering.fetch_failed": undefined, - "step.title": undefined, - publish: undefined, - "publish.in_progress": undefined, - "modify.in_progress": undefined, - back_to_data_list: undefined, -}; diff --git a/assets/entrepot/pages/service/wms-raster-wmts/PyramidRasterWmtsServiceForm/PyramidRasterWmtsServiceForm.locale.tsx b/assets/entrepot/pages/service/wms-raster-wmts/PyramidRasterWmtsServiceForm/PyramidRasterWmtsServiceForm.locale.tsx new file mode 100644 index 00000000..f9cca77c --- /dev/null +++ b/assets/entrepot/pages/service/wms-raster-wmts/PyramidRasterWmtsServiceForm/PyramidRasterWmtsServiceForm.locale.tsx @@ -0,0 +1,57 @@ +import { declareComponentKeys } from "i18nifty"; + +import { Translations } from "../../../../../i18n/types"; + +const { i18n } = declareComponentKeys< + | { K: "title"; P: { editMode: boolean }; R: string } + | "stored_data.loading" + | "stored_data_and_offering.loading" + | "stored_data.fetch_failed" + | "offering.fetch_failed" + | { K: "step.title"; P: { stepNumber: number }; R: string } + | "publish" + | "publish.in_progress" + | "modify.in_progress" + | "back_to_data_list" +>()("PyramidRasterWmtsServiceForm"); +export type I18n = typeof i18n; + +export const PyramidRasterWmtsServiceFormFrTranslations: Translations<"fr">["PyramidRasterWmtsServiceForm"] = { + title: ({ editMode }) => (editMode ? "Modifier le service WMTS" : "Publier un service WMTS"), + "stored_data.loading": "Chargement de la donnée stockée", + "stored_data_and_offering.loading": "Chargement de la donnée stockée et du service à modifier", + "stored_data.fetch_failed": "Récupération des informations sur la donnée stockée a échoué", + "offering.fetch_failed": "Récupération des informations sur le service à modifier a échoué", + "step.title": ({ stepNumber }) => { + switch (stepNumber) { + case 1: + return "Source des métadonnées"; + case 2: + return "Description de la ressource"; + case 3: + return "Informations supplémentaires"; + case 4: + return "Restrictions d’accès"; + + default: + return ""; + } + }, + publish: "Publier le service maintenant", + "publish.in_progress": "Création du service WMTS en cours", + "modify.in_progress": "Modification des informations du service WMTS en cours", + back_to_data_list: "Retour à mes données", +}; + +export const PyramidRasterWmtsServiceFormEnTranslations: Translations<"en">["PyramidRasterWmtsServiceForm"] = { + title: undefined, + "stored_data.loading": undefined, + "stored_data_and_offering.loading": undefined, + "stored_data.fetch_failed": undefined, + "offering.fetch_failed": undefined, + "step.title": undefined, + publish: undefined, + "publish.in_progress": undefined, + "modify.in_progress": undefined, + back_to_data_list: undefined, +}; diff --git a/assets/entrepot/pages/service/wms-raster-wmts/PyramidRasterWmtsServiceForm.tsx b/assets/entrepot/pages/service/wms-raster-wmts/PyramidRasterWmtsServiceForm/PyramidRasterWmtsServiceForm.tsx similarity index 78% rename from assets/entrepot/pages/service/wms-raster-wmts/PyramidRasterWmtsServiceForm.tsx rename to assets/entrepot/pages/service/wms-raster-wmts/PyramidRasterWmtsServiceForm/PyramidRasterWmtsServiceForm.tsx index 5db6c2f6..fbb71439 100644 --- a/assets/entrepot/pages/service/wms-raster-wmts/PyramidRasterWmtsServiceForm.tsx +++ b/assets/entrepot/pages/service/wms-raster-wmts/PyramidRasterWmtsServiceForm/PyramidRasterWmtsServiceForm.tsx @@ -5,28 +5,27 @@ import ButtonsGroup from "@codegouvfr/react-dsfr/ButtonsGroup"; import Stepper from "@codegouvfr/react-dsfr/Stepper"; import { yupResolver } from "@hookform/resolvers/yup"; import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query"; -import { declareComponentKeys } from "i18nifty"; import { FC, useCallback, useMemo, useState } from "react"; import { useForm } from "react-hook-form"; import { symToStr } from "tsafe/symToStr"; -import { ConfigurationTypeEnum, EndpointTypeEnum, PyramidRaster, Service, ServiceFormValuesBaseType } from "../../../../@types/app"; -import DatastoreLayout from "../../../../components/Layout/DatastoreLayout"; -import LoadingIcon from "../../../../components/Utils/LoadingIcon"; -import LoadingText from "../../../../components/Utils/LoadingText"; -import Wait from "../../../../components/Utils/Wait"; -import useScrollToTopEffect from "../../../../hooks/useScrollToTopEffect"; -import { Translations, useTranslation } from "../../../../i18n/i18n"; -import RQKeys from "../../../../modules/entrepot/RQKeys"; -import { CartesApiException } from "../../../../modules/jsonFetch"; -import { routes } from "../../../../router/router"; -import api from "../../../api"; -import AccessRestrictions from "../AccessRestrictions"; -import { CommonSchemasValidation } from "../common-schemas-validation"; -import { getPyramidRasterWmtsServiceFormDefaultValues } from "../default-values"; -import AdditionalInfo from "../metadatas/AdditionalInfo"; -import Description from "../metadatas/Description"; -import UploadMDFile from "../metadatas/UploadMDFile"; +import { ConfigurationTypeEnum, EndpointTypeEnum, PyramidRaster, Service, ServiceFormValuesBaseType } from "../../../../../@types/app"; +import DatastoreLayout from "../../../../../components/Layout/DatastoreLayout"; +import LoadingIcon from "../../../../../components/Utils/LoadingIcon"; +import LoadingText from "../../../../../components/Utils/LoadingText"; +import Wait from "../../../../../components/Utils/Wait"; +import useScrollToTopEffect from "../../../../../hooks/useScrollToTopEffect"; +import { useTranslation } from "../../../../../i18n/i18n"; +import RQKeys from "../../../../../modules/entrepot/RQKeys"; +import { CartesApiException } from "../../../../../modules/jsonFetch"; +import { routes } from "../../../../../router/router"; +import api from "../../../../api"; +import AccessRestrictions from "../../common/AccessRestrictions/AccessRestrictions"; +import { CommonSchemasValidation } from "../../common/common-schemas-validation"; +import { getPyramidRasterWmtsServiceFormDefaultValues } from "../../common/default-values"; +import AdditionalInfo from "../../metadata/AdditionalInfo"; +import Description from "../../metadata/Description"; +import UploadMDFile from "../../metadata/UploadMDFile"; const STEPS = { METADATA_UPLOAD: 1, @@ -263,58 +262,3 @@ const PyramidRasterWmtsServiceForm: FC = ({ d PyramidRasterWmtsServiceForm.displayName = symToStr({ PyramidRasterWmtsServiceForm }); export default PyramidRasterWmtsServiceForm; - -export const { i18n } = declareComponentKeys< - | { K: "title"; P: { editMode: boolean }; R: string } - | "stored_data.loading" - | "stored_data_and_offering.loading" - | "stored_data.fetch_failed" - | "offering.fetch_failed" - | { K: "step.title"; P: { stepNumber: number }; R: string } - | "publish" - | "publish.in_progress" - | "modify.in_progress" - | "back_to_data_list" ->()({ - PyramidRasterWmtsServiceForm, -}); - -export const PyramidRasterWmtsServiceFormFrTranslations: Translations<"fr">["PyramidRasterWmtsServiceForm"] = { - title: ({ editMode }) => (editMode ? "Modifier le service WMTS" : "Publier un service WMTS"), - "stored_data.loading": "Chargement de la donnée stockée", - "stored_data_and_offering.loading": "Chargement de la donnée stockée et du service à modifier", - "stored_data.fetch_failed": "Récupération des informations sur la donnée stockée a échoué", - "offering.fetch_failed": "Récupération des informations sur le service à modifier a échoué", - "step.title": ({ stepNumber }) => { - switch (stepNumber) { - case 1: - return "Source des métadonnées"; - case 2: - return "Description de la ressource"; - case 3: - return "Informations supplémentaires"; - case 4: - return "Restrictions d’accès"; - - default: - return ""; - } - }, - publish: "Publier le service maintenant", - "publish.in_progress": "Création du service WMTS en cours", - "modify.in_progress": "Modification des informations du service WMTS en cours", - back_to_data_list: "Retour à mes données", -}; - -export const PyramidRasterWmtsServiceFormEnTranslations: Translations<"en">["PyramidRasterWmtsServiceForm"] = { - title: undefined, - "stored_data.loading": undefined, - "stored_data_and_offering.loading": undefined, - "stored_data.fetch_failed": undefined, - "offering.fetch_failed": undefined, - "step.title": undefined, - publish: undefined, - "publish.in_progress": undefined, - "modify.in_progress": undefined, - back_to_data_list: undefined, -}; diff --git a/assets/entrepot/pages/service/wms-vector/UploadStyleFile.locale.tsx b/assets/entrepot/pages/service/wms-vector/UploadStyleFile.locale.tsx new file mode 100644 index 00000000..eb122f84 --- /dev/null +++ b/assets/entrepot/pages/service/wms-vector/UploadStyleFile.locale.tsx @@ -0,0 +1,16 @@ +import { declareComponentKeys } from "i18nifty"; + +import { Translations } from "../../../../i18n/types"; + +const { i18n } = declareComponentKeys<"title" | "file_input_hint">()("UploadStyleFile"); +export type I18n = typeof i18n; + +export const UploadStyleFileFrTranslations: Translations<"fr">["UploadStyleFile"] = { + title: "Déposez vos fichiers de style SLD", + file_input_hint: "Glissez-déposez votre fichier SLD ici. Formats de fichiers autorisés : .sld", +}; + +export const UploadStyleFileEnTranslations: Translations<"en">["UploadStyleFile"] = { + title: undefined, + file_input_hint: undefined, +}; diff --git a/assets/entrepot/pages/service/wms-vector/UploadStyleFile.tsx b/assets/entrepot/pages/service/wms-vector/UploadStyleFile.tsx index a3993b1c..7c843545 100644 --- a/assets/entrepot/pages/service/wms-vector/UploadStyleFile.tsx +++ b/assets/entrepot/pages/service/wms-vector/UploadStyleFile.tsx @@ -3,8 +3,8 @@ import { Upload } from "@codegouvfr/react-dsfr/Upload"; import { FC } from "react"; import { type UseFormReturn } from "react-hook-form"; -import { Translations, declareComponentKeys, useTranslation } from "../../../../i18n/i18n"; import { type StoredDataRelation } from "../../../../@types/app"; +import { useTranslation } from "../../../../i18n/i18n"; import { WmsVectorServiceFormValuesType } from "./WmsVectorServiceForm"; type UploadStyleFileProps = { @@ -46,17 +46,3 @@ const UploadStyleFile: FC = ({ visible, selectedTables = [ }; export default UploadStyleFile; - -export const { i18n } = declareComponentKeys<"title" | "file_input_hint">()({ - UploadStyleFile, -}); - -export const UploadStyleFileFrTranslations: Translations<"fr">["UploadStyleFile"] = { - title: "Déposez vos fichiers de style SLD", - file_input_hint: "Glissez-déposez votre fichier SLD ici. Formats de fichiers autorisés : .sld", -}; - -export const UploadStyleFileEnTranslations: Translations<"en">["UploadStyleFile"] = { - title: undefined, - file_input_hint: undefined, -}; diff --git a/assets/entrepot/pages/service/wms-vector/WmsVectorServiceForm.locale.tsx b/assets/entrepot/pages/service/wms-vector/WmsVectorServiceForm.locale.tsx new file mode 100644 index 00000000..38fc71b0 --- /dev/null +++ b/assets/entrepot/pages/service/wms-vector/WmsVectorServiceForm.locale.tsx @@ -0,0 +1,65 @@ +import { declareComponentKeys } from "i18nifty"; +import { Translations } from "../../../../i18n/types"; + +const { i18n } = declareComponentKeys< + | { K: "title"; P: { editMode: boolean }; R: string } + | "stored_data.loading" + | "stored_data_and_offering.loading" + | "stored_data.fetch_failed" + | "offering.fetch_failed" + | { K: "step.title"; P: { stepNumber: number }; R: string } + | "previous_step" + | "continue" + | "publish" + | "publish.in_progress" + | "modify.in_progress" + | "back_to_data_list" +>()("WmsVectorServiceForm"); +export type I18n = typeof i18n; + +export const WmsVectorServiceFormFrTranslations: Translations<"fr">["WmsVectorServiceForm"] = { + title: ({ editMode }) => (editMode ? "Modifier le service WMS-Vecteur" : "Créer et publier un service WMS-Vecteur"), + "stored_data.loading": "Chargement de la donnée stockée...", + "stored_data_and_offering.loading": "Chargement de la donnée stockée et du service à modifier...", + "stored_data.fetch_failed": "Récupération des informations sur la donnée stockée a échoué", + "offering.fetch_failed": "Récupération des informations sur le service à modifier a échoué", + "step.title": ({ stepNumber }) => { + switch (stepNumber) { + case 1: + return "Tables"; + case 2: + return "Fichier de style SLD"; + case 3: + return "Source des métadonnées"; + case 4: + return "Description de la ressource"; + case 5: + return "Informations supplémentaires"; + case 6: + return "Restrictions d'accès"; + default: + return ""; + } + }, + previous_step: "Étape précédente", + continue: "Continuer", + publish: "Publier le service maintenant", + "publish.in_progress": "Création du service WMS-Vecteur en cours", + "modify.in_progress": "Modification des informations du service WMS-Vecteur en cours", + back_to_data_list: "Retour à mes données", +}; + +export const WmsVectorServiceFormEnTranslations: Translations<"en">["WmsVectorServiceForm"] = { + title: undefined, + "stored_data.loading": undefined, + "stored_data_and_offering.loading": undefined, + "stored_data.fetch_failed": undefined, + "offering.fetch_failed": undefined, + "step.title": undefined, + previous_step: undefined, + continue: undefined, + publish: undefined, + "publish.in_progress": undefined, + "modify.in_progress": undefined, + back_to_data_list: undefined, +}; diff --git a/assets/entrepot/pages/service/wms-vector/WmsVectorServiceForm.tsx b/assets/entrepot/pages/service/wms-vector/WmsVectorServiceForm.tsx index fb7504e5..a2f61f76 100644 --- a/assets/entrepot/pages/service/wms-vector/WmsVectorServiceForm.tsx +++ b/assets/entrepot/pages/service/wms-vector/WmsVectorServiceForm.tsx @@ -6,7 +6,6 @@ import Stepper from "@codegouvfr/react-dsfr/Stepper"; import { yupResolver } from "@hookform/resolvers/yup"; import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query"; import SldStyleParser from "geostyler-sld-parser"; -import { declareComponentKeys } from "i18nifty"; import { FC, useCallback, useMemo, useState } from "react"; import { useForm, useWatch } from "react-hook-form"; import { symToStr } from "tsafe/symToStr"; @@ -25,19 +24,19 @@ import LoadingIcon from "../../../../components/Utils/LoadingIcon"; import LoadingText from "../../../../components/Utils/LoadingText"; import Wait from "../../../../components/Utils/Wait"; import useScrollToTopEffect from "../../../../hooks/useScrollToTopEffect"; -import { Translations, useTranslation } from "../../../../i18n/i18n"; +import { useTranslation } from "../../../../i18n/i18n"; import RQKeys from "../../../../modules/entrepot/RQKeys"; import { CartesApiException } from "../../../../modules/jsonFetch"; import { routes } from "../../../../router/router"; -import SldStyleWmsVectorValidator from "../../../../validations/sldStyle"; +import SldStyleWmsVectorValidator from "../../../../validations/sld/sldStyle"; import api from "../../../api"; -import AccessRestrictions from "../AccessRestrictions"; -import TableSelection from "../TableSelection"; -import { CommonSchemasValidation } from "../common-schemas-validation"; -import { getWmsVectorServiceFormDefaultValues } from "../default-values"; -import AdditionalInfo from "../metadatas/AdditionalInfo"; -import Description from "../metadatas/Description"; -import UploadMDFile from "../metadatas/UploadMDFile"; +import AccessRestrictions from "../common/AccessRestrictions/AccessRestrictions"; +import TableSelection from "../common/TableSelection/TableSelection"; +import { CommonSchemasValidation } from "../common/common-schemas-validation"; +import { getWmsVectorServiceFormDefaultValues } from "../common/default-values"; +import AdditionalInfo from "../metadata/AdditionalInfo"; +import Description from "../metadata/Description"; +import UploadMDFile from "../metadata/UploadMDFile"; import UploadStyleFile from "./UploadStyleFile"; /** @@ -399,67 +398,3 @@ const WmsVectorServiceForm: FC = ({ datastoreId, vect WmsVectorServiceForm.displayName = symToStr({ WmsVectorServiceForm }); export default WmsVectorServiceForm; - -export const { i18n } = declareComponentKeys< - | { K: "title"; P: { editMode: boolean }; R: string } - | "stored_data.loading" - | "stored_data_and_offering.loading" - | "stored_data.fetch_failed" - | "offering.fetch_failed" - | { K: "step.title"; P: { stepNumber: number }; R: string } - | "previous_step" - | "continue" - | "publish" - | "publish.in_progress" - | "modify.in_progress" - | "back_to_data_list" ->()({ - WmsVectorServiceForm, -}); - -export const WmsVectorServiceFormFrTranslations: Translations<"fr">["WmsVectorServiceForm"] = { - title: ({ editMode }) => (editMode ? "Modifier le service WMS-Vecteur" : "Créer et publier un service WMS-Vecteur"), - "stored_data.loading": "Chargement de la donnée stockée...", - "stored_data_and_offering.loading": "Chargement de la donnée stockée et du service à modifier...", - "stored_data.fetch_failed": "Récupération des informations sur la donnée stockée a échoué", - "offering.fetch_failed": "Récupération des informations sur le service à modifier a échoué", - "step.title": ({ stepNumber }) => { - switch (stepNumber) { - case 1: - return "Tables"; - case 2: - return "Fichier de style SLD"; - case 3: - return "Source des métadonnées"; - case 4: - return "Description de la ressource"; - case 5: - return "Informations supplémentaires"; - case 6: - return "Restrictions d'accès"; - default: - return ""; - } - }, - previous_step: "Étape précédente", - continue: "Continuer", - publish: "Publier le service maintenant", - "publish.in_progress": "Création du service WMS-Vecteur en cours", - "modify.in_progress": "Modification des informations du service WMS-Vecteur en cours", - back_to_data_list: "Retour à mes données", -}; - -export const WmsVectorServiceFormEnTranslations: Translations<"en">["WmsVectorServiceForm"] = { - title: undefined, - "stored_data.loading": undefined, - "stored_data_and_offering.loading": undefined, - "stored_data.fetch_failed": undefined, - "offering.fetch_failed": undefined, - "step.title": undefined, - previous_step: undefined, - continue: undefined, - publish: undefined, - "publish.in_progress": undefined, - "modify.in_progress": undefined, - back_to_data_list: undefined, -}; diff --git a/assets/entrepot/pages/users/Me.tsx b/assets/entrepot/pages/users/Me.tsx deleted file mode 100644 index 24e3c7ce..00000000 --- a/assets/entrepot/pages/users/Me.tsx +++ /dev/null @@ -1,148 +0,0 @@ -import { fr } from "@codegouvfr/react-dsfr"; -import Button from "@codegouvfr/react-dsfr/Button"; -import { useMemo } from "react"; - -import AppLayout from "../../../components/Layout/AppLayout"; -import { datastoreNavItems } from "../../../config/datastoreNavItems"; -import { Translations, declareComponentKeys, getTranslation, useTranslation } from "../../../i18n/i18n"; -import SymfonyRouting from "../../../modules/Routing"; -import { useAuthStore } from "../../../stores/AuthStore"; -import { useSnackbarStore } from "../../../stores/SnackbarStore"; -import { formatDateFromISO } from "../../../utils"; - -const Me = () => { - const { t: tCommon } = getTranslation("Common"); - const { t } = useTranslation({ Me }); - const user = useAuthStore((state) => state.user); - const navItems = useMemo(() => datastoreNavItems(), []); - - const setMessage = useSnackbarStore((state) => state.setMessage); - - return ( - -

{t("my_account")}

- - {user && ( - <> -

{t("firstname", { firstName: user?.first_name ?? "" })}

-

{t("lastname", { lastName: user?.last_name ?? "" })}

-

{t("username", { userName: user?.user_name ?? "" })}

-

{t("email", { email: user.email })}

-

{t("registration_date", { date: formatDateFromISO(user.account_creation_date) })}

-
- {t("id", { id: user.id })} -
- - )} - - -
- ); -}; - -export default Me; - -export const { i18n } = declareComponentKeys< - | "my_account" - | { K: "firstname"; P: { firstName: string }; R: JSX.Element } - | { K: "lastname"; P: { lastName: string }; R: JSX.Element } - | { K: "username"; P: { userName: string }; R: JSX.Element } - | { K: "email"; P: { email: string }; R: JSX.Element } - | { K: "registration_date"; P: { date: string }; R: JSX.Element } - | { K: "id"; P: { id: string }; R: JSX.Element } - | "userid_copied" - | "manage_my_account" ->()({ - Me, -}); - -export const MeFrTranslations: Translations<"fr">["Me"] = { - my_account: "Mon compte", - firstname: ({ firstName }) => ( - <> - Prénom : {firstName} - - ), - lastname: ({ lastName }) => ( - <> - Nom : {lastName} - - ), - username: ({ userName }) => ( - <> - Pseudo : {userName} - - ), - email: ({ email }) => ( - <> - Adresse email : {email} - - ), - registration_date: ({ date }) => ( - <> - Date d'inscription : {date} - - ), - id: ({ id }) => ( - <> - Identifiant utilisateur : {id} - - ), - userid_copied: "Identifiant utilisateur copié", - manage_my_account: "Modifier mes informations", -}; - -export const MeEnTranslations: Translations<"en">["Me"] = { - my_account: "My account", - firstname: ({ firstName }) => ( - <> - First name: {firstName} - - ), - lastname: ({ lastName }) => ( - <> - Name: {lastName} - - ), - username: ({ userName }) => ( - <> - Username : {userName} - - ), - email: ({ email }) => ( - <> - Email: {email} - - ), - registration_date: ({ date }) => ( - <> - Registration date: {date} - - ), - id: ({ id }) => ( - <> - User Id: {id} - - ), - userid_copied: "User Id copied", - manage_my_account: "Manage my account", -}; diff --git a/assets/entrepot/pages/users/access-keys/MyAccessKeys.locale.tsx b/assets/entrepot/pages/users/access-keys/MyAccessKeys.locale.tsx new file mode 100644 index 00000000..c6e2c6c2 --- /dev/null +++ b/assets/entrepot/pages/users/access-keys/MyAccessKeys.locale.tsx @@ -0,0 +1,34 @@ +import { fr } from "@codegouvfr/react-dsfr"; +import { declareComponentKeys } from "i18nifty"; + +import { Translations } from "../../../../i18n/types"; + +const { i18n } = declareComponentKeys<"title" | { K: "explain"; R: JSX.Element } | "my_keys" | "permissions">()("MyAccessKeys"); +export type I18n = typeof i18n; + +export const MyAccessKeysFrTranslations: Translations<"fr">["MyAccessKeys"] = { + title: "Mes clés d’accès", + explain: ( + <> +

{"Les données publiques sont par défaut disponibles sans création de clé d’accès."}

+ Le cas échéant, cette section vous permet : +
    +
  • {"De consulter les permissions d’accès aux services de diffusion qui vous ont été octroyées par le producteur de la donnée."}
  • +
  • + { + "De créer les clés d’accès et d’exploiter dans vos outils (SIG, site internet, etc.) les permissions qui vous ont été accordées par le producteur de la donnée." + } +
  • +
+ + ), + my_keys: "Mes clés", + permissions: "Permissions", +}; + +export const MyAccessKeysEnTranslations: Translations<"en">["MyAccessKeys"] = { + title: "My access keys", + explain: undefined, + my_keys: "My keys", + permissions: "Permissions", +}; diff --git a/assets/entrepot/pages/users/MyAccessKeys.tsx b/assets/entrepot/pages/users/access-keys/MyAccessKeys.tsx similarity index 55% rename from assets/entrepot/pages/users/MyAccessKeys.tsx rename to assets/entrepot/pages/users/access-keys/MyAccessKeys.tsx index fd0aef6a..69bad25d 100644 --- a/assets/entrepot/pages/users/MyAccessKeys.tsx +++ b/assets/entrepot/pages/users/access-keys/MyAccessKeys.tsx @@ -1,18 +1,18 @@ import { fr } from "@codegouvfr/react-dsfr"; import Tabs from "@codegouvfr/react-dsfr/Tabs"; import { useQuery } from "@tanstack/react-query"; -import { declareComponentKeys } from "i18nifty"; import { FC } from "react"; -import { UserKeyDetailedWithAccessesResponseDto } from "../../../@types/app"; -import { PermissionWithOfferingsDetailsResponseDto } from "../../../@types/entrepot"; -import AppLayout from "../../../components/Layout/AppLayout"; -import LoadingText from "../../../components/Utils/LoadingText"; -import { datastoreNavItems } from "../../../config/datastoreNavItems"; -import { Translations, getTranslation } from "../../../i18n/i18n"; -import RQKeys from "../../../modules/entrepot/RQKeys"; -import api from "../../api"; -import UserKeysListTab from "./keys/UserKeysListTab"; -import PermissionsListTab from "./permissions/PermissionsListTab"; + +import { UserKeyDetailedWithAccessesResponseDto } from "../../../../@types/app"; +import { PermissionWithOfferingsDetailsResponseDto } from "../../../../@types/entrepot"; +import AppLayout from "../../../../components/Layout/AppLayout"; +import LoadingText from "../../../../components/Utils/LoadingText"; +import { datastoreNavItems } from "../../../../config/navItems/datastoreNavItems"; +import { getTranslation } from "../../../../i18n/i18n"; +import RQKeys from "../../../../modules/entrepot/RQKeys"; +import api from "../../../api"; +import UserKeysListTab from "../keys/UserKeysListTab/UserKeysListTab"; +import PermissionsListTab from "../permissions/PermissionsListTab"; const { t } = getTranslation("MyAccessKeys"); @@ -65,33 +65,3 @@ const MyAccessKeys: FC = () => { }; export default MyAccessKeys; - -// traductions -export const { i18n } = declareComponentKeys<"title" | { K: "explain"; R: JSX.Element } | "my_keys" | "permissions">()("MyAccessKeys"); - -export const MyAccessKeysFrTranslations: Translations<"fr">["MyAccessKeys"] = { - title: "Mes clés d’accès", - explain: ( - <> -

{"Les données publiques sont par défaut disponibles sans création de clé d’accès."}

- Le cas échéant, cette section vous permet : -
    -
  • {"De consulter les permissions d’accès aux services de diffusion qui vous ont été octroyées par le producteur de la donnée."}
  • -
  • - { - "De créer les clés d’accès et d’exploiter dans vos outils (SIG, site internet, etc.) les permissions qui vous ont été accordées par le producteur de la donnée." - } -
  • -
- - ), - my_keys: "Mes clés", - permissions: "Permissions", -}; - -export const MyAccessKeysEnTranslations: Translations<"en">["MyAccessKeys"] = { - title: "My access keys", - explain: undefined, - my_keys: "My keys", - permissions: "Permissions", -}; diff --git a/assets/entrepot/pages/users/keys/UserKeyTr.tsx b/assets/entrepot/pages/users/keys/UserKey.locale.tsx similarity index 97% rename from assets/entrepot/pages/users/keys/UserKeyTr.tsx rename to assets/entrepot/pages/users/keys/UserKey.locale.tsx index 58253f1b..438f8aec 100644 --- a/assets/entrepot/pages/users/keys/UserKeyTr.tsx +++ b/assets/entrepot/pages/users/keys/UserKey.locale.tsx @@ -1,9 +1,9 @@ import { declareComponentKeys } from "i18nifty"; -import { Translations } from "../../../../i18n/i18n"; +import type { Translations } from "../../../../i18n/types"; import { UserKeyInfoDtoTypeEnum } from "../../../../@types/app"; // traductions -export const { i18n } = declareComponentKeys< +const { i18n } = declareComponentKeys< | { K: "title"; P: { keyId: string | undefined }; R: string } | { K: "step"; P: { num: number }; R: string } | "services" @@ -36,6 +36,7 @@ export const { i18n } = declareComponentKeys< | "no_permission" | "key_not_found" >()("UserKey"); +export type I18n = typeof i18n; export const UserKeyFrTranslations: Translations<"fr">["UserKey"] = { title: ({ keyId }) => (keyId ? `Modification de la clé ${keyId}` : "Ajout d’une clé"), diff --git a/assets/entrepot/pages/users/keys/UserKeyForm.tsx b/assets/entrepot/pages/users/keys/UserKeyForm.tsx index 0add044d..1580d6ab 100644 --- a/assets/entrepot/pages/users/keys/UserKeyForm.tsx +++ b/assets/entrepot/pages/users/keys/UserKeyForm.tsx @@ -14,7 +14,7 @@ import { PermissionWithOfferingsDetailsResponseDto, UserKeyResponseDto, UserKeyR import AppLayout from "../../../../components/Layout/AppLayout"; import LoadingText from "../../../../components/Utils/LoadingText"; import Wait from "../../../../components/Utils/Wait"; -import { datastoreNavItems } from "../../../../config/datastoreNavItems"; +import { datastoreNavItems } from "../../../../config/navItems/datastoreNavItems"; import { getTranslation, useTranslation } from "../../../../i18n/i18n"; import RQKeys from "../../../../modules/entrepot/RQKeys"; import { CartesApiException } from "../../../../modules/jsonFetch"; diff --git a/assets/entrepot/pages/users/keys/UserKeysListTab/UserKeysListTab.locale.tsx b/assets/entrepot/pages/users/keys/UserKeysListTab/UserKeysListTab.locale.tsx new file mode 100644 index 00000000..00cc7591 --- /dev/null +++ b/assets/entrepot/pages/users/keys/UserKeysListTab/UserKeysListTab.locale.tsx @@ -0,0 +1,43 @@ +import { declareComponentKeys } from "i18nifty"; + +import { Translations } from "../../../../../i18n/types"; + +const { i18n } = declareComponentKeys< + | "no_keys" + | "no_permission_warning" + | { K: "hash_value"; P: { value?: string }; R: string } + | "hash_value_copied" + | "services" + | "no_services" + | "add" + | "modify" + | "remove" + | "confirm_remove" +>()("UserKeysListTab"); +export type I18n = typeof i18n; + +export const UserKeysListTabFrTranslations: Translations<"fr">["UserKeysListTab"] = { + no_keys: "Vous n'avez aucune clé d’accès", + no_permission_warning: "Vous n'avez aucune permission, il n'est pas possible d’ajouter une clé", + hash_value: ({ value }) => `Valeur du hash : ${value ?? "indisponible"}`, + hash_value_copied: "Valeur du hash copiée", + services: "Services accessibles", + no_services: "Cette clé n'a accès à aucun service", + add: "Créer une clé d’accès", + modify: "Modifier la clé", + remove: "Supprimer la clé", + confirm_remove: "Êtes-vous sûr de vouloir supprimer cette clé ?", +}; + +export const UserKeysListTabEnTranslations: Translations<"en">["UserKeysListTab"] = { + no_keys: "You don't have any access keys", + no_permission_warning: "You have no permissions, it is not possible to add a key", + hash_value: ({ value }) => `Hash value : ${value}`, + hash_value_copied: "Hash value copied", + services: "Accessible services", + no_services: "This key does not have access to any services", + add: "Create access key", + modify: "Modify key", + remove: "Remove key", + confirm_remove: "Are you sure you want to delete this key ?", +}; diff --git a/assets/entrepot/pages/users/keys/UserKeysListTab.tsx b/assets/entrepot/pages/users/keys/UserKeysListTab/UserKeysListTab.tsx similarity index 82% rename from assets/entrepot/pages/users/keys/UserKeysListTab.tsx rename to assets/entrepot/pages/users/keys/UserKeysListTab/UserKeysListTab.tsx index b1d47051..112fab0f 100644 --- a/assets/entrepot/pages/users/keys/UserKeysListTab.tsx +++ b/assets/entrepot/pages/users/keys/UserKeysListTab/UserKeysListTab.tsx @@ -4,24 +4,23 @@ import Alert from "@codegouvfr/react-dsfr/Alert"; import Badge from "@codegouvfr/react-dsfr/Badge"; import Button from "@codegouvfr/react-dsfr/Button"; import { useMutation, useQueryClient } from "@tanstack/react-query"; -import { declareComponentKeys } from "i18nifty"; import { FC, useMemo, useState } from "react"; -import type { UserKeyDetailedWithAccessesResponseDto } from "../../../../@types/app"; +import type { UserKeyDetailedWithAccessesResponseDto } from "../../../../../@types/app"; import { type HashInfoDto, type PermissionWithOfferingsResponseDto, UserKeyDetailsResponseDtoUserKeyInfoDtoTypeEnum, type UserKeyResponseDto, -} from "../../../../@types/entrepot"; -import { ConfirmDialog, ConfirmDialogModal } from "../../../../components/Utils/ConfirmDialog"; -import Wait from "../../../../components/Utils/Wait"; -import { Translations, useTranslation } from "../../../../i18n/i18n"; -import RQKeys from "../../../../modules/entrepot/RQKeys"; -import { CartesApiException } from "../../../../modules/jsonFetch"; -import { routes } from "../../../../router/router"; -import { useSnackbarStore } from "../../../../stores/SnackbarStore"; -import api from "../../../api"; +} from "../../../../../@types/entrepot"; +import { ConfirmDialog, ConfirmDialogModal } from "../../../../../components/Utils/ConfirmDialog"; +import Wait from "../../../../../components/Utils/Wait"; +import { useTranslation } from "../../../../../i18n/i18n"; +import RQKeys from "../../../../../modules/entrepot/RQKeys"; +import { CartesApiException } from "../../../../../modules/jsonFetch"; +import { routes } from "../../../../../router/router"; +import { useSnackbarStore } from "../../../../../stores/SnackbarStore"; +import api from "../../../../api"; type UserKeysListTabProps = { keys: UserKeyDetailedWithAccessesResponseDto[] | undefined; @@ -200,43 +199,3 @@ const UserKeysListTab: FC = ({ keys, permissions }) => { }; export default UserKeysListTab; - -// traductions -export const { i18n } = declareComponentKeys< - | "no_keys" - | "no_permission_warning" - | { K: "hash_value"; P: { value?: string }; R: string } - | "hash_value_copied" - | "services" - | "no_services" - | "add" - | "modify" - | "remove" - | "confirm_remove" ->()("UserKeysListTab"); - -export const UserKeysListTabFrTranslations: Translations<"fr">["UserKeysListTab"] = { - no_keys: "Vous n'avez aucune clé d’accès", - no_permission_warning: "Vous n'avez aucune permission, il n'est pas possible d’ajouter une clé", - hash_value: ({ value }) => `Valeur du hash : ${value ?? "indisponible"}`, - hash_value_copied: "Valeur du hash copiée", - services: "Services accessibles", - no_services: "Cette clé n'a accès à aucun service", - add: "Créer une clé d’accès", - modify: "Modifier la clé", - remove: "Supprimer la clé", - confirm_remove: "Êtes-vous sûr de vouloir supprimer cette clé ?", -}; - -export const UserKeysListTabEnTranslations: Translations<"en">["UserKeysListTab"] = { - no_keys: "You don't have any access keys", - no_permission_warning: "You have no permissions, it is not possible to add a key", - hash_value: ({ value }) => `Hash value : ${value}`, - hash_value_copied: "Hash value copied", - services: "Accessible services", - no_services: "This key does not have access to any services", - add: "Create access key", - modify: "Modify key", - remove: "Remove key", - confirm_remove: "Are you sure you want to delete this key ?", -}; diff --git a/assets/entrepot/pages/users/me/Me.locale.tsx b/assets/entrepot/pages/users/me/Me.locale.tsx new file mode 100644 index 00000000..adb84560 --- /dev/null +++ b/assets/entrepot/pages/users/me/Me.locale.tsx @@ -0,0 +1,87 @@ +import { declareComponentKeys } from "i18nifty"; +import { Translations } from "../../../../i18n/types"; + +const { i18n } = declareComponentKeys< + | "my_account" + | { K: "firstname"; P: { firstName: string }; R: JSX.Element } + | { K: "lastname"; P: { lastName: string }; R: JSX.Element } + | { K: "username"; P: { userName: string }; R: JSX.Element } + | { K: "email"; P: { email: string }; R: JSX.Element } + | { K: "registration_date"; P: { date: string }; R: JSX.Element } + | { K: "id"; P: { id: string }; R: JSX.Element } + | "userid_copied" + | "manage_my_account" +>()("Me"); +export type I18n = typeof i18n; + +export const MeFrTranslations: Translations<"fr">["Me"] = { + my_account: "Mon compte", + firstname: ({ firstName }) => ( + <> + Prénom : {firstName} + + ), + lastname: ({ lastName }) => ( + <> + Nom : {lastName} + + ), + username: ({ userName }) => ( + <> + Pseudo : {userName} + + ), + email: ({ email }) => ( + <> + Adresse email : {email} + + ), + registration_date: ({ date }) => ( + <> + Date d'inscription : {date} + + ), + id: ({ id }) => ( + <> + Identifiant utilisateur : {id} + + ), + userid_copied: "Identifiant utilisateur copié", + manage_my_account: "Modifier mes informations", +}; + +export const MeEnTranslations: Translations<"en">["Me"] = { + my_account: "My account", + firstname: ({ firstName }) => ( + <> + First name: {firstName} + + ), + lastname: ({ lastName }) => ( + <> + Name: {lastName} + + ), + username: ({ userName }) => ( + <> + Username : {userName} + + ), + email: ({ email }) => ( + <> + Email: {email} + + ), + registration_date: ({ date }) => ( + <> + Registration date: {date} + + ), + id: ({ id }) => ( + <> + User Id: {id} + + ), + userid_copied: "User Id copied", + manage_my_account: "Manage my account", +}; diff --git a/assets/entrepot/pages/users/me/Me.tsx b/assets/entrepot/pages/users/me/Me.tsx new file mode 100644 index 00000000..004e816d --- /dev/null +++ b/assets/entrepot/pages/users/me/Me.tsx @@ -0,0 +1,62 @@ +import { fr } from "@codegouvfr/react-dsfr"; +import Button from "@codegouvfr/react-dsfr/Button"; +import { useMemo } from "react"; + +import AppLayout from "../../../../components/Layout/AppLayout"; +import { datastoreNavItems } from "../../../../config/navItems/datastoreNavItems"; +import { getTranslation, useTranslation } from "../../../../i18n/i18n"; +import SymfonyRouting from "../../../../modules/Routing"; +import { useAuthStore } from "../../../../stores/AuthStore"; +import { useSnackbarStore } from "../../../../stores/SnackbarStore"; +import { formatDateFromISO } from "../../../../utils"; + +const Me = () => { + const { t: tCommon } = getTranslation("Common"); + const { t } = useTranslation({ Me }); + const user = useAuthStore((state) => state.user); + const navItems = useMemo(() => datastoreNavItems(), []); + + const setMessage = useSnackbarStore((state) => state.setMessage); + + return ( + +

{t("my_account")}

+ + {user && ( + <> +

{t("firstname", { firstName: user?.first_name ?? "" })}

+

{t("lastname", { lastName: user?.last_name ?? "" })}

+

{t("username", { userName: user?.user_name ?? "" })}

+

{t("email", { email: user.email })}

+

{t("registration_date", { date: formatDateFromISO(user.account_creation_date) })}

+
+ {t("id", { id: user.id })} +
+ + )} + + +
+ ); +}; + +export default Me; diff --git a/assets/entrepot/pages/users/permissions/PermissionsTr.tsx b/assets/entrepot/pages/users/permissions/Permissions.locale.tsx similarity index 91% rename from assets/entrepot/pages/users/permissions/PermissionsTr.tsx rename to assets/entrepot/pages/users/permissions/Permissions.locale.tsx index 81562e96..68dcf7c9 100644 --- a/assets/entrepot/pages/users/permissions/PermissionsTr.tsx +++ b/assets/entrepot/pages/users/permissions/Permissions.locale.tsx @@ -1,8 +1,8 @@ import { declareComponentKeys } from "i18nifty"; -import { Translations } from "../../../../i18n/i18n"; +import { Translations } from "../../../../i18n/types"; // traductions -export const { i18n } = declareComponentKeys< +const { i18n } = declareComponentKeys< | "title" | "services" | "no_permission" @@ -11,6 +11,7 @@ export const { i18n } = declareComponentKeys< | { K: "permission_expires_on"; P: { date: string }; R: string } | { K: "permission_granted_by"; P: { name: string }; R: string } >()("Permissions"); +export type I18n = typeof i18n; export const PermissionsFrTranslations: Translations<"fr">["Permissions"] = { title: "Permissions", diff --git a/assets/espaceco/pages/communities/EspaceCoCommunitiesTr.ts b/assets/espaceco/pages/communities/EspaceCoCommunities.locale.tsx similarity index 92% rename from assets/espaceco/pages/communities/EspaceCoCommunitiesTr.ts rename to assets/espaceco/pages/communities/EspaceCoCommunities.locale.tsx index d4171b66..f53f584d 100644 --- a/assets/espaceco/pages/communities/EspaceCoCommunitiesTr.ts +++ b/assets/espaceco/pages/communities/EspaceCoCommunities.locale.tsx @@ -1,9 +1,10 @@ import { declareComponentKeys } from "i18nifty"; -import { Translations } from "../../../i18n/i18n"; + import { CommunityListFilter } from "../../../@types/app_espaceco"; +import type { Translations } from "../../../i18n/types"; // traductions -export const { i18n } = declareComponentKeys< +const { i18n } = declareComponentKeys< | "title" | "filters" | "all_public_communities" @@ -15,6 +16,7 @@ export const { i18n } = declareComponentKeys< | "loading" | "show_details" >()("EspaceCoCommunities"); +export type I18n = typeof i18n; export const EspaceCoCommunitiesFrTranslations: Translations<"fr">["EspaceCoCommunities"] = { title: "Liste des guichets", diff --git a/assets/i18n/Common.tsx b/assets/i18n/Common.locale.tsx similarity index 93% rename from assets/i18n/Common.tsx rename to assets/i18n/Common.locale.tsx index 7e83649f..a38357fd 100644 --- a/assets/i18n/Common.tsx +++ b/assets/i18n/Common.locale.tsx @@ -1,6 +1,7 @@ -import { declareComponentKeys, type Translations } from "./i18n"; +import { declareComponentKeys } from "./i18n"; +import { type Translations } from "./types"; -export const { i18n } = declareComponentKeys< +const { i18n } = declareComponentKeys< | "warning" | "error" | "add" @@ -32,6 +33,7 @@ export const { i18n } = declareComponentKeys< | "url_copied" | "copy_to_clipboard" >()("Common"); +export type I18n = typeof i18n; export const commonFrTranslations: Translations<"fr">["Common"] = { warning: "Avertissement", diff --git a/assets/i18n/i18n.ts b/assets/i18n/i18n.ts index 0ea494be..36027e3b 100644 --- a/assets/i18n/i18n.ts +++ b/assets/i18n/i18n.ts @@ -1,73 +1,26 @@ -import { createI18nApi, declareComponentKeys, type GenericTranslations } from "i18nifty"; +import { createI18nApi, declareComponentKeys } from "i18nifty"; -// déclaration des langues -/** liste des langues supportées */ -export const languages = ["fr", "en"] as const; +import { ComponentKey, fallbackLanguage, languages } from "./types"; -/** langue de fallback */ -export const fallbackLanguage = "fr"; - -/** nom d'affichage des langues */ -export const languagesDisplayNames: Record = { - fr: "Français", - en: "English", -}; - -// types -export type Language = (typeof languages)[number]; -export type ComponentKey = - | typeof import("./Common").i18n - | typeof import("./Breadcrumb").i18n - | typeof import("./Rights").i18n - | typeof import("./Style").i18n - | typeof import("../entrepot/pages/users/Me").i18n - | typeof import("../entrepot/pages/communities/AddMember").i18n - | typeof import("../entrepot/pages/communities/CommunityMembers").i18n - | typeof import("../entrepot/pages/dashboard/DashboardPro").i18n - | typeof import("../entrepot/pages/users/MyAccessKeys").i18n - | typeof import("../entrepot/pages/users/keys/UserKeysListTab").i18n - | typeof import("../entrepot/pages/users/keys/UserKeyTr").i18n - | typeof import("../entrepot/pages/users/permissions/PermissionsTr").i18n - | typeof import("../entrepot/pages/service/metadatas/metadatas-form-tr").i18n - | typeof import("../entrepot/pages/service/metadatas/metadatas-validation-tr").i18n - | typeof import("../entrepot/pages/AccessesRequest").i18n - | typeof import("../pages/assistance/contact/Contact").i18n - | typeof import("../entrepot/pages/datastore/ManageStorage/DatastoreManageStorage").i18n - | typeof import("../entrepot/pages/datastore/ManagePermissions/DatastorePermissionsTr").i18n - | typeof import("../entrepot/pages/datasheet/DatasheetNew/DatasheetUploadForm").i18n - | typeof import("../entrepot/pages/datasheet/DatasheetList/DatasheetList").i18n - | typeof import("../entrepot/pages/datasheet/DatasheetView/DatasetListTab/VectorDbList/VectorDbListItem").i18n - | typeof import("../entrepot/pages/datasheet/DatasheetView/DatasetListTab/PyramidVectorList/PyramidVectorListItem").i18n - | typeof import("../entrepot/pages/datasheet/DatasheetView/DatasetListTab/PyramidRasterList/PyramidRasterListItem").i18n - | typeof import("../entrepot/pages/datasheet/DatasheetView/DatasheetView").i18n - | typeof import("../config/navItems").i18n - | typeof import("../config/datastoreNavItems").i18n - | typeof import("../validations/SldStyleValidationErrorsTr").i18n - | typeof import("../validations/MapboxStyleValidator").i18n - | typeof import("../modules/Style/TMSStyleFilesManager").i18n - | typeof import("../entrepot/pages/service/wms-vector/WmsVectorServiceForm").i18n - | typeof import("../entrepot/pages/service/wfs/WfsServiceForm").i18n - | typeof import("../entrepot/pages/service/tms/PyramidVectorTmsServiceForm").i18n - | typeof import("../entrepot/pages/service/wms-raster-wmts/PyramidRasterGenerateForm").i18n - | typeof import("../entrepot/pages/service/wms-raster-wmts/PyramidRasterWmsRasterServiceForm").i18n - | typeof import("../entrepot/pages/service/wms-raster-wmts/PyramidRasterWmtsServiceForm").i18n - | typeof import("../entrepot/pages/service/TableSelection").i18n - | typeof import("../entrepot/pages/service/AccessRestrictions").i18n - | typeof import("../entrepot/pages/service/wms-vector/UploadStyleFile").i18n - | typeof import("../espaceco/pages/communities/EspaceCoCommunitiesTr").i18n - | typeof import("../pages/LoginDisabled").i18n; +export { declareComponentKeys }; -export type Translations = GenericTranslations; export type LocalizedString = Parameters[0]; /** initialisation de l'instance de i18n */ -export const { useTranslation, getTranslation, resolveLocalizedString, useLang, $lang, useResolveLocalizedString, useIsI18nFetching, I18nFetchingSuspense } = - createI18nApi()( - { languages, fallbackLanguage }, - { - en: () => import("./languages/en").then(({ translations }) => translations), - fr: () => import("./languages/fr").then(({ translations }) => translations), - } - ); - -export { declareComponentKeys }; +export const { + useTranslation, + resolveLocalizedString, + useLang, + $lang, + $readyLang, + useResolveLocalizedString, + useIsI18nFetching, + I18nFetchingSuspense, + getTranslation, +} = createI18nApi()( + { languages, fallbackLanguage }, + { + en: () => import("./languages/en").then(({ translations }) => translations), + fr: () => import("./languages/fr").then(({ translations }) => translations), + } +); diff --git a/assets/i18n/index.ts b/assets/i18n/index.ts new file mode 100644 index 00000000..b83bc14b --- /dev/null +++ b/assets/i18n/index.ts @@ -0,0 +1,4 @@ +export * from "./i18n"; + +export { fallbackLanguage, languages } from "./types"; +export type { Language } from "./types"; diff --git a/assets/i18n/languages/en.tsx b/assets/i18n/languages/en.tsx index 9b3d56af..88bd66b6 100644 --- a/assets/i18n/languages/en.tsx +++ b/assets/i18n/languages/en.tsx @@ -1,44 +1,44 @@ -import { datastoreNavItemsEnTranslations } from "../../config/datastoreNavItems"; -import { navItemsEnTranslations } from "../../config/navItems"; -import { AccessesRequestEnTranslations } from "../../entrepot/pages/AccessesRequest"; -import { AddMemberEnTranslations } from "../../entrepot/pages/communities/AddMember"; -import { CommunityMembersEnTranslations } from "../../entrepot/pages/communities/CommunityMembers"; -import { contactEnTranslations } from "../../pages/assistance/contact/Contact"; -import { DashboardProEnTranslations } from "../../entrepot/pages/dashboard/DashboardPro"; -import { DatasheetListEnTranslations } from "../../entrepot/pages/datasheet/DatasheetList/DatasheetList"; -import { PyramidVectorListItemEnTranslations } from "../../entrepot/pages/datasheet/DatasheetView/DatasetListTab/PyramidVectorList/PyramidVectorListItem"; -import { PyramidRasterListItemEnTranslations } from "../../entrepot/pages/datasheet/DatasheetView/DatasetListTab/PyramidRasterList/PyramidRasterListItem"; -import { VectorDbListItemEnTranslations } from "../../entrepot/pages/datasheet/DatasheetView/DatasetListTab/VectorDbList/VectorDbListItem"; -import { DatasheetViewEnTranslations } from "../../entrepot/pages/datasheet/DatasheetView/DatasheetView"; -import { DatastorePermissionsEnTranslations } from "../../entrepot/pages/datastore/ManagePermissions/DatastorePermissionsTr"; -import { DatastoreManageStorageEnTranslations } from "../../entrepot/pages/datastore/ManageStorage/DatastoreManageStorage"; -import { AccessRestrictionsEnTranslations } from "../../entrepot/pages/service/AccessRestrictions"; -import { TableSelectionEnTranslations } from "../../entrepot/pages/service/TableSelection"; -import { MetadatasFormEnTranslations } from "../../entrepot/pages/service/metadatas/metadatas-form-tr"; -import { ValidationMetadatasEnTranslations } from "../../entrepot/pages/service/metadatas/metadatas-validation-tr"; -import { PyramidVectorTmsServiceFormEnTranslations } from "../../entrepot/pages/service/tms/PyramidVectorTmsServiceForm"; -import { WfsServiceFormEnTranslations } from "../../entrepot/pages/service/wfs/WfsServiceForm"; -import { UploadStyleFileEnTranslations } from "../../entrepot/pages/service/wms-vector/UploadStyleFile"; -import { WmsVectorServiceFormEnTranslations } from "../../entrepot/pages/service/wms-vector/WmsVectorServiceForm"; -import { MeEnTranslations } from "../../entrepot/pages/users/Me"; -import { MyAccessKeysEnTranslations } from "../../entrepot/pages/users/MyAccessKeys"; -import { UserKeyEnTranslations } from "../../entrepot/pages/users/keys/UserKeyTr"; -import { UserKeysListTabEnTranslations } from "../../entrepot/pages/users/keys/UserKeysListTab"; -import { PermissionsEnTranslations } from "../../entrepot/pages/users/permissions/PermissionsTr"; -import { EspaceCoCommunitiesEnTranslations } from "../../espaceco/pages/communities/EspaceCoCommunitiesTr"; -import { TMSStyleFilesManagerEnTranslations } from "../../modules/Style/TMSStyleFilesManager"; -import { mapboxStyleValidationEnTranslations } from "../../validations/MapboxStyleValidator"; -import { SldStyleValidationErrorsEnTranslations } from "../../validations/SldStyleValidationErrorsTr"; -import { commonEnTranslations } from "../Common"; -import { BreadcrumbEnTranslations } from "../Breadcrumb"; -import { RightsEnTranslations } from "../Rights"; -import { StyleEnTranslations } from "../Style"; -import type { Translations } from "../i18n"; -import { DatasheetUploadFormEnTranslations } from "../../entrepot/pages/datasheet/DatasheetNew/DatasheetUploadForm"; -import { LoginDisabledEnTranslations } from "../../pages/LoginDisabled"; -import { PyramidRasterGenerateFormEnTranslations } from "../../entrepot/pages/service/wms-raster-wmts/PyramidRasterGenerateForm"; -import { PyramidRasterWmsRasterServiceFormEnTranslations } from "../../entrepot/pages/service/wms-raster-wmts/PyramidRasterWmsRasterServiceForm"; -import { PyramidRasterWmtsServiceFormEnTranslations } from "../../entrepot/pages/service/wms-raster-wmts/PyramidRasterWmtsServiceForm"; +import { datastoreNavItemsEnTranslations } from "../../config/navItems/datastoreNavItems.locale"; +import { navItemsEnTranslations } from "../../config/navItems/navItems.locale"; +import { AccessesRequestEnTranslations } from "../../entrepot/pages/accesses-request/AccessesRequest.locale"; +import { AddMemberEnTranslations } from "../../entrepot/pages/communities/AddMember/AddMember.locale"; +import { CommunityMembersEnTranslations } from "../../entrepot/pages/communities/CommunityMembers/CommunityMembers.locale"; +import { RightsEnTranslations } from "../../entrepot/pages/communities/Rights.locale"; +import { DashboardProEnTranslations } from "../../entrepot/pages/dashboard/DashboardPro.locale"; +import { DatasheetListEnTranslations } from "../../entrepot/pages/datasheet/DatasheetList/DatasheetList.locale"; +import { DatasheetUploadFormEnTranslations } from "../../entrepot/pages/datasheet/DatasheetNew/DatasheetUploadForm.locale"; +import { PyramidRasterListEnTranslations } from "../../entrepot/pages/datasheet/DatasheetView/DatasetListTab/PyramidRasterList/PyramidRasterList.locale"; +import { PyramidVectorListEnTranslations } from "../../entrepot/pages/datasheet/DatasheetView/DatasetListTab/PyramidVectorList/PyramidVectorList.locale"; +import { VectorDbListEnTranslations } from "../../entrepot/pages/datasheet/DatasheetView/DatasetListTab/VectorDbList/VectorDbList.locale"; +import { DatasheetViewEnTranslations } from "../../entrepot/pages/datasheet/DatasheetView/DatasheetView/DatasheetView.locale"; +import { DatastorePermissionsEnTranslations } from "../../entrepot/pages/datastore/ManagePermissions/DatastorePermissions.locale"; +import { DatastoreManageStorageEnTranslations } from "../../entrepot/pages/datastore/ManageStorage/DatastoreManageStorage.locale"; +import { AccessRestrictionsEnTranslations } from "../../entrepot/pages/service/common/AccessRestrictions/AccessRestrictions.locale"; +import { TableSelectionEnTranslations } from "../../entrepot/pages/service/common/TableSelection/TableSelection.locale"; +import { MetadatasFormEnTranslations } from "../../entrepot/pages/service/metadata/MetadataForm.locale"; +import { ValidationMetadatasEnTranslations } from "../../entrepot/pages/service/metadata/MetadataValidation.locale"; +import { PyramidVectorTmsServiceFormEnTranslations } from "../../entrepot/pages/service/tms/PyramidVectorTmsServiceForm/PyramidVectorTmsServiceForm.locale"; +import { StyleEnTranslations } from "../../entrepot/pages/service/view/Style/Style.locale"; +import { WfsServiceFormEnTranslations } from "../../entrepot/pages/service/wfs/WfsServiceForm.locale"; +import { PyramidRasterGenerateFormEnTranslations } from "../../entrepot/pages/service/wms-raster-wmts/PyramidRasterGenerateForm/PyramidRasterGenerateForm.locale"; +import { PyramidRasterWmsRasterServiceFormEnTranslations } from "../../entrepot/pages/service/wms-raster-wmts/PyramidRasterWmsRasterServiceForm/PyramidRasterWmsRasterServiceForm.locale"; +import { PyramidRasterWmtsServiceFormEnTranslations } from "../../entrepot/pages/service/wms-raster-wmts/PyramidRasterWmtsServiceForm/PyramidRasterWmtsServiceForm.locale"; +import { UploadStyleFileEnTranslations } from "../../entrepot/pages/service/wms-vector/UploadStyleFile.locale"; +import { WmsVectorServiceFormEnTranslations } from "../../entrepot/pages/service/wms-vector/WmsVectorServiceForm.locale"; +import { MyAccessKeysEnTranslations } from "../../entrepot/pages/users/access-keys/MyAccessKeys.locale"; +import { UserKeyEnTranslations } from "../../entrepot/pages/users/keys/UserKey.locale"; +import { UserKeysListTabEnTranslations } from "../../entrepot/pages/users/keys/UserKeysListTab/UserKeysListTab.locale"; +import { MeEnTranslations } from "../../entrepot/pages/users/me/Me.locale"; +import { PermissionsEnTranslations } from "../../entrepot/pages/users/permissions/Permissions.locale"; +import { EspaceCoCommunitiesEnTranslations } from "../../espaceco/pages/communities/EspaceCoCommunities.locale"; +import { TMSStyleFilesManagerEnTranslations } from "../../modules/Style/TMSStyleFilesManager/TMSStyleFilesManager.locale"; +import { BreadcrumbEnTranslations } from "../../modules/entrepot/breadcrumbs/Breadcrumb.locale"; +import { LoginDisabledEnTranslations } from "../../pages/LoginDisabled/LoginDisabled.locale"; +import { contactEnTranslations } from "../../pages/assistance/contact/Contact.locale"; +import { mapboxStyleValidationEnTranslations } from "../../validations/mapbox/MapboxStyleValidator.locale"; +import { SldStyleValidationErrorsEnTranslations } from "../../validations/sld/SldStyleValidation.locale"; +import { commonEnTranslations } from "../Common.locale"; +import type { Translations } from "../types"; export const translations: Translations<"en"> = { Common: commonEnTranslations, @@ -59,9 +59,9 @@ export const translations: Translations<"en"> = { AccessesRequest: AccessesRequestEnTranslations, navItems: navItemsEnTranslations, datastoreNavItems: datastoreNavItemsEnTranslations, - VectorDbListItem: VectorDbListItemEnTranslations, - PyramidVectorListItem: PyramidVectorListItemEnTranslations, - PyramidRasterListItem: PyramidRasterListItemEnTranslations, + VectorDbList: VectorDbListEnTranslations, + PyramidVectorList: PyramidVectorListEnTranslations, + PyramidRasterList: PyramidRasterListEnTranslations, DatasheetView: DatasheetViewEnTranslations, SldStyleValidationErrors: SldStyleValidationErrorsEnTranslations, mapboxStyleValidation: mapboxStyleValidationEnTranslations, diff --git a/assets/i18n/languages/fr.tsx b/assets/i18n/languages/fr.tsx index b04b0229..7890a030 100644 --- a/assets/i18n/languages/fr.tsx +++ b/assets/i18n/languages/fr.tsx @@ -1,44 +1,44 @@ -import { datastoreNavItemsFrTranslations } from "../../config/datastoreNavItems"; -import { navItemsFrTranslations } from "../../config/navItems"; -import { AccessesRequestFrTranslations } from "../../entrepot/pages/AccessesRequest"; -import { AddMemberFrTranslations } from "../../entrepot/pages/communities/AddMember"; -import { CommunityMembersFrTranslations } from "../../entrepot/pages/communities/CommunityMembers"; -import { DashboardProFrTranslations } from "../../entrepot/pages/dashboard/DashboardPro"; -import { DatasheetListFrTranslations } from "../../entrepot/pages/datasheet/DatasheetList/DatasheetList"; -import { DatasheetUploadFormFrTranslations } from "../../entrepot/pages/datasheet/DatasheetNew/DatasheetUploadForm"; -import { PyramidVectorListItemFrTranslations } from "../../entrepot/pages/datasheet/DatasheetView/DatasetListTab/PyramidVectorList/PyramidVectorListItem"; -import { PyramidRasterListItemFrTranslations } from "../../entrepot/pages/datasheet/DatasheetView/DatasetListTab/PyramidRasterList/PyramidRasterListItem"; -import { VectorDbListItemFrTranslations } from "../../entrepot/pages/datasheet/DatasheetView/DatasetListTab/VectorDbList/VectorDbListItem"; -import { DatasheetViewFrTranslations } from "../../entrepot/pages/datasheet/DatasheetView/DatasheetView"; -import { DatastorePermissionsFrTranslations } from "../../entrepot/pages/datastore/ManagePermissions/DatastorePermissionsTr"; -import { DatastoreManageStorageFrTranslations } from "../../entrepot/pages/datastore/ManageStorage/DatastoreManageStorage"; -import { AccessRestrictionsFrTranslations } from "../../entrepot/pages/service/AccessRestrictions"; -import { TableSelectionFrTranslations } from "../../entrepot/pages/service/TableSelection"; -import { MetadatasFormFrTranslations } from "../../entrepot/pages/service/metadatas/metadatas-form-tr"; -import { ValidationMetadatasFrTranslations } from "../../entrepot/pages/service/metadatas/metadatas-validation-tr"; -import { PyramidVectorTmsServiceFormFrTranslations } from "../../entrepot/pages/service/tms/PyramidVectorTmsServiceForm"; -import { WfsServiceFormFrTranslations } from "../../entrepot/pages/service/wfs/WfsServiceForm"; -import { UploadStyleFileFrTranslations } from "../../entrepot/pages/service/wms-vector/UploadStyleFile"; -import { WmsVectorServiceFormFrTranslations } from "../../entrepot/pages/service/wms-vector/WmsVectorServiceForm"; -import { MeFrTranslations } from "../../entrepot/pages/users/Me"; -import { MyAccessKeysFrTranslations } from "../../entrepot/pages/users/MyAccessKeys"; -import { UserKeyFrTranslations } from "../../entrepot/pages/users/keys/UserKeyTr"; -import { UserKeysListTabFrTranslations } from "../../entrepot/pages/users/keys/UserKeysListTab"; -import { PermissionsFrTranslations } from "../../entrepot/pages/users/permissions/PermissionsTr"; -import { EspaceCoCommunitiesFrTranslations } from "../../espaceco/pages/communities/EspaceCoCommunitiesTr"; -import { TMSStyleFilesManagerFrTranslations } from "../../modules/Style/TMSStyleFilesManager"; -import { contactFrTranslations } from "../../pages/assistance/contact/Contact"; -import { mapboxStyleValidationFrTranslations } from "../../validations/MapboxStyleValidator"; -import { SldStyleValidationErrorsFrTranslations } from "../../validations/SldStyleValidationErrorsTr"; -import { commonFrTranslations } from "../Common"; -import { BreadcrumbFrTranslations } from "../Breadcrumb"; -import { RightsFrTranslations } from "../Rights"; -import { StyleFrTranslations } from "../Style"; -import type { Translations } from "../i18n"; -import { LoginDisabledFrTranslations } from "../../pages/LoginDisabled"; -import { PyramidRasterGenerateFormFrTranslations } from "../../entrepot/pages/service/wms-raster-wmts/PyramidRasterGenerateForm"; -import { PyramidRasterWmsRasterServiceFormFrTranslations } from "../../entrepot/pages/service/wms-raster-wmts/PyramidRasterWmsRasterServiceForm"; -import { PyramidRasterWmtsServiceFormFrTranslations } from "../../entrepot/pages/service/wms-raster-wmts/PyramidRasterWmtsServiceForm"; +import { datastoreNavItemsFrTranslations } from "../../config/navItems/datastoreNavItems.locale"; +import { navItemsFrTranslations } from "../../config/navItems/navItems.locale"; +import { AccessesRequestFrTranslations } from "../../entrepot/pages/accesses-request/AccessesRequest.locale"; +import { AddMemberFrTranslations } from "../../entrepot/pages/communities/AddMember/AddMember.locale"; +import { CommunityMembersFrTranslations } from "../../entrepot/pages/communities/CommunityMembers/CommunityMembers.locale"; +import { RightsFrTranslations } from "../../entrepot/pages/communities/Rights.locale"; +import { DashboardProFrTranslations } from "../../entrepot/pages/dashboard/DashboardPro.locale"; +import { DatasheetListFrTranslations } from "../../entrepot/pages/datasheet/DatasheetList/DatasheetList.locale"; +import { DatasheetUploadFormFrTranslations } from "../../entrepot/pages/datasheet/DatasheetNew/DatasheetUploadForm.locale"; +import { PyramidRasterListFrTranslations } from "../../entrepot/pages/datasheet/DatasheetView/DatasetListTab/PyramidRasterList/PyramidRasterList.locale"; +import { PyramidVectorListFrTranslations } from "../../entrepot/pages/datasheet/DatasheetView/DatasetListTab/PyramidVectorList/PyramidVectorList.locale"; +import { VectorDbListFrTranslations } from "../../entrepot/pages/datasheet/DatasheetView/DatasetListTab/VectorDbList/VectorDbList.locale"; +import { DatasheetViewFrTranslations } from "../../entrepot/pages/datasheet/DatasheetView/DatasheetView/DatasheetView.locale"; +import { DatastorePermissionsFrTranslations } from "../../entrepot/pages/datastore/ManagePermissions/DatastorePermissions.locale"; +import { DatastoreManageStorageFrTranslations } from "../../entrepot/pages/datastore/ManageStorage/DatastoreManageStorage.locale"; +import { AccessRestrictionsFrTranslations } from "../../entrepot/pages/service/common/AccessRestrictions/AccessRestrictions.locale"; +import { TableSelectionFrTranslations } from "../../entrepot/pages/service/common/TableSelection/TableSelection.locale"; +import { MetadatasFormFrTranslations } from "../../entrepot/pages/service/metadata/MetadataForm.locale"; +import { ValidationMetadatasFrTranslations } from "../../entrepot/pages/service/metadata/MetadataValidation.locale"; +import { PyramidVectorTmsServiceFormFrTranslations } from "../../entrepot/pages/service/tms/PyramidVectorTmsServiceForm/PyramidVectorTmsServiceForm.locale"; +import { StyleFrTranslations } from "../../entrepot/pages/service/view/Style/Style.locale"; +import { WfsServiceFormFrTranslations } from "../../entrepot/pages/service/wfs/WfsServiceForm.locale"; +import { PyramidRasterGenerateFormFrTranslations } from "../../entrepot/pages/service/wms-raster-wmts/PyramidRasterGenerateForm/PyramidRasterGenerateForm.locale"; +import { PyramidRasterWmsRasterServiceFormFrTranslations } from "../../entrepot/pages/service/wms-raster-wmts/PyramidRasterWmsRasterServiceForm/PyramidRasterWmsRasterServiceForm.locale"; +import { PyramidRasterWmtsServiceFormFrTranslations } from "../../entrepot/pages/service/wms-raster-wmts/PyramidRasterWmtsServiceForm/PyramidRasterWmtsServiceForm.locale"; +import { UploadStyleFileFrTranslations } from "../../entrepot/pages/service/wms-vector/UploadStyleFile.locale"; +import { WmsVectorServiceFormFrTranslations } from "../../entrepot/pages/service/wms-vector/WmsVectorServiceForm.locale"; +import { MyAccessKeysFrTranslations } from "../../entrepot/pages/users/access-keys/MyAccessKeys.locale"; +import { UserKeyFrTranslations } from "../../entrepot/pages/users/keys/UserKey.locale"; +import { UserKeysListTabFrTranslations } from "../../entrepot/pages/users/keys/UserKeysListTab/UserKeysListTab.locale"; +import { MeFrTranslations } from "../../entrepot/pages/users/me/Me.locale"; +import { PermissionsFrTranslations } from "../../entrepot/pages/users/permissions/Permissions.locale"; +import { EspaceCoCommunitiesFrTranslations } from "../../espaceco/pages/communities/EspaceCoCommunities.locale"; +import { TMSStyleFilesManagerFrTranslations } from "../../modules/Style/TMSStyleFilesManager/TMSStyleFilesManager.locale"; +import { BreadcrumbFrTranslations } from "../../modules/entrepot/breadcrumbs/Breadcrumb.locale"; +import { LoginDisabledFrTranslations } from "../../pages/LoginDisabled/LoginDisabled.locale"; +import { contactFrTranslations } from "../../pages/assistance/contact/Contact.locale"; +import { mapboxStyleValidationFrTranslations } from "../../validations/mapbox/MapboxStyleValidator.locale"; +import { SldStyleValidationErrorsFrTranslations } from "../../validations/sld/SldStyleValidation.locale"; +import { commonFrTranslations } from "../Common.locale"; +import type { Translations } from "../types"; export const translations: Translations<"fr"> = { Common: commonFrTranslations, @@ -59,9 +59,9 @@ export const translations: Translations<"fr"> = { AccessesRequest: AccessesRequestFrTranslations, navItems: navItemsFrTranslations, datastoreNavItems: datastoreNavItemsFrTranslations, - VectorDbListItem: VectorDbListItemFrTranslations, - PyramidVectorListItem: PyramidVectorListItemFrTranslations, - PyramidRasterListItem: PyramidRasterListItemFrTranslations, + VectorDbList: VectorDbListFrTranslations, + PyramidVectorList: PyramidVectorListFrTranslations, + PyramidRasterList: PyramidRasterListFrTranslations, DatasheetView: DatasheetViewFrTranslations, SldStyleValidationErrors: SldStyleValidationErrorsFrTranslations, mapboxStyleValidation: mapboxStyleValidationFrTranslations, diff --git a/assets/i18n/types.ts b/assets/i18n/types.ts new file mode 100644 index 00000000..f13dbae6 --- /dev/null +++ b/assets/i18n/types.ts @@ -0,0 +1,60 @@ +import type { GenericTranslations } from "i18nifty"; + +// déclaration des langues +/** liste des langues supportées */ +export const languages = ["fr", "en"] as const; + +/** langue de fallback */ +export const fallbackLanguage = "fr"; + +/** nom d'affichage des langues */ +export const languagesDisplayNames: Record = { + fr: "Français", + en: "English", +}; + +// types +export type Language = (typeof languages)[number]; +export type ComponentKey = + | import("./Common.locale").I18n + | import("../modules/entrepot/breadcrumbs/Breadcrumb.locale").I18n + | import("../entrepot/pages/communities/Rights.locale").I18n + | import("../entrepot/pages/service/view/Style/Style.locale").I18n + | import("../entrepot/pages/users/me/Me.locale").I18n + | import("../entrepot/pages/communities/AddMember/AddMember.locale").I18n + | import("../entrepot/pages/communities/CommunityMembers/CommunityMembers.locale").I18n + | import("../entrepot/pages/dashboard/DashboardPro.locale").I18n + | import("../entrepot/pages/users/access-keys/MyAccessKeys.locale").I18n + | import("../entrepot/pages/users/keys/UserKeysListTab/UserKeysListTab.locale").I18n + | import("../entrepot/pages/users/keys/UserKey.locale").I18n + | import("../entrepot/pages/users/permissions/Permissions.locale").I18n + | import("../entrepot/pages/service/metadata/MetadataForm.locale").I18n + | import("../entrepot/pages/service/metadata/MetadataValidation.locale").I18n + | import("../entrepot/pages/accesses-request/AccessesRequest.locale").I18n + | import("../pages/assistance/contact/Contact.locale").I18n + | import("../entrepot/pages/datastore/ManageStorage/DatastoreManageStorage.locale").I18n + | import("../entrepot/pages/datastore/ManagePermissions/DatastorePermissions.locale").I18n + | import("../entrepot/pages/datasheet/DatasheetNew/DatasheetUploadForm.locale").I18n + | import("../entrepot/pages/datasheet/DatasheetList/DatasheetList.locale").I18n + | import("../entrepot/pages/datasheet/DatasheetView/DatasetListTab/VectorDbList/VectorDbList.locale").I18n + | import("../entrepot/pages/datasheet/DatasheetView/DatasetListTab/PyramidVectorList/PyramidVectorList.locale").I18n + | import("../entrepot/pages/datasheet/DatasheetView/DatasetListTab/PyramidRasterList/PyramidRasterList.locale").I18n + | import("../entrepot/pages/datasheet/DatasheetView/DatasheetView/DatasheetView.locale").I18n + | import("../config/navItems/navItems.locale").I18n + | import("../config/navItems/datastoreNavItems.locale").I18n + | import("../validations/sld/SldStyleValidation.locale").I18n + | import("../validations/mapbox/MapboxStyleValidator.locale").I18n + | import("../modules/Style/TMSStyleFilesManager/TMSStyleFilesManager.locale").I18n + | import("../entrepot/pages/service/wms-vector/WmsVectorServiceForm.locale").I18n + | import("../entrepot/pages/service/wfs/WfsServiceForm.locale").I18n + | import("../entrepot/pages/service/tms/PyramidVectorTmsServiceForm/PyramidVectorTmsServiceForm.locale").I18n + | import("../entrepot/pages/service/wms-raster-wmts/PyramidRasterGenerateForm/PyramidRasterGenerateForm.locale").I18n + | import("../entrepot/pages/service/wms-raster-wmts/PyramidRasterWmsRasterServiceForm/PyramidRasterWmsRasterServiceForm.locale").I18n + | import("../entrepot/pages/service/wms-raster-wmts/PyramidRasterWmtsServiceForm/PyramidRasterWmtsServiceForm.locale").I18n + | import("../entrepot/pages/service/common/TableSelection/TableSelection.locale").I18n + | import("../entrepot/pages/service/common/AccessRestrictions/AccessRestrictions.locale").I18n + | import("../entrepot/pages/service/wms-vector/UploadStyleFile.locale").I18n + | import("../espaceco/pages/communities/EspaceCoCommunities.locale").I18n + | import("../pages/LoginDisabled/LoginDisabled.locale").I18n; + +export type Translations = GenericTranslations; diff --git a/assets/modules/Style/StyleFilesManager.ts b/assets/modules/Style/StyleFilesManager.ts index 0f46fb0d..25042eb2 100644 --- a/assets/modules/Style/StyleFilesManager.ts +++ b/assets/modules/Style/StyleFilesManager.ts @@ -1,7 +1,7 @@ import { Service, StyleFormat } from "../../@types/app"; import { OfferingDetailResponseDtoTypeEnum } from "../../@types/entrepot"; import WFSStyleFilesManager from "./WFSStyleFilesManager"; -import TMSStyleFilesManager from "./TMSStyleFilesManager"; +import TMSStyleFilesManager from "./TMSStyleFilesManager/TMSStyleFilesManager"; const getStyleFilesManager = (service: Service, inputFormat: StyleFormat) => { switch (service.type) { diff --git a/assets/modules/Style/TMSStyleFilesManager/TMSStyleFilesManager.locale.tsx b/assets/modules/Style/TMSStyleFilesManager/TMSStyleFilesManager.locale.tsx new file mode 100644 index 00000000..b180d8b1 --- /dev/null +++ b/assets/modules/Style/TMSStyleFilesManager/TMSStyleFilesManager.locale.tsx @@ -0,0 +1,16 @@ +import { declareComponentKeys } from "i18nifty"; +import { Translations } from "../../../i18n/types"; + +const { i18n } = declareComponentKeys<"metadata_not_defined" | "parsing_error" | "writing_error">()("TMSStyleFilesManager"); +export type I18n = typeof i18n; + +export const TMSStyleFilesManagerFrTranslations: Translations<"fr">["TMSStyleFilesManager"] = { + metadata_not_defined: "tms_metadata n'est pas defini dans le service", + parsing_error: "Erreur dans l’analyse du fichier", + writing_error: "Erreur dans l’écriture du style mapbox", +}; +export const TMSStyleFilesManagerEnTranslations: Translations<"en">["TMSStyleFilesManager"] = { + metadata_not_defined: "tms_metadata is not defined in service", + parsing_error: "File parsing error", + writing_error: "Writing mapbox style error", +}; diff --git a/assets/modules/Style/TMSStyleFilesManager.ts b/assets/modules/Style/TMSStyleFilesManager/TMSStyleFilesManager.ts similarity index 83% rename from assets/modules/Style/TMSStyleFilesManager.ts rename to assets/modules/Style/TMSStyleFilesManager/TMSStyleFilesManager.ts index dd795abb..0f65476d 100644 --- a/assets/modules/Style/TMSStyleFilesManager.ts +++ b/assets/modules/Style/TMSStyleFilesManager/TMSStyleFilesManager.ts @@ -1,13 +1,12 @@ -import { v4 as uuidv4 } from "uuid"; -import SldStyleParser from "geostyler-sld-parser"; import MapboxParser from "geostyler-mapbox-parser"; -import { Service, StyleForm, StyleFormat, TmsMetadata } from "../../@types/app"; -import BaseStyleFilesManager from "./BaseStyleFilesManager"; -import { Sources } from "mapbox-gl"; import QGISStyleParser from "geostyler-qgis-parser"; -import { declareComponentKeys } from "i18nifty"; -import { Translations, getTranslation } from "../../i18n/i18n"; +import SldStyleParser from "geostyler-sld-parser"; +import { Sources } from "mapbox-gl"; import { AnyLayer } from "mapbox-gl/index"; +import { v4 as uuidv4 } from "uuid"; +import { Service, StyleForm, StyleFormat, TmsMetadata } from "../../../@types/app"; +import { getTranslation } from "../../../i18n/i18n"; +import BaseStyleFilesManager from "../BaseStyleFilesManager"; const { t } = getTranslation("TMSStyleFilesManager"); @@ -133,16 +132,3 @@ export default class TMSStyleFilesManager implements BaseStyleFilesManager { }; } } - -export const { i18n } = declareComponentKeys<"metadata_not_defined" | "parsing_error" | "writing_error">()("TMSStyleFilesManager"); - -export const TMSStyleFilesManagerFrTranslations: Translations<"fr">["TMSStyleFilesManager"] = { - metadata_not_defined: "tms_metadata n'est pas defini dans le service", - parsing_error: "Erreur dans l’analyse du fichier", - writing_error: "Erreur dans l’écriture du style mapbox", -}; -export const TMSStyleFilesManagerEnTranslations: Translations<"en">["TMSStyleFilesManager"] = { - metadata_not_defined: "tms_metadata is not defined in service", - parsing_error: "File parsing error", - writing_error: "Writing mapbox style error", -}; diff --git a/assets/i18n/Breadcrumb.tsx b/assets/modules/entrepot/breadcrumbs/Breadcrumb.locale.tsx similarity index 97% rename from assets/i18n/Breadcrumb.tsx rename to assets/modules/entrepot/breadcrumbs/Breadcrumb.locale.tsx index aee075c8..f296467a 100644 --- a/assets/i18n/Breadcrumb.tsx +++ b/assets/modules/entrepot/breadcrumbs/Breadcrumb.locale.tsx @@ -1,6 +1,7 @@ -import { Translations, declareComponentKeys } from "./i18n"; +import { declareComponentKeys } from "../../../i18n/i18n"; +import { Translations } from "../../../i18n/types"; -export const { i18n } = declareComponentKeys< +const { i18n } = declareComponentKeys< | "dashboard_pro" | "about" | "contact" @@ -46,6 +47,7 @@ export const { i18n } = declareComponentKeys< | "datastore_pyramid_raster_wmts_service_edit" | "datastore_service_view" >()("Breadcrumb"); +export type I18n = typeof i18n; export const BreadcrumbFrTranslations: Translations<"fr">["Breadcrumb"] = { dashboard_pro: "Tableau de bord", diff --git a/assets/modules/entrepot/breadcrumbs.ts b/assets/modules/entrepot/breadcrumbs/Breadcrumb.ts similarity index 98% rename from assets/modules/entrepot/breadcrumbs.ts rename to assets/modules/entrepot/breadcrumbs/Breadcrumb.ts index 2ea3191a..633fe3c1 100644 --- a/assets/modules/entrepot/breadcrumbs.ts +++ b/assets/modules/entrepot/breadcrumbs/Breadcrumb.ts @@ -1,9 +1,9 @@ import { BreadcrumbProps } from "@codegouvfr/react-dsfr/Breadcrumb"; import { Route } from "type-route"; -import { getTranslation } from "../../i18n/i18n"; -import { routes } from "../../router/router"; -import { Datastore } from "../../@types/app"; +import { Datastore } from "../../../@types/app"; +import { getTranslation } from "../../../i18n/i18n"; +import { routes } from "../../../router/router"; const { t } = getTranslation("Breadcrumb"); diff --git a/assets/pages/LoginDisabled.tsx b/assets/pages/LoginDisabled.tsx deleted file mode 100644 index 2656a97b..00000000 --- a/assets/pages/LoginDisabled.tsx +++ /dev/null @@ -1,42 +0,0 @@ -import { fr } from "@codegouvfr/react-dsfr"; -import Alert from "@codegouvfr/react-dsfr/Alert"; -import Button from "@codegouvfr/react-dsfr/Button"; - -import AppLayout from "../components/Layout/AppLayout"; -import { declareComponentKeys, Translations, useTranslation } from "../i18n/i18n"; -import { routes } from "../router/router"; - -const LoginDisabled = () => { - const { t } = useTranslation("LoginDisabled"); - - return ( - -

{t("title")}

- - - - -
- ); -}; - -export default LoginDisabled; - -export const { i18n } = declareComponentKeys<"title" | "description" | "back_to_home">()({ - LoginDisabled, -}); - -export const LoginDisabledFrTranslations: Translations<"fr">["LoginDisabled"] = { - title: "Connexion momentanément désactivée", - description: - "L’accès à la partie connectée du site cartes.gouv.fr est temporairement indisponible en raison de travaux de maintenance de la Géoplateforme. Le reste du site reste accessible. Nous vous remercions de votre compréhension.", - back_to_home: "Revenir à l’accueil", -}; - -export const LoginDisabledEnTranslations: Translations<"en">["LoginDisabled"] = { - title: undefined, - description: undefined, - back_to_home: undefined, -}; diff --git a/assets/pages/LoginDisabled/LoginDisabled.locale.tsx b/assets/pages/LoginDisabled/LoginDisabled.locale.tsx new file mode 100644 index 00000000..aa48d388 --- /dev/null +++ b/assets/pages/LoginDisabled/LoginDisabled.locale.tsx @@ -0,0 +1,19 @@ +import { declareComponentKeys } from "i18nifty"; + +import { Translations } from "../../i18n/types"; + +const { i18n } = declareComponentKeys<"title" | "description" | "back_to_home">()("LoginDisabled"); +export type I18n = typeof i18n; + +export const LoginDisabledFrTranslations: Translations<"fr">["LoginDisabled"] = { + title: "Connexion momentanément désactivée", + description: + "L’accès à la partie connectée du site cartes.gouv.fr est temporairement indisponible en raison de travaux de maintenance de la Géoplateforme. Le reste du site reste accessible. Nous vous remercions de votre compréhension.", + back_to_home: "Revenir à l’accueil", +}; + +export const LoginDisabledEnTranslations: Translations<"en">["LoginDisabled"] = { + title: undefined, + description: undefined, + back_to_home: undefined, +}; diff --git a/assets/pages/LoginDisabled/LoginDisabled.tsx b/assets/pages/LoginDisabled/LoginDisabled.tsx new file mode 100644 index 00000000..8f3876aa --- /dev/null +++ b/assets/pages/LoginDisabled/LoginDisabled.tsx @@ -0,0 +1,25 @@ +import { fr } from "@codegouvfr/react-dsfr"; +import Alert from "@codegouvfr/react-dsfr/Alert"; +import Button from "@codegouvfr/react-dsfr/Button"; + +import AppLayout from "../../components/Layout/AppLayout"; +import { useTranslation } from "../../i18n/i18n"; +import { routes } from "../../router/router"; + +const LoginDisabled = () => { + const { t } = useTranslation("LoginDisabled"); + + return ( + +

{t("title")}

+ + + + +
+ ); +}; + +export default LoginDisabled; diff --git a/assets/pages/assistance/contact/Contact.locale.tsx b/assets/pages/assistance/contact/Contact.locale.tsx new file mode 100644 index 00000000..59227145 --- /dev/null +++ b/assets/pages/assistance/contact/Contact.locale.tsx @@ -0,0 +1,93 @@ +import { RegisteredLinkProps } from "@codegouvfr/react-dsfr/link"; +import { declareComponentKeys } from "i18nifty"; + +import { Translations } from "../../../i18n/types"; + +const { i18n } = declareComponentKeys< + | "title" + | "mandatory_fields" + | "form.error_title" + | { K: "form.explanation"; P: { docsLinkProps: RegisteredLinkProps }; R: JSX.Element } + | "form.email_contact" + | "form.email_contact_hint" + | "form.email_contact_mandatory_error" + | "form.email_contact_error" + | "form.lastName" + | "form.firstName" + | "form.organization" + | "form.message" + | "form.message_placeholder" + | { K: "form.message_minlength_error"; P: { min: number }; R: string } + | { K: "form.message_maxlength_error"; P: { max: number }; R: string } + | { K: "remaining_characters"; P: { num: number }; R: string } + | "message_sent" + | "send" + | { K: "form.infos"; P: { personalDataLinkProps: RegisteredLinkProps }; R: JSX.Element } +>()("Contact"); +export type I18n = typeof i18n; + +export const contactFrTranslations: Translations<"fr">["Contact"] = { + title: "Nous écrire", + mandatory_fields: "Sauf mention contraire “(optionnel)” dans le label, tous les champs sont obligatoires.", + "form.error_title": "Votre message n'a pas pu être envoyé", + "form.explanation": ({ docsLinkProps }) => ( + <> + {"Vous n’avez pas trouvé la réponse à votre question dans "} + {"l’aide en ligne"} + {" ? Vous souhaitez la configuration d’un espace de travail pour vos besoins ? Utilisez ce formulaire pour nous contacter."} + + ), + "form.email_contact": "Votre email", + "form.email_contact_hint": "Format attendu : nom@domaine.fr", + "form.email_contact_mandatory_error": "Veuillez saisir une adresse email", + "form.email_contact_error": "Veuillez saisir une adresse email valide", + "form.lastName": "Votre nom (optionnel)", + "form.firstName": "Votre prénom (optionnel)", + "form.organization": "Votre organisme (optionnel)", + "form.message": "Votre demande", + "form.message_placeholder": "Décrivez votre demande en quelques lignes", + "form.message_minlength_error": ({ min }) => `Veuillez saisir une demande d’au moins ${min} caractères.`, + "form.message_maxlength_error": ({ max }) => `Votre demande ne peut contenir que ${max} caractères.`, + remaining_characters: ({ num }) => `${num} caractères restants`, + message_sent: "Votre message est en cours d’envoi", + send: "Envoyer", + "form.infos": ({ personalDataLinkProps }) => ( + <> + {"Les informations recueillies à partir de ce formulaire sont nécessaires à la gestion de votre demande par les services de l’IGN concernés. "} + {"En savoir plus sur la gestion des données à caractère personnel"}. + + ), +}; + +export const contactEnTranslations: Translations<"en">["Contact"] = { + title: "Contact us", + mandatory_fields: "All fields are mandatory unless label states “optional”", + "form.error_title": "Your message could not be sent", + "form.explanation": ({ docsLinkProps }) => ( + <> + {"You did not find the answer to your question in "} + {"our documentation"} + {"? Do you want to configure a workspace for your needs? Use this form to contact us."} + + ), + "form.email_contact": "Email", + "form.email_contact_hint": "Expected format: name@domain.fr", + "form.email_contact_mandatory_error": "Enter an email address", + "form.email_contact_error": "Enter a valid email address", + "form.lastName": "Last name (optional)", + "form.firstName": "First name (optional)", + "form.organization": "Organization (optional)", + "form.message": "Message", + "form.message_placeholder": "Describe your request in a few lines", + "form.message_minlength_error": ({ min }) => `Message must be at least ${min} characters.`, + "form.message_maxlength_error": ({ max }) => `Message cannot exceed ${max} characters.`, + remaining_characters: ({ num }) => `${num} characters remaining`, + message_sent: "Your message is being sent", + send: "Send", + "form.infos": ({ personalDataLinkProps }) => ( + <> + {"The information collected from this form is necessary to process your request by the appropriate services at IGN. "} + {"Learn more about how personal data is stored and used"}. + + ), +}; diff --git a/assets/pages/assistance/contact/Contact.tsx b/assets/pages/assistance/contact/Contact.tsx index d61f9847..d36d74b5 100644 --- a/assets/pages/assistance/contact/Contact.tsx +++ b/assets/pages/assistance/contact/Contact.tsx @@ -3,17 +3,17 @@ import Alert from "@codegouvfr/react-dsfr/Alert"; import Button from "@codegouvfr/react-dsfr/Button"; import Input from "@codegouvfr/react-dsfr/Input"; import Select from "@codegouvfr/react-dsfr/Select"; -import { RegisteredLinkProps } from "@codegouvfr/react-dsfr/link"; import { yupResolver } from "@hookform/resolvers/yup"; import { TranslationFunction } from "i18nifty/typeUtils/TranslationFunction"; -import { JSX, useState } from "react"; +import { useState } from "react"; import { useForm } from "react-hook-form"; import * as yup from "yup"; import AppLayout from "../../../components/Layout/AppLayout"; import LoadingIcon from "../../../components/Utils/LoadingIcon"; import Wait from "../../../components/Utils/Wait"; -import { ComponentKey, declareComponentKeys, useTranslation, type Translations } from "../../../i18n/i18n"; +import { useTranslation } from "../../../i18n/i18n"; +import { ComponentKey } from "../../../i18n/types"; import SymfonyRouting from "../../../modules/Routing"; import { jsonFetch } from "../../../modules/jsonFetch"; import { routes } from "../../../router/router"; @@ -184,94 +184,3 @@ const Contact = () => { }; export default Contact; - -// traductions -export const { i18n } = declareComponentKeys< - | "title" - | "mandatory_fields" - | "form.error_title" - | { K: "form.explanation"; P: { docsLinkProps: RegisteredLinkProps }; R: JSX.Element } - | "form.email_contact" - | "form.email_contact_hint" - | "form.email_contact_mandatory_error" - | "form.email_contact_error" - | "form.lastName" - | "form.firstName" - | "form.organization" - | "form.message" - | "form.message_placeholder" - | { K: "form.message_minlength_error"; P: { min: number }; R: string } - | { K: "form.message_maxlength_error"; P: { max: number }; R: string } - | { K: "remaining_characters"; P: { num: number }; R: string } - | "message_sent" - | "send" - | { K: "form.infos"; P: { personalDataLinkProps: RegisteredLinkProps }; R: JSX.Element } ->()({ - Contact, -}); - -export const contactFrTranslations: Translations<"fr">["Contact"] = { - title: "Nous écrire", - mandatory_fields: "Sauf mention contraire “(optionnel)” dans le label, tous les champs sont obligatoires.", - "form.error_title": "Votre message n'a pas pu être envoyé", - "form.explanation": ({ docsLinkProps }) => ( - <> - {"Vous n’avez pas trouvé la réponse à votre question dans "} - {"l’aide en ligne"} - {" ? Vous souhaitez la configuration d’un espace de travail pour vos besoins ? Utilisez ce formulaire pour nous contacter."} - - ), - "form.email_contact": "Votre email", - "form.email_contact_hint": "Format attendu : nom@domaine.fr", - "form.email_contact_mandatory_error": "Veuillez saisir une adresse email", - "form.email_contact_error": "Veuillez saisir une adresse email valide", - "form.lastName": "Votre nom (optionnel)", - "form.firstName": "Votre prénom (optionnel)", - "form.organization": "Votre organisme (optionnel)", - "form.message": "Votre demande", - "form.message_placeholder": "Décrivez votre demande en quelques lignes", - "form.message_minlength_error": ({ min }) => `Veuillez saisir une demande d’au moins ${min} caractères.`, - "form.message_maxlength_error": ({ max }) => `Votre demande ne peut contenir que ${max} caractères.`, - remaining_characters: ({ num }) => `${num} caractères restants`, - message_sent: "Votre message est en cours d’envoi", - send: "Envoyer", - "form.infos": ({ personalDataLinkProps }) => ( - <> - {"Les informations recueillies à partir de ce formulaire sont nécessaires à la gestion de votre demande par les services de l’IGN concernés. "} - {"En savoir plus sur la gestion des données à caractère personnel"}. - - ), -}; - -export const contactEnTranslations: Translations<"en">["Contact"] = { - title: "Contact us", - mandatory_fields: "All fields are mandatory unless label states “optional”", - "form.error_title": "Your message could not be sent", - "form.explanation": ({ docsLinkProps }) => ( - <> - {"You did not find the answer to your question in "} - {"our documentation"} - {"? Do you want to configure a workspace for your needs? Use this form to contact us."} - - ), - "form.email_contact": "Email", - "form.email_contact_hint": "Expected format: name@domain.fr", - "form.email_contact_mandatory_error": "Enter an email address", - "form.email_contact_error": "Enter a valid email address", - "form.lastName": "Last name (optional)", - "form.firstName": "First name (optional)", - "form.organization": "Organization (optional)", - "form.message": "Message", - "form.message_placeholder": "Describe your request in a few lines", - "form.message_minlength_error": ({ min }) => `Message must be at least ${min} characters.`, - "form.message_maxlength_error": ({ max }) => `Message cannot exceed ${max} characters.`, - remaining_characters: ({ num }) => `${num} characters remaining`, - message_sent: "Your message is being sent", - send: "Send", - "form.infos": ({ personalDataLinkProps }) => ( - <> - {"The information collected from this form is necessary to process your request by the appropriate services at IGN. "} - {"Learn more about how personal data is stored and used"}. - - ), -}; diff --git a/assets/router/RouterRenderer.tsx b/assets/router/RouterRenderer.tsx index 1b75fe01..652b8f94 100644 --- a/assets/router/RouterRenderer.tsx +++ b/assets/router/RouterRenderer.tsx @@ -24,10 +24,10 @@ const Accessibility = lazy(() => import("../pages/footer/Accessibility")); const LegalNotice = lazy(() => import("../pages/footer/LegalNotice")); const PersonalData = lazy(() => import("../pages/footer/PersonalData")); const TermsOfService = lazy(() => import("../pages/footer/TermsOfService")); -const LoginDisabled = lazy(() => import("../pages/LoginDisabled")); +const LoginDisabled = lazy(() => import("../pages/LoginDisabled/LoginDisabled")); -const Me = lazy(() => import("../entrepot/pages/users/Me")); -const MyAccessKeys = lazy(() => import("../entrepot/pages/users/MyAccessKeys")); +const Me = lazy(() => import("../entrepot/pages/users/me/Me")); +const MyAccessKeys = lazy(() => import("../entrepot/pages/users/access-keys/MyAccessKeys")); const UserKeyForm = lazy(() => import("../entrepot/pages/users/keys/UserKeyForm")); const DatastoreManageStorage = lazy(() => import("../entrepot/pages/datastore/ManageStorage/DatastoreManageStorage")); @@ -40,27 +40,29 @@ const DatasheetList = lazy(() => import("../entrepot/pages/datasheet/DatasheetLi const DatasheetUploadForm = lazy(() => import("../entrepot/pages/datasheet/DatasheetNew/DatasheetUploadForm")); const DatasheetUploadIntegrationPage = lazy(() => import("../entrepot/pages/datasheet/DatasheetNew/DatasheetUploadIntegration/DatasheetUploadIntegrationPage")); -const DatasheetView = lazy(() => import("../entrepot/pages/datasheet/DatasheetView/DatasheetView")); +const DatasheetView = lazy(() => import("../entrepot/pages/datasheet/DatasheetView/DatasheetView/DatasheetView")); const StoredDataDetails = lazy(() => import("../entrepot/pages/stored_data/StoredDataDetails/StoredDataDetails")); const DatastoreCreationForm = lazy(() => import("../entrepot/pages/datastore/DatastoreCreationForm")); const Confirm = lazy(() => import("../entrepot/pages/datastore/Confirmation")); -const CommunityMembers = lazy(() => import("../entrepot/pages/communities/CommunityMembers")); +const CommunityMembers = lazy(() => import("../entrepot/pages/communities/CommunityMembers/CommunityMembers")); const CommunityList = lazy(() => import("../entrepot/pages/communities/CommunityList")); const WfsServiceForm = lazy(() => import("../entrepot/pages/service/wfs/WfsServiceForm")); const WmsVectorServiceForm = lazy(() => import("../entrepot/pages/service/wms-vector/WmsVectorServiceForm")); const PyramidVectorGenerateForm = lazy(() => import("../entrepot/pages/service/tms/PyramidVectorGenerateForm")); -const PyramidVectorTmsServiceForm = lazy(() => import("../entrepot/pages/service/tms/PyramidVectorTmsServiceForm")); -const PyramidRasterGenerateForm = lazy(() => import("../entrepot/pages/service/wms-raster-wmts/PyramidRasterGenerateForm")); -const PyramidRasterWmsRasterServiceForm = lazy(() => import("../entrepot/pages/service/wms-raster-wmts/PyramidRasterWmsRasterServiceForm")); -const PyramidRasterWmtsServiceForm = lazy(() => import("../entrepot/pages/service/wms-raster-wmts/PyramidRasterWmtsServiceForm")); +const PyramidVectorTmsServiceForm = lazy(() => import("../entrepot/pages/service/tms/PyramidVectorTmsServiceForm/PyramidVectorTmsServiceForm")); +const PyramidRasterGenerateForm = lazy(() => import("../entrepot/pages/service/wms-raster-wmts/PyramidRasterGenerateForm/PyramidRasterGenerateForm")); +const PyramidRasterWmsRasterServiceForm = lazy( + () => import("../entrepot/pages/service/wms-raster-wmts/PyramidRasterWmsRasterServiceForm/PyramidRasterWmsRasterServiceForm") +); +const PyramidRasterWmtsServiceForm = lazy(() => import("../entrepot/pages/service/wms-raster-wmts/PyramidRasterWmtsServiceForm/PyramidRasterWmtsServiceForm")); const ServiceView = lazy(() => import("../entrepot/pages/service/view/ServiceView")); -const AccessesRequest = lazy(() => import("../entrepot/pages/AccessesRequest")); +const AccessesRequest = lazy(() => import("../entrepot/pages/accesses-request/AccessesRequest")); const EspaceCoCommunityList = lazy(() => import("../espaceco/pages/communities/Communities")); diff --git a/assets/validations/index.ts b/assets/validations/index.ts index e3a642e5..8a0e4c12 100644 --- a/assets/validations/index.ts +++ b/assets/validations/index.ts @@ -1,8 +1,8 @@ import metadata from "./metadata"; -import sldStyle from "./sldStyle"; -import SldStyleValidator from "./SldStyleValidator"; +import sldStyle from "./sld/sldStyle"; +import SldStyleValidator from "./sld/SldStyleValidator"; import QGisStyleValidator from "./QGisStyleValidator"; -import MapboxStyleValidator from "./MapboxStyleValidator"; +import MapboxStyleValidator from "./mapbox/MapboxStyleValidator"; import { Service, StyleFormat } from "../@types/app"; const getValidator = (service: Service, format: StyleFormat | undefined) => { diff --git a/assets/validations/mapbox/MapboxStyleValidator.locale.tsx b/assets/validations/mapbox/MapboxStyleValidator.locale.tsx new file mode 100644 index 00000000..41041b00 --- /dev/null +++ b/assets/validations/mapbox/MapboxStyleValidator.locale.tsx @@ -0,0 +1,29 @@ +import { declareComponentKeys } from "i18nifty"; +import { Translations } from "../../i18n/types"; + +const { i18n } = declareComponentKeys< + | "no_source" + | "only_one_source" + | "source_is_missing" + | "source_layer_is_missing" + | { K: "source_layer_not_matching"; P: { layer: string }; R: string } + | { K: "incorrect_source"; P: { layer: string; source: string }; R: string } +>()("mapboxStyleValidation"); +export type I18n = typeof i18n; + +export const mapboxStyleValidationFrTranslations: Translations<"fr">["mapboxStyleValidation"] = { + no_source: "Il n'y a aucune source de données", + only_one_source: "Il ne doit y avoir qu'une seule source de données", + source_is_missing: "Layer: la source est obligatoire", + source_layer_is_missing: "Layer : source-layer est obligatoire", + source_layer_not_matching: ({ layer }) => `source-layer [${layer}] ne correspond à aucun layer du service`, + incorrect_source: ({ layer, source }) => `Layer [${layer}] doit avoir comme source de données [${source}]`, +}; +export const mapboxStyleValidationEnTranslations: Translations<"en">["mapboxStyleValidation"] = { + no_source: "No data source", + only_one_source: "There must only be one data source", + source_is_missing: "Layer: source is mandatory", + source_layer_is_missing: "Layer: source-layer is mandatory", + source_layer_not_matching: ({ layer }) => `source-layer [${layer}] does not correspond to any layer of the service`, + incorrect_source: ({ layer, source }) => `Layer [${layer}] must have [${source}] as its data source`, +}; diff --git a/assets/validations/MapboxStyleValidator.ts b/assets/validations/mapbox/MapboxStyleValidator.ts similarity index 64% rename from assets/validations/MapboxStyleValidator.ts rename to assets/validations/mapbox/MapboxStyleValidator.ts index 200b5ac7..b60360c2 100644 --- a/assets/validations/MapboxStyleValidator.ts +++ b/assets/validations/mapbox/MapboxStyleValidator.ts @@ -1,10 +1,9 @@ import MapboxParser from "geostyler-mapbox-parser"; -import { declareComponentKeys } from "i18nifty"; import { TestContext, ValidationError } from "yup"; -import { Service, StyleFormat } from "../@types/app"; -import { Translations, getTranslation } from "../i18n/i18n"; -import getWebService from "../modules/WebServices/WebServices"; -import StyleValidator from "./StyleValidator"; +import { Service, StyleFormat } from "../../@types/app"; +import { getTranslation } from "../../i18n/i18n"; +import getWebService from "../../modules/WebServices/WebServices"; +import StyleValidator from "../StyleValidator"; const { t: tMapbox } = getTranslation("mapboxStyleValidation"); @@ -93,29 +92,3 @@ export default class MapboxStyleValidator extends StyleValidator { } } } - -export const { i18n } = declareComponentKeys< - | "no_source" - | "only_one_source" - | "source_is_missing" - | "source_layer_is_missing" - | { K: "source_layer_not_matching"; P: { layer: string }; R: string } - | { K: "incorrect_source"; P: { layer: string; source: string }; R: string } ->()("mapboxStyleValidation"); - -export const mapboxStyleValidationFrTranslations: Translations<"fr">["mapboxStyleValidation"] = { - no_source: "Il n'y a aucune source de données", - only_one_source: "Il ne doit y avoir qu'une seule source de données", - source_is_missing: "Layer: la source est obligatoire", - source_layer_is_missing: "Layer : source-layer est obligatoire", - source_layer_not_matching: ({ layer }) => `source-layer [${layer}] ne correspond à aucun layer du service`, - incorrect_source: ({ layer, source }) => `Layer [${layer}] doit avoir comme source de données [${source}]`, -}; -export const mapboxStyleValidationEnTranslations: Translations<"en">["mapboxStyleValidation"] = { - no_source: "No data source", - only_one_source: "There must only be one data source", - source_is_missing: "Layer: source is mandatory", - source_layer_is_missing: "Layer: source-layer is mandatory", - source_layer_not_matching: ({ layer }) => `source-layer [${layer}] does not correspond to any layer of the service`, - incorrect_source: ({ layer, source }) => `Layer [${layer}] must have [${source}] as its data source`, -}; diff --git a/assets/validations/SldStyleValidationErrorsTr.tsx b/assets/validations/sld/SldStyleValidation.locale.tsx similarity index 95% rename from assets/validations/SldStyleValidationErrorsTr.tsx rename to assets/validations/sld/SldStyleValidation.locale.tsx index d9c23540..311ad677 100644 --- a/assets/validations/SldStyleValidationErrorsTr.tsx +++ b/assets/validations/sld/SldStyleValidation.locale.tsx @@ -1,7 +1,7 @@ import { declareComponentKeys } from "i18nifty/declareComponentKeys"; -import { Translations } from "../i18n/i18n"; +import { Translations } from "../../i18n/types"; -export const { i18n } = declareComponentKeys< +const { i18n } = declareComponentKeys< | { K: "no_file_provided"; P: { tableName: string }; R: string } | { K: "unaccepted_extension"; P: { fileName: string }; R: string } | "file_invalid" @@ -13,6 +13,7 @@ export const { i18n } = declareComponentKeys< | { K: "geostyler_parse_error"; P: { geostylerError: string }; R: string } | { K: "geostyler_unexpected_error"; P: { geostylerError: string }; R: string } >()("SldStyleValidationErrors"); +export type I18n = typeof i18n; export const SldStyleValidationErrorsFrTranslations: Translations<"fr">["SldStyleValidationErrors"] = { no_file_provided: ({ tableName }) => `Veuillez fournir un fichier de style pour la table ${tableName}`, diff --git a/assets/validations/SldStyleValidator.ts b/assets/validations/sld/SldStyleValidator.ts similarity index 93% rename from assets/validations/SldStyleValidator.ts rename to assets/validations/sld/SldStyleValidator.ts index 931d8fdb..93bb2fcf 100644 --- a/assets/validations/SldStyleValidator.ts +++ b/assets/validations/sld/SldStyleValidator.ts @@ -1,8 +1,8 @@ import SldStyleParser from "geostyler-sld-parser"; import { TestContext, ValidationError } from "yup"; -import { Service, StyleFormat } from "../@types/app"; -import { getTranslation } from "../i18n/i18n"; -import StyleValidator from "./StyleValidator"; +import { Service, StyleFormat } from "../../@types/app"; +import { getTranslation } from "../../i18n/i18n"; +import StyleValidator from "../StyleValidator"; const { t: tSld } = getTranslation("SldStyleValidationErrors"); diff --git a/assets/validations/sldStyle.ts b/assets/validations/sld/sldStyle.ts similarity index 95% rename from assets/validations/sldStyle.ts rename to assets/validations/sld/sldStyle.ts index 4746ff12..b2212446 100644 --- a/assets/validations/sldStyle.ts +++ b/assets/validations/sld/sldStyle.ts @@ -1,10 +1,10 @@ import SldStyleParser from "geostyler-sld-parser"; import { TestContext } from "yup"; -import { Service } from "../@types/app"; -import { ConfigurationWmsVectorDetailsContent } from "../@types/entrepot"; -import { getTranslation } from "../i18n/i18n"; -import { getFileExtension } from "../utils"; +import { Service } from "../../@types/app"; +import { ConfigurationWmsVectorDetailsContent } from "../../@types/entrepot"; +import { getTranslation } from "../../i18n/i18n"; +import { getFileExtension } from "../../utils"; const { t: tSld } = getTranslation("SldStyleValidationErrors");