diff --git a/apps/console/src/components/form/PeopleSelectField.tsx b/apps/console/src/components/form/PeopleSelectField.tsx index fe49b78c4..24e2ba932 100644 --- a/apps/console/src/components/form/PeopleSelectField.tsx +++ b/apps/console/src/components/form/PeopleSelectField.tsx @@ -21,9 +21,9 @@ import { Avatar, Field, Option, Select } from "@probo/ui"; import { type ComponentProps, Suspense } from "react"; import { type Control, Controller, type FieldPath, type FieldValues } from "react-hook-form"; +import { useTranslation } from "react-i18next"; import { usePeople } from "#/hooks/graph/PeopleGraph"; -import { useTranslation } from "react-i18next"; type Props< TFieldValues extends FieldValues = FieldValues, diff --git a/apps/console/src/pages/iam/auth/AuthErrorPage.tsx b/apps/console/src/pages/iam/auth/AuthErrorPage.tsx index 2200a9f9f..cd4141a77 100644 --- a/apps/console/src/pages/iam/auth/AuthErrorPage.tsx +++ b/apps/console/src/pages/iam/auth/AuthErrorPage.tsx @@ -19,8 +19,8 @@ // SOFTWARE. import { usePageTitle } from "@probo/hooks"; -import { useTranslation } from "react-i18next"; import { Button } from "@probo/ui"; +import { useTranslation } from "react-i18next"; import { useSearchParams } from "react-router"; type AuthErrorContent = { diff --git a/apps/console/src/pages/iam/enroll/EnrollDevicePage.tsx b/apps/console/src/pages/iam/enroll/EnrollDevicePage.tsx index b72e2b414..bc081b59a 100644 --- a/apps/console/src/pages/iam/enroll/EnrollDevicePage.tsx +++ b/apps/console/src/pages/iam/enroll/EnrollDevicePage.tsx @@ -20,9 +20,9 @@ import { LaptopIcon } from "@phosphor-icons/react"; import { usePageTitle } from "@probo/hooks"; -import { useTranslation } from "react-i18next"; import { Button, Card } from "@probo/ui"; import { useCallback, useMemo, useState } from "react"; +import { useTranslation } from "react-i18next"; import { type PreloadedQuery, usePreloadedQuery } from "react-relay"; import { Link } from "react-router"; import { graphql } from "relay-runtime"; diff --git a/apps/console/src/pages/organizations/access-reviews/dialogs/_components/ConnectorDocumentationLink.tsx b/apps/console/src/pages/organizations/access-reviews/dialogs/_components/ConnectorDocumentationLink.tsx index a5a1afc3b..0e2109637 100644 --- a/apps/console/src/pages/organizations/access-reviews/dialogs/_components/ConnectorDocumentationLink.tsx +++ b/apps/console/src/pages/organizations/access-reviews/dialogs/_components/ConnectorDocumentationLink.tsx @@ -18,8 +18,8 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -import { useTranslation } from "react-i18next"; import { Button, IconArrowLink } from "@probo/ui"; +import { useTranslation } from "react-i18next"; type Props = { url?: string | null; diff --git a/apps/console/src/pages/organizations/access-reviews/dialogs/_lib/connectorSettings.ts b/apps/console/src/pages/organizations/access-reviews/dialogs/_lib/connectorSettings.ts index 875377f12..c182dd8d1 100644 --- a/apps/console/src/pages/organizations/access-reviews/dialogs/_lib/connectorSettings.ts +++ b/apps/console/src/pages/organizations/access-reviews/dialogs/_lib/connectorSettings.ts @@ -21,7 +21,7 @@ import type { ProviderInfo } from "../AddAccessReviewSourceDialog"; // DATADOG_SITES labels are technical identifiers (region code + hostname), -// intentionally not wrapped in __(). The dialog's prose strings are. +// intentionally not translated. The dialog's prose strings are. export const DATADOG_SITES: { value: string; label: string }[] = [ { value: "US1", label: "US1 (app.datadoghq.com)" }, { value: "US3", label: "US3 (us3.datadoghq.com)" }, diff --git a/apps/console/src/pages/organizations/devices/DeviceLayout.tsx b/apps/console/src/pages/organizations/devices/DeviceLayout.tsx index a75648462..1b159cf09 100644 --- a/apps/console/src/pages/organizations/devices/DeviceLayout.tsx +++ b/apps/console/src/pages/organizations/devices/DeviceLayout.tsx @@ -19,7 +19,6 @@ // SOFTWARE. import { usePageTitle } from "@probo/hooks"; -import { useTranslation } from "react-i18next"; import { Breadcrumb, Button, @@ -27,6 +26,7 @@ import { TabLink, Tabs, } from "@probo/ui"; +import { useTranslation } from "react-i18next"; import { type PreloadedQuery, usePreloadedQuery, diff --git a/apps/console/src/pages/organizations/devices/DevicesPage.tsx b/apps/console/src/pages/organizations/devices/DevicesPage.tsx index 86b0acf39..22107f19e 100644 --- a/apps/console/src/pages/organizations/devices/DevicesPage.tsx +++ b/apps/console/src/pages/organizations/devices/DevicesPage.tsx @@ -19,9 +19,9 @@ // SOFTWARE. import { usePageTitle } from "@probo/hooks"; -import { useTranslation } from "react-i18next"; import { Button, IconPlusLarge, PageHeader, Tbody, Th, Thead, Tr } from "@probo/ui"; import type { ComponentProps } from "react"; +import { useTranslation } from "react-i18next"; import { type PreloadedQuery, usePaginationFragment, diff --git a/apps/console/src/pages/organizations/devices/_components/DeviceDetailsCard.tsx b/apps/console/src/pages/organizations/devices/_components/DeviceDetailsCard.tsx index dad069953..227dfe033 100644 --- a/apps/console/src/pages/organizations/devices/_components/DeviceDetailsCard.tsx +++ b/apps/console/src/pages/organizations/devices/_components/DeviceDetailsCard.tsx @@ -18,10 +18,10 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -import { formatDate } from "@probo/helpers"; -import { useTranslation } from "react-i18next"; +import { dateFormat } from "@probo/i18n"; import { Badge, Card } from "@probo/ui"; import type { ReactNode } from "react"; +import { useTranslation } from "react-i18next"; import { useFragment } from "react-relay"; import { graphql } from "relay-runtime"; @@ -48,7 +48,7 @@ const deviceFragment = graphql` export function DeviceDetailsCard(props: { deviceFragmentRef: DeviceDetailsCard_deviceFragment$key; }) { - const { t } = useTranslation(); + const { i18n, t } = useTranslation(); const pendingLabel = t("devices.values.pending"); const device = useFragment(deviceFragment, props.deviceFragmentRef); @@ -88,12 +88,18 @@ export function DeviceDetailsCard(props: { diff --git a/apps/console/src/pages/organizations/devices/_components/DeviceRow.tsx b/apps/console/src/pages/organizations/devices/_components/DeviceRow.tsx index d84d44f05..c0b8b3001 100644 --- a/apps/console/src/pages/organizations/devices/_components/DeviceRow.tsx +++ b/apps/console/src/pages/organizations/devices/_components/DeviceRow.tsx @@ -18,8 +18,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -import { formatDate } from "@probo/helpers"; -import { useTranslation } from "react-i18next"; +import { dateFormat } from "@probo/i18n"; import { ActionDropdown, Badge, @@ -30,6 +29,7 @@ import { Tr, useDialogRef, } from "@probo/ui"; +import { useTranslation } from "react-i18next"; import { useFragment } from "react-relay"; import { graphql } from "relay-runtime"; @@ -67,7 +67,7 @@ interface DeviceRowProps { } export function DeviceRow({ canAssignDevice, canRevoke, fKey }: DeviceRowProps) { - const { t } = useTranslation(); + const { i18n, t } = useTranslation(); const organizationId = useOrganizationId(); const reassignDialogRef = useDialogRef(); const pendingLabel = t("devices.values.pending"); @@ -95,7 +95,11 @@ export function DeviceRow({ canAssignDevice, canRevoke, fKey }: DeviceRowProps) {displayValue(device.platform, pendingLabel)} {displayValue(device.osVersion, pendingLabel)} - {device.lastSeenAt ? formatDate(device.lastSeenAt) : t("devices.values.never")} + + {device.lastSeenAt + ? dateFormat(i18n.language, device.lastSeenAt) + : t("devices.values.never")} + {summary.pass} {" / "} diff --git a/apps/console/src/pages/organizations/devices/_components/PostureColumnHeader.tsx b/apps/console/src/pages/organizations/devices/_components/PostureColumnHeader.tsx index 0753d1ac3..e84437ef5 100644 --- a/apps/console/src/pages/organizations/devices/_components/PostureColumnHeader.tsx +++ b/apps/console/src/pages/organizations/devices/_components/PostureColumnHeader.tsx @@ -18,9 +18,9 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -import { useTranslation } from "react-i18next"; import { IconCircleInfo } from "@probo/ui"; import * as Popover from "@radix-ui/react-popover"; +import { useTranslation } from "react-i18next"; export function PostureColumnHeader() { const { t } = useTranslation(); diff --git a/apps/console/src/pages/organizations/devices/_lib/useRevokeDevice.ts b/apps/console/src/pages/organizations/devices/_lib/useRevokeDevice.ts index 6beca9103..c028346fa 100644 --- a/apps/console/src/pages/organizations/devices/_lib/useRevokeDevice.ts +++ b/apps/console/src/pages/organizations/devices/_lib/useRevokeDevice.ts @@ -19,9 +19,9 @@ // SOFTWARE. import { formatError } from "@probo/helpers"; -import { useTranslation } from "react-i18next"; import { useConfirm, useToast } from "@probo/ui"; import { useCallback } from "react"; +import { useTranslation } from "react-i18next"; import { useMutation } from "react-relay"; import { graphql } from "relay-runtime"; diff --git a/apps/console/src/pages/organizations/devices/dialogs/CreateDeviceDialog.tsx b/apps/console/src/pages/organizations/devices/dialogs/CreateDeviceDialog.tsx index c33947e8b..6d9d902be 100644 --- a/apps/console/src/pages/organizations/devices/dialogs/CreateDeviceDialog.tsx +++ b/apps/console/src/pages/organizations/devices/dialogs/CreateDeviceDialog.tsx @@ -19,7 +19,6 @@ // SOFTWARE. import { formatError } from "@probo/helpers"; -import { useTranslation } from "react-i18next"; import { Breadcrumb, Button, @@ -30,6 +29,7 @@ import { useToast, } from "@probo/ui"; import { type ReactNode, useState } from "react"; +import { useTranslation } from "react-i18next"; import { useMutation } from "react-relay"; import { graphql } from "relay-runtime"; import { z } from "zod"; diff --git a/apps/console/src/pages/organizations/devices/dialogs/ReassignDeviceDialog.tsx b/apps/console/src/pages/organizations/devices/dialogs/ReassignDeviceDialog.tsx index 034bcf1f1..c0434178a 100644 --- a/apps/console/src/pages/organizations/devices/dialogs/ReassignDeviceDialog.tsx +++ b/apps/console/src/pages/organizations/devices/dialogs/ReassignDeviceDialog.tsx @@ -19,7 +19,6 @@ // SOFTWARE. import { formatError } from "@probo/helpers"; -import { useTranslation } from "react-i18next"; import { Breadcrumb, Button, @@ -30,6 +29,7 @@ import { useToast, } from "@probo/ui"; import { useEffect, useMemo, useState } from "react"; +import { useTranslation } from "react-i18next"; import { useFragment, useMutation } from "react-relay"; import { graphql } from "relay-runtime"; import { z } from "zod"; diff --git a/apps/console/src/pages/organizations/devices/postures/_components/DevicePostureList.tsx b/apps/console/src/pages/organizations/devices/postures/_components/DevicePostureList.tsx index 9cf887a71..2aeac537b 100644 --- a/apps/console/src/pages/organizations/devices/postures/_components/DevicePostureList.tsx +++ b/apps/console/src/pages/organizations/devices/postures/_components/DevicePostureList.tsx @@ -18,8 +18,8 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -import { useTranslation } from "react-i18next"; import { Table, Tbody, Td, Th, Thead, Tr } from "@probo/ui"; +import { useTranslation } from "react-i18next"; import { useFragment } from "react-relay"; import { graphql } from "relay-runtime"; diff --git a/apps/console/src/pages/organizations/devices/postures/_components/DevicePostureListItem.tsx b/apps/console/src/pages/organizations/devices/postures/_components/DevicePostureListItem.tsx index a065e35db..90ccb6af5 100644 --- a/apps/console/src/pages/organizations/devices/postures/_components/DevicePostureListItem.tsx +++ b/apps/console/src/pages/organizations/devices/postures/_components/DevicePostureListItem.tsx @@ -18,12 +18,15 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -import { useTranslation } from "react-i18next"; +import { dateTimeFormat } from "@probo/i18n/date"; import { Badge, Td, Tr } from "@probo/ui"; +import { useTranslation } from "react-i18next"; import { useFragment } from "react-relay"; import { graphql } from "relay-runtime"; -import type { DevicePostureListItem_postureFragment$key } from "#/__generated__/core/DevicePostureListItem_postureFragment.graphql"; +import type { + DevicePostureListItem_postureFragment$key, +} from "#/__generated__/core/DevicePostureListItem_postureFragment.graphql"; import { statusVariant } from "../../_lib/deviceDisplay"; import { getPostureCheckLabel } from "../_lib/getPostureCheckLabel"; @@ -54,15 +57,7 @@ export function DevicePostureListItem({ postureKey }: DevicePostureListItemProps - {new Intl.DateTimeFormat(i18n.language, { - year: "numeric", - month: "short", - day: "numeric", - hour: "2-digit", - minute: "2-digit", - second: "2-digit", - hour12: false, - }).format(posture.observedAt)} + {dateTimeFormat(i18n.language, posture.observedAt)} ); diff --git a/apps/console/src/pages/organizations/employee/EmployeeDevicesPage.tsx b/apps/console/src/pages/organizations/employee/EmployeeDevicesPage.tsx index 6c30fe74d..fa5bd86fe 100644 --- a/apps/console/src/pages/organizations/employee/EmployeeDevicesPage.tsx +++ b/apps/console/src/pages/organizations/employee/EmployeeDevicesPage.tsx @@ -19,9 +19,9 @@ // SOFTWARE. import { usePageTitle } from "@probo/hooks"; -import { useTranslation } from "react-i18next"; import { Button, Card, IconPlusLarge, Tbody, Th, Thead, Tr } from "@probo/ui"; import { useTransition } from "react"; +import { useTranslation } from "react-i18next"; import { graphql, type PreloadedQuery, diff --git a/apps/console/src/pages/organizations/employee/_components/CreateDeviceForm.tsx b/apps/console/src/pages/organizations/employee/_components/CreateDeviceForm.tsx index f44729b67..4ed5c2a95 100644 --- a/apps/console/src/pages/organizations/employee/_components/CreateDeviceForm.tsx +++ b/apps/console/src/pages/organizations/employee/_components/CreateDeviceForm.tsx @@ -19,7 +19,6 @@ // SOFTWARE. import { formatError } from "@probo/helpers"; -import { useTranslation } from "react-i18next"; import { Button, Dialog, @@ -28,6 +27,7 @@ import { useToast, } from "@probo/ui"; import { useState } from "react"; +import { useTranslation } from "react-i18next"; import { useMutation } from "react-relay"; import { graphql } from "relay-runtime"; diff --git a/apps/console/src/pages/organizations/employee/_components/EmployeeDeviceListItem.tsx b/apps/console/src/pages/organizations/employee/_components/EmployeeDeviceListItem.tsx index 51f4f6c1d..7c4e7ef32 100644 --- a/apps/console/src/pages/organizations/employee/_components/EmployeeDeviceListItem.tsx +++ b/apps/console/src/pages/organizations/employee/_components/EmployeeDeviceListItem.tsx @@ -18,9 +18,9 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -import { formatDate } from "@probo/helpers"; -import { useTranslation } from "react-i18next"; +import { dateFormat } from "@probo/i18n"; import { Badge, Td, Tr } from "@probo/ui"; +import { useTranslation } from "react-i18next"; import { useFragment } from "react-relay"; import { graphql } from "relay-runtime"; @@ -54,7 +54,7 @@ function stateVariant(state: string): "success" | "warning" | "info" { } export function EmployeeDeviceListItem({ deviceKey }: EmployeeDeviceListItemProps) { - const { t } = useTranslation(); + const { i18n, t } = useTranslation(); const pendingLabel = t("devices.values.pending"); const device = useFragment(employeeDeviceListItemFragment, deviceKey); @@ -67,7 +67,11 @@ export function EmployeeDeviceListItem({ deviceKey }: EmployeeDeviceListItemProp {displayValue(device.platform, pendingLabel)} {displayValue(device.osVersion, pendingLabel)} - {device.lastSeenAt ? formatDate(device.lastSeenAt) : t("devices.values.never")} + + {device.lastSeenAt + ? dateFormat(i18n.language, device.lastSeenAt) + : t("devices.values.never")} + ); } diff --git a/apps/console/src/pages/organizations/employee/_components/EnrollmentInstructions.tsx b/apps/console/src/pages/organizations/employee/_components/EnrollmentInstructions.tsx index 3743d4187..f6ccc2ab9 100644 --- a/apps/console/src/pages/organizations/employee/_components/EnrollmentInstructions.tsx +++ b/apps/console/src/pages/organizations/employee/_components/EnrollmentInstructions.tsx @@ -18,8 +18,8 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -import { useTranslation } from "react-i18next"; import { Button, Card, useToast } from "@probo/ui"; +import { useTranslation } from "react-i18next"; const RELEASE_BASE_URL = "https://github.com/getprobo/probo/releases/latest/download"; diff --git a/apps/console/src/pages/organizations/enroll/_components/EnrollDeviceButton.tsx b/apps/console/src/pages/organizations/enroll/_components/EnrollDeviceButton.tsx index 9dd086dff..3db0644c1 100644 --- a/apps/console/src/pages/organizations/enroll/_components/EnrollDeviceButton.tsx +++ b/apps/console/src/pages/organizations/enroll/_components/EnrollDeviceButton.tsx @@ -19,7 +19,6 @@ // SOFTWARE. import { formatError } from "@probo/helpers"; -import { useTranslation } from "react-i18next"; import { Button, IconArrowsClockwise, @@ -27,6 +26,7 @@ import { useToast, } from "@probo/ui"; import { useEffect, useState } from "react"; +import { useTranslation } from "react-i18next"; import { fetchQuery, useMutation, useRelayEnvironment } from "react-relay"; import { graphql } from "relay-runtime"; diff --git a/packages/helpers/src/index.ts b/packages/helpers/src/index.ts index 20b092d74..76a749704 100644 --- a/packages/helpers/src/index.ts +++ b/packages/helpers/src/index.ts @@ -108,7 +108,6 @@ export { } from "./fileAccept"; export { formatDatetime, - formatDate, toDateInput, todayAsDateInput, parseDate,