chore: bump i18next from 21.9.1 to 22.5.0 in /site (#7812)

* chore: Bump i18next from 21.9.1 to 22.5.0 in /site

Bumps [i18next](https://github.com/i18next/i18next) from 21.9.1 to 22.5.0.
- [Release notes](https://github.com/i18next/i18next/releases)
- [Changelog](https://github.com/i18next/i18next/blob/master/CHANGELOG.md)
- [Commits](https://github.com/i18next/i18next/compare/v21.9.1...v22.5.0)

---
updated-dependencies:
- dependency-name: i18next
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* fix i18n types

* prettier

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Rodrigo Maia <rodrigo.maia.pereira@gmail.com>
This commit is contained in:
dependabot[bot]
2023-06-09 18:54:17 -05:00
committed by GitHub
parent 634e146032
commit 1ec463d74d
24 changed files with 102 additions and 99 deletions

View File

@ -64,7 +64,7 @@
"formik": "2.4.1",
"front-matter": "4.0.2",
"history": "5.3.0",
"i18next": "21.9.1",
"i18next": "22.5.0",
"jest-environment-jsdom": "29.5.0",
"jest-location-mock": "1.0.9",
"just-debounce-it": "3.1.1",

View File

@ -11,7 +11,7 @@ import { render } from "testHelpers/renderHelpers"
import { screen } from "@testing-library/react"
import { i18n } from "i18n"
const t = (str: string, variables?: Record<string, unknown>) =>
const t = (str: string, variables: Record<string, unknown>) =>
i18n.t<string>(str, variables)
const getByTextContent = (text: string) => {

View File

@ -77,7 +77,7 @@ export const EditRolesButton: FC<EditRolesButtonProps> = ({
ref={anchorRef}
size="small"
className={styles.editButton}
title={t("editUserRolesTooltip")}
title={t("editUserRolesTooltip") || ""}
onClick={() => setIsOpen(true)}
>
<EditSquare />
@ -101,7 +101,7 @@ export const EditRolesButton: FC<EditRolesButtonProps> = ({
<fieldset
className={styles.fieldset}
disabled={isLoading}
title={t("fieldSetRolesTooltip")}
title={t("fieldSetRolesTooltip") || ""}
>
<Stack className={styles.options} spacing={3}>
{roles.map((role) => (

View File

@ -118,6 +118,10 @@ export const FormFooter: FC<BaseFormFooterProps> = (props) => {
/>
)
}
const getFlexDirection = ({ direction }: FormContextValue = {}):
| "row"
| "column" =>
direction === "horizontal" ? ("row" as const) : ("column" as const)
const useStyles = makeStyles((theme) => ({
form: {
@ -136,8 +140,7 @@ const useStyles = makeStyles((theme) => ({
alignItems: "flex-start",
gap: ({ direction }: FormContextValue = {}) =>
direction === "horizontal" ? theme.spacing(15) : theme.spacing(3),
flexDirection: ({ direction }: FormContextValue = {}) =>
direction === "horizontal" ? "row" : "column",
flexDirection: getFlexDirection,
[theme.breakpoints.down("md")]: {
flexDirection: "column",
@ -156,7 +159,7 @@ const useStyles = makeStyles((theme) => ({
[theme.breakpoints.down("md")]: {
width: "100%",
position: "initial",
position: "initial" as const,
},
},

View File

@ -19,14 +19,14 @@ import Link from "@mui/material/Link"
// connected:ready, connected:shutting_down, connected:shutdown_timeout,
// connected:shutdown_error, connected:off.
const ReadyLifecycle: React.FC = () => {
const ReadyLifecycle = () => {
const styles = useStyles()
const { t } = useTranslation("workspacePage")
return (
<div
role="status"
aria-label={t("agentStatus.connected.ready")}
aria-label={t("agentStatus.connected.ready") || "Ready"}
className={combineClasses([styles.status, styles.connected])}
/>
)
@ -34,13 +34,12 @@ const ReadyLifecycle: React.FC = () => {
const StartingLifecycle: React.FC = () => {
const styles = useStyles()
const { t } = useTranslation("workspacePage")
return (
<Tooltip title={t("agentStatus.connected.starting")}>
<Tooltip title="Starting...">
<div
role="status"
aria-label={t("agentStatus.connected.starting")}
aria-label="Starting..."
className={combineClasses([styles.status, styles.connecting])}
/>
</Tooltip>
@ -135,13 +134,12 @@ const StartErrorLifecycle: React.FC<{
const ShuttingDownLifecycle: React.FC = () => {
const styles = useStyles()
const { t } = useTranslation("workspacePage")
return (
<Tooltip title={t("agentStatus.connected.shuttingDown")}>
<Tooltip title="Stopping...">
<div
role="status"
aria-label={t("agentStatus.connected.shuttingDown")}
aria-label="Stopping..."
className={combineClasses([styles.status, styles.connecting])}
/>
</Tooltip>
@ -236,13 +234,12 @@ const ShutdownErrorLifecycle: React.FC<{
const OffLifecycle: React.FC = () => {
const styles = useStyles()
const { t } = useTranslation("workspacePage")
return (
<Tooltip title={t("agentStatus.connected.off")}>
<Tooltip title="Stopped">
<div
role="status"
aria-label={t("agentStatus.connected.off")}
aria-label="Stopped"
className={combineClasses([styles.status, styles.disconnected])}
/>
</Tooltip>
@ -289,13 +286,12 @@ const ConnectedStatus: React.FC<{
const DisconnectedStatus: React.FC = () => {
const styles = useStyles()
const { t } = useTranslation("workspacePage")
return (
<Tooltip title={t("agentStatus.disconnected")}>
<Tooltip title="Disconnected">
<div
role="status"
aria-label={t("agentStatus.disconnected")}
aria-label="Disconnected"
className={combineClasses([styles.status, styles.disconnected])}
/>
</Tooltip>
@ -304,13 +300,12 @@ const DisconnectedStatus: React.FC = () => {
const ConnectingStatus: React.FC = () => {
const styles = useStyles()
const { t } = useTranslation("workspacePage")
return (
<Tooltip title={t("agentStatus.connecting")}>
<Tooltip title="Connecting...">
<div
role="status"
aria-label={t("agentStatus.connecting")}
aria-label="Connecting..."
className={combineClasses([styles.status, styles.connecting])}
/>
</Tooltip>

View File

@ -71,25 +71,22 @@ const validationSchema = Yup.object({
),
description: Yup.string().max(
MAX_DESCRIPTION_CHAR_LIMIT,
i18next.t("form.error.descriptionMax", { ns: "createTemplatePage" }),
"Please enter a description that is less than or equal to 128 characters.",
),
icon: Yup.string().optional(),
default_ttl_hours: Yup.number()
.integer()
.min(
0,
i18next.t("form.error.defaultTTLMin", { ns: "templateSettingsPage" }),
)
.min(0, "Default time until autostop must not be less than 0.")
.max(
24 * MAX_TTL_DAYS /* 7 days in hours */,
i18next.t("form.error.defaultTTLMax", { ns: "templateSettingsPage" }),
"Please enter a limit that is less than or equal to 168 hours (7 days).",
),
max_ttl_hours: Yup.number()
.integer()
.min(0, i18next.t("form.error.maxTTLMin", { ns: "templateSettingsPage" }))
.min(0, "Maximum time until autostop must not be less than 0.")
.max(
24 * MAX_TTL_DAYS /* 7 days in hours */,
i18next.t("form.error.maxTTLMax", { ns: "templateSettingsPage" }),
"Please enter a limit that is less than or equal to 168 hours(7 days).",
),
})
@ -223,8 +220,8 @@ export const CreateTemplateForm: FC<CreateTemplateFormProps> = ({
<HorizontalForm onSubmit={form.handleSubmit}>
{/* General info */}
<FormSection
title={t("form.generalInfo.title")}
description={t("form.generalInfo.description")}
title="General info"
description="The name is used to identify the template in URLs and the API. It must be unique within your organization."
>
<FormFields>
{starterTemplate ? (
@ -255,8 +252,8 @@ export const CreateTemplateForm: FC<CreateTemplateFormProps> = ({
{/* Display info */}
<FormSection
title={t("form.displayInfo.title")}
description={t("form.displayInfo.description")}
title="Display info"
description="Give your template a friendly name, description, and icon."
>
<FormFields>
<TextField
@ -288,8 +285,8 @@ export const CreateTemplateForm: FC<CreateTemplateFormProps> = ({
{/* Schedule */}
<FormSection
title={t("form.schedule.title")}
description={t("form.schedule.description")}
title="Schedule"
description="Define when workspaces created from this template automatically stop."
>
<FormFields>
<Stack direction="row" className={styles.ttlFields}>
@ -384,8 +381,8 @@ export const CreateTemplateForm: FC<CreateTemplateFormProps> = ({
{/* Operations */}
<FormSection
title={t("form.operations.title")}
description={t("form.operations.description")}
title="Operations"
description="Regulate actions allowed on workspaces created from this template."
>
<FormFields>
<label htmlFor="allow_user_cancel_workspace_jobs">

View File

@ -47,7 +47,7 @@ const CreateTemplatePage: FC = () => {
return (
<>
<Helmet>
<title>{pageTitle(t("title"))}</title>
<title>{pageTitle("Create Template")}</title>
</Helmet>
<FullPageHorizontalForm title={t("title")} onCancel={onCancel}>

View File

@ -62,8 +62,8 @@ export const CreateTokenForm: FC<CreateTokenFormProps> = ({
return (
<HorizontalForm onSubmit={form.handleSubmit}>
<FormSection
title={t("createToken.nameSection.title")}
description={t("createToken.nameSection.description")}
title="Name"
description="What is this token for?"
classes={{ sectionInfo: styles.formSectionInfo }}
>
<FormFields>
@ -78,16 +78,14 @@ export const CreateTokenForm: FC<CreateTokenFormProps> = ({
</FormFields>
</FormSection>
<FormSection
title={t("createToken.lifetimeSection.title")}
title="Expiration"
description={
form.values.lifetime
? t("createToken.lifetimeSection.description", {
date: dayjs()
.add(form.values.lifetime, "days")
.utc()
.format("MMMM DD, YYYY"),
})
: t("createToken.lifetimeSection.emptyDescription")
? `The token will expire on ${dayjs()
.add(form.values.lifetime, "days")
.utc()
.format("MMMM DD, YYYY")}`
: "Please set a token expiration."
}
classes={{ sectionInfo: styles.formSectionInfo }}
>
@ -148,11 +146,7 @@ export const CreateTokenForm: FC<CreateTokenFormProps> = ({
<FormFooter
onCancel={() => navigate("/settings/tokens")}
isLoading={isCreating}
submitLabel={
creationFailed
? t("createToken.footer.retry")
: t("createToken.footer.submit")
}
submitLabel={creationFailed ? "Retry" : "Create token"}
/>
</HorizontalForm>
)

View File

@ -85,7 +85,7 @@ export const CreateTokenPage: FC = () => {
return (
<>
<Helmet>
<title>{pageTitle(t("createToken.title"))}</title>
<title>{pageTitle("Create Token")}</title>
</Helmet>
{tokenFetchFailed && <ErrorAlert error={tokenFetchError} />}
<FullPageHorizontalForm

View File

@ -213,7 +213,7 @@ export const CreateWorkspacePageView: FC<
<UserAutocomplete
value={props.owner}
onChange={props.setOwner}
label={t("ownerLabel")}
label={t("ownerLabel").toString()}
size="medium"
/>
</FormFields>
@ -291,7 +291,7 @@ export const CreateWorkspacePageView: FC<
<FormFooter
onCancel={props.onCancel}
isLoading={props.creatingWorkspace}
submitLabel={t("createWorkspace")}
submitLabel={t("createWorkspace").toString()}
/>
</HorizontalForm>
</FullPageHorizontalForm>

View File

@ -17,7 +17,7 @@ const StarterTemplatesPage: FC = () => {
return (
<>
<Helmet>
<title>{pageTitle(t("title"))}</title>
<title>{pageTitle(t("title").toString())}</title>
</Helmet>
<StarterTemplatesPageView context={state.context} />

View File

@ -36,7 +36,9 @@ export const getValidationSchema = (): Yup.AnyObjectSchema =>
),
description: Yup.string().max(
MAX_DESCRIPTION_CHAR_LIMIT,
i18next.t("descriptionMaxError", { ns: "templateSettingsPage" }),
i18next
.t("descriptionMaxError", { ns: "templateSettingsPage" })
.toString(),
),
allow_user_cancel_workspace_jobs: Yup.boolean(),
icon: iconValidator,
@ -82,11 +84,11 @@ export const TemplateSettingsForm: FC<TemplateSettingsForm> = ({
return (
<HorizontalForm
onSubmit={form.handleSubmit}
aria-label={t("formAriaLabel")}
aria-label={t("formAriaLabel").toString()}
>
<FormSection
title={t("generalInfo.title")}
description={t("generalInfo.description")}
title={t("generalInfo.title").toString()}
description={t("generalInfo.description").toString()}
>
<FormFields>
<TextField
@ -101,8 +103,8 @@ export const TemplateSettingsForm: FC<TemplateSettingsForm> = ({
</FormSection>
<FormSection
title={t("displayInfo.title")}
description={t("displayInfo.description")}
title={t("displayInfo.title").toString()}
description={t("displayInfo.description").toString()}
>
<FormFields>
<TextField
@ -133,8 +135,8 @@ export const TemplateSettingsForm: FC<TemplateSettingsForm> = ({
</FormSection>
<FormSection
title={t("operations.title")}
description={t("operations.description")}
title={t("operations.title").toString()}
description={t("operations.description").toString()}
>
<label htmlFor="allow_user_cancel_workspace_jobs">
<Stack direction="row" spacing={1}>

View File

@ -107,7 +107,7 @@ describe("TemplateSettingsPage", () => {
}
const validate = () => getValidationSchema().validateSync(values)
expect(validate).toThrowError(
t("descriptionMaxError", { ns: "templateSettingsPage" }),
t("descriptionMaxError", { ns: "templateSettingsPage" }).toString(),
)
})
})

View File

@ -52,17 +52,27 @@ export const getValidationSchema = (): Yup.AnyObjectSchema =>
Yup.object({
default_ttl_ms: Yup.number()
.integer()
.min(0, i18next.t("defaultTTLMinError", { ns: "templateSettingsPage" }))
.min(
0,
i18next
.t("defaultTTLMinError", { ns: "templateSettingsPage" })
.toString(),
)
.max(
24 * MAX_TTL_DAYS /* 7 days in hours */,
i18next.t("defaultTTLMaxError", { ns: "templateSettingsPage" }),
i18next
.t("defaultTTLMaxError", { ns: "templateSettingsPage" })
.toString(),
),
max_ttl_ms: Yup.number()
.integer()
.min(0, i18next.t("maxTTLMinError", { ns: "templateSettingsPage" }))
.min(
0,
i18next.t("maxTTLMinError", { ns: "templateSettingsPage" }).toString(),
)
.max(
24 * MAX_TTL_DAYS /* 7 days in hours */,
i18next.t("maxTTLMaxError", { ns: "templateSettingsPage" }),
i18next.t("maxTTLMaxError", { ns: "templateSettingsPage" }).toString(),
),
failure_ttl_ms: Yup.number()
.min(0, "Failure cleanup days must not be less than 0.")
@ -214,11 +224,11 @@ export const TemplateScheduleForm: FC<TemplateScheduleForm> = ({
return (
<HorizontalForm
onSubmit={form.handleSubmit}
aria-label={t("formAriaLabel")}
aria-label={t("formAriaLabel").toString()}
>
<FormSection
title={t("schedule.title")}
description={t("schedule.description")}
title={t("schedule.title").toString()}
description={t("schedule.description").toString()}
>
<Stack direction="row" className={styles.ttlFields}>
<TextField

View File

@ -157,7 +157,7 @@ describe("TemplateSchedulePage", () => {
}
const validate = () => getValidationSchema().validateSync(values)
expect(validate).toThrowError(
t("defaultTTLMaxError", { ns: "templateSettingsPage" }),
t("defaultTTLMaxError", { ns: "templateSettingsPage" }).toString(),
)
})

View File

@ -69,7 +69,7 @@ export const TemplateVariablesForm: FC<TemplateVariablesForm> = ({
return (
<HorizontalForm
onSubmit={form.handleSubmit}
aria-label={t("formAriaLabel")}
aria-label={t("formAriaLabel").toString()}
>
{templateVariables.map((templateVariable, index) => {
let fieldHelpers
@ -175,7 +175,7 @@ const ValidationSchemaForTemplateVariables = (
if (!val || val.length === 0) {
return ctx.createError({
path: ctx.path,
message: t("validationRequiredVariable"),
message: t("validationRequiredVariable").toString(),
})
}
}

View File

@ -116,7 +116,9 @@ export const TokensPageView: FC<
onDelete(token)
}}
size="medium"
aria-label={t("tokenActions.deleteToken.delete")}
aria-label={t(
"tokenActions.deleteToken.delete",
).toString()}
>
<DeleteOutlineIcon />
</IconButton>

View File

@ -72,7 +72,7 @@ const deleteUser = async (setupActionSpies: () => void) => {
// Check if the confirm message is displayed
const confirmDialog = await screen.findByRole("dialog")
expect(confirmDialog).toHaveTextContent(
t("deleteDialog.confirm", { ns: "common", entity: "user" }),
t("deleteDialog.confirm", { ns: "common", entity: "user" }).toString(),
)
// Confirm with text input

View File

@ -186,7 +186,7 @@ export const WorkspaceReadyPage = ({
name={workspace.name}
info={t("deleteDialog.info", {
timeAgo: dayjs(workspace.created_at).fromNow(),
})}
}).toString()}
isOpen={workspaceState.matches({ ready: { build: "askingDelete" } })}
onCancel={() => workspaceSend({ type: "CANCEL_DELETE" })}
onConfirm={() => {

View File

@ -77,8 +77,8 @@ export const WorkspaceParametersForm: FC<{
<HorizontalForm onSubmit={form.handleSubmit} data-testid="form">
{mutableParameters.length > 0 && (
<FormSection
title={t("parameters")}
description={t("parametersDescription")}
title={t("parameters").toString()}
description={t("parametersDescription").toString()}
>
<FormFields>
{mutableParameters.map((parameter, index) => (

View File

@ -118,7 +118,7 @@ export const WorkspaceSchedulePage: FC = () => {
title={t("dialogTitle")}
description={t("dialogDescription")}
confirmText={t("restart")}
cancelText={t("applyLater")}
cancelText={t("applyLater").toString()}
hideCancel={false}
onConfirm={() => {
scheduleSend("RESTART_WORKSPACE")

View File

@ -42,8 +42,8 @@ export const WorkspaceSettingsForm: FC<{
return (
<HorizontalForm onSubmit={form.handleSubmit} data-testid="form">
<FormSection
title={t("generalInfo")}
description={t("generalInfoDescription")}
title="General info"
description="The name of your new workspace."
>
<FormFields>
<TextField

View File

@ -77,7 +77,7 @@ export const useValidationSchemaForRichParameters = (
path: ctx.path,
message: t("validationNumberLesserThan", {
min: templateParameter.validation_min,
}),
}).toString(),
})
}
} else if (
@ -89,7 +89,7 @@ export const useValidationSchemaForRichParameters = (
path: ctx.path,
message: t("validationNumberGreaterThan", {
max: templateParameter.validation_max,
}),
}).toString(),
})
}
} else if (
@ -105,7 +105,7 @@ export const useValidationSchemaForRichParameters = (
message: t("validationNumberNotInRange", {
min: templateParameter.validation_min,
max: templateParameter.validation_max,
}),
}).toString(),
})
}
}
@ -125,7 +125,7 @@ export const useValidationSchemaForRichParameters = (
path: ctx.path,
message: t("validationNumberNotIncreasing", {
last: lastBuildParameter.value,
}),
}).toString(),
})
}
break
@ -135,7 +135,7 @@ export const useValidationSchemaForRichParameters = (
path: ctx.path,
message: t("validationNumberNotDecreasing", {
last: lastBuildParameter.value,
}),
}).toString(),
})
}
break
@ -159,7 +159,7 @@ export const useValidationSchemaForRichParameters = (
message: t("validationPatternNotMatched", {
error: templateParameter.validation_error,
pattern: templateParameter.validation_regex,
}),
}).toString(),
})
}
}

View File

@ -1004,7 +1004,7 @@
resolved "https://registry.yarnpkg.com/@babel/regjsgen/-/regjsgen-0.8.0.tgz#f0ba69b075e1f05fb2825b7fad991e7adbb18310"
integrity sha512-x/rqGMdzj+fWZvCOYForTghzbtqPDZ5gPwaoNGHdgDfF2QA/XZbCBp4Moo5scrkAMPhB7z26XM/AaHuIJdgauA==
"@babel/runtime@^7.0.0", "@babel/runtime@^7.1.2", "@babel/runtime@^7.12.5", "@babel/runtime@^7.15.4", "@babel/runtime@^7.17.2", "@babel/runtime@^7.17.8", "@babel/runtime@^7.18.3", "@babel/runtime@^7.20.6", "@babel/runtime@^7.20.7", "@babel/runtime@^7.21.0", "@babel/runtime@^7.3.1", "@babel/runtime@^7.5.5", "@babel/runtime@^7.7.6", "@babel/runtime@^7.8.3", "@babel/runtime@^7.8.4", "@babel/runtime@^7.8.7", "@babel/runtime@^7.9.2":
"@babel/runtime@^7.0.0", "@babel/runtime@^7.1.2", "@babel/runtime@^7.12.5", "@babel/runtime@^7.15.4", "@babel/runtime@^7.17.8", "@babel/runtime@^7.18.3", "@babel/runtime@^7.20.6", "@babel/runtime@^7.20.7", "@babel/runtime@^7.21.0", "@babel/runtime@^7.3.1", "@babel/runtime@^7.5.5", "@babel/runtime@^7.7.6", "@babel/runtime@^7.8.3", "@babel/runtime@^7.8.4", "@babel/runtime@^7.8.7", "@babel/runtime@^7.9.2":
version "7.22.3"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.22.3.tgz#0a7fce51d43adbf0f7b517a71f4c3aaca92ebcbb"
integrity sha512-XsDuspWKLUsxwCp6r7EhsExHtYfbe5oAGQ19kqngTdCPUoPQzOPdUbD/pB9PJiwb2ptYKQDjSJT3R6dC+EPqfQ==
@ -6805,12 +6805,12 @@ hyphenate-style-name@^1.0.3:
resolved "https://registry.yarnpkg.com/hyphenate-style-name/-/hyphenate-style-name-1.0.4.tgz#691879af8e220aea5750e8827db4ef62a54e361d"
integrity sha512-ygGZLjmXfPHj+ZWh6LwbC37l43MhfztxetbFCoYTM2VjkIUpeHgSNn7QIyVFj7YQ1Wl9Cbw5sholVJPzWvC2MQ==
i18next@21.9.1:
version "21.9.1"
resolved "https://registry.yarnpkg.com/i18next/-/i18next-21.9.1.tgz#9e3428990f5b2cc9ac1b98dd025f3e411c368249"
integrity sha512-ITbDrAjbRR73spZAiu6+ex5WNlHRr1mY+acDi2ioTHuUiviJqSz269Le1xHAf0QaQ6GgIHResUhQNcxGwa/PhA==
i18next@22.5.0:
version "22.5.0"
resolved "https://registry.yarnpkg.com/i18next/-/i18next-22.5.0.tgz#16d98eba7c748ab183a36505046b5b91f87e989b"
integrity sha512-sqWuJFj+wJAKQP2qBQ+b7STzxZNUmnSxrehBCCj9vDOW9RDYPfqCaK1Hbh2frNYQuPziz6O2CGoJPwtzY3vAYA==
dependencies:
"@babel/runtime" "^7.17.2"
"@babel/runtime" "^7.20.6"
iconv-lite@0.4.24, iconv-lite@^0.4.24:
version "0.4.24"