Skip to content

chore: remove i18next #9608

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 67 commits into from
Sep 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
0b0725c
remove i18next packages
aslilac Sep 8, 2023
6a585bc
remove provider
aslilac Sep 8, 2023
7e63f30
refactor `DeleteDialog`
aslilac Sep 8, 2023
6636ed7
refactor `Expander`
aslilac Sep 8, 2023
202c9fa
refactor `IconField`
aslilac Sep 8, 2023
18c04b4
refactor `AgentOutdatedTooltip`
aslilac Sep 8, 2023
9d93117
refactor `AgentRowPreview`
aslilac Sep 8, 2023
8d79655
refactor `AgentStatus`
aslilac Sep 8, 2023
9164286
refactor `ShareIcon`
aslilac Sep 8, 2023
7ff932b
refactor `UserAutocomplete`
aslilac Sep 8, 2023
9ae7372
remove stale comment
aslilac Sep 8, 2023
6678f40
refactor `AuditPageView`
aslilac Sep 8, 2023
fc043ed
refactor `AuditPaywall`
aslilac Sep 8, 2023
3eb8d69
`AuditLogRow`
aslilac Sep 8, 2023
b57d555
refactor `AuditLogDescription`
aslilac Sep 8, 2023
b27f918
refactor `BuildAuditDescription`
aslilac Sep 8, 2023
f0a9296
refactor `CreateTemplateForm`
aslilac Sep 8, 2023
61fdfe5
refactor `CreateTemplatePage`
aslilac Sep 8, 2023
f769e69
refactor `TemplateUpload`
aslilac Sep 8, 2023
3127d57
refactor `CreateTokenForm`
aslilac Sep 8, 2023
9c76a7b
refactor `CreateTokenPage`
aslilac Sep 8, 2023
16a3f21
refactor `CreateWorkspacePageView`
aslilac Sep 8, 2023
026ddaa
refactor `AppearanceSettingsPageView`
aslilac Sep 8, 2023
5784b91
refactor `SettingsGroupPageView`
aslilac Sep 8, 2023
f5cb010
refactor utils.ts
aslilac Sep 8, 2023
b1d8c5c
refactor `VersionRow`
aslilac Sep 8, 2023
b448bb0
refactor `TemplateSettingsForm`
aslilac Sep 8, 2023
39438e1
refactor `LoginPage` and `SignInForm`
aslilac Sep 8, 2023
adbb256
refactor `StarterTemplatePageView`
aslilac Sep 8, 2023
0f181e8
refactor `StarterTemplatesPage`
aslilac Sep 8, 2023
5800e18
refactor `Workspace`
aslilac Sep 8, 2023
7278c0d
refactor `EditRolesButton`
aslilac Sep 8, 2023
78b7cc0
refactor `TemplateScheduleForm`
aslilac Sep 8, 2023
29652ea
refactor `TemplateVariableField`
aslilac Sep 8, 2023
337c21d
refactor `EmptyTemplates`
aslilac Sep 8, 2023
89867ff
refactor `TemplateVariablesPage`
aslilac Sep 8, 2023
5e71acb
refactor `userSecuritySettingsXService`
aslilac Sep 8, 2023
46cddf5
refactor `ConfirmDeleteDialog`
aslilac Sep 8, 2023
633e574
refactor workspace.tsx
aslilac Sep 8, 2023
76c78ea
refactor `WorkspaceDeletedBanner`
aslilac Sep 8, 2023
90165f7
refactor `TokensPage`
aslilac Sep 8, 2023
4dde5f2
refactor formHelpers.tsx
aslilac Sep 8, 2023
61e7571
refactor `UsersTableBody`
aslilac Sep 8, 2023
106a6fe
refactor `TemplateSettingsPage`
aslilac Sep 8, 2023
b2d644f
refactor `AutostopRequirementHelperText`
aslilac Sep 8, 2023
441803b
refactor `TemplateVariablesForm`
aslilac Sep 8, 2023
8ec0f96
refactor `TemplateVersionPage`
aslilac Sep 8, 2023
72abadb
remove stale comment
aslilac Sep 8, 2023
ef93712
refactor `TokensPageView`
aslilac Sep 8, 2023
32252f3
refactor `BuildRow`
aslilac Sep 8, 2023
66da852
refactor `WorkspaceReadyPage`
aslilac Sep 8, 2023
87a1654
refactor `WorkspacesTable`
aslilac Sep 8, 2023
2ab4c40
refactor `useValidationSchemaForRichParameters`
aslilac Sep 8, 2023
9a4ba70
refactor `UpdateBuildParametersDialog`
aslilac Sep 8, 2023
1440b5a
refactor `WorkspaceSchedulePage`
aslilac Sep 8, 2023
d1a2905
refactor `WorkspaceParametersForm`
aslilac Sep 8, 2023
622ce4a
refactor `WorkspaceSettingsPageView`
aslilac Sep 8, 2023
bd51244
refactor `CreateWorkspacePage` test
aslilac Sep 8, 2023
f1c5909
refactor all the remaining tests
aslilac Sep 8, 2023
4e26e98
refactor `TTLHelperText`
aslilac Sep 8, 2023
1ee252d
stragglers
aslilac Sep 8, 2023
a85cd71
linting
aslilac Sep 8, 2023
4a7b127
fix tests
aslilac Sep 8, 2023
366d513
remove remaining translation files
aslilac Sep 8, 2023
7359de0
fix storybook build
aslilac Sep 8, 2023
45c3335
Merge branch 'main' into axe-i18next
aslilac Sep 11, 2023
9216208
fix a couple stories
aslilac Sep 11, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion site/.storybook/preview.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { withRouter } from "storybook-addon-react-router-v6";
import { HelmetProvider } from "react-helmet-async";
import { dark } from "../src/theme";
import "../src/theme/globalFonts";
import "../src/i18n";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";

export const decorators = [
Expand Down
2 changes: 0 additions & 2 deletions site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@
"eventsourcemock": "2.0.0",
"formik": "2.4.1",
"front-matter": "4.0.2",
"i18next": "22.5.0",
"jest-environment-jsdom": "29.5.0",
"lodash": "4.17.21",
"monaco-editor": "0.41.0",
Expand All @@ -82,7 +81,6 @@
"react-dom": "18.2.0",
"react-headless-tabs": "6.0.3",
"react-helmet-async": "1.3.0",
"react-i18next": "12.2.2",
"react-markdown": "8.0.3",
"react-router-dom": "6.15.0",
"react-syntax-highlighter": "15.5.0",
Expand Down
43 changes: 0 additions & 43 deletions site/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 0 additions & 10 deletions site/src/@types/i18n.d.ts

This file was deleted.

15 changes: 2 additions & 13 deletions site/src/components/Dialogs/DeleteDialog/DeleteDialog.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { screen } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import i18next from "i18next";
import { render } from "testHelpers/renderHelpers";
import { DeleteDialog } from "./DeleteDialog";

Expand All @@ -20,7 +19,6 @@ describe("DeleteDialog", () => {
});

it("disables confirm button when the text field is filled incorrectly", async () => {
const { t } = i18next;
render(
<DeleteDialog
isOpen
Expand All @@ -30,18 +28,13 @@ describe("DeleteDialog", () => {
name="MyTemplate"
/>,
);
const labelText = t("deleteDialog.confirmLabel", {
ns: "common",
entity: "template",
});
const textField = screen.getByLabelText(labelText);
const textField = screen.getByTestId("delete-dialog-name-confirmation");
await userEvent.type(textField, "MyTemplateWrong");
const confirmButton = screen.getByRole("button", { name: "Delete" });
expect(confirmButton).toBeDisabled();
});

it("enables confirm button when the text field is filled correctly", async () => {
const { t } = i18next;
render(
<DeleteDialog
isOpen
Expand All @@ -51,11 +44,7 @@ describe("DeleteDialog", () => {
name="MyTemplate"
/>,
);
const labelText = t("deleteDialog.confirmLabel", {
ns: "common",
entity: "template",
});
const textField = screen.getByLabelText(labelText);
const textField = screen.getByTestId("delete-dialog-name-confirmation");
await userEvent.type(textField, "MyTemplate");
const confirmButton = screen.getByRole("button", { name: "Delete" });
expect(confirmButton).not.toBeDisabled();
Expand Down
16 changes: 9 additions & 7 deletions site/src/components/Dialogs/DeleteDialog/DeleteDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import makeStyles from "@mui/styles/makeStyles";
import TextField from "@mui/material/TextField";
import { Maybe } from "components/Conditionals/Maybe";
import { ChangeEvent, useState, PropsWithChildren, FC } from "react";
import { useTranslation } from "react-i18next";
import { ConfirmDialog } from "../ConfirmDialog/ConfirmDialog";

export interface DeleteDialogProps {
Expand All @@ -25,7 +24,6 @@ export const DeleteDialog: FC<PropsWithChildren<DeleteDialogProps>> = ({
confirmLoading,
}) => {
const styles = useStyles();
const { t } = useTranslation("common");
const [nameValue, setNameValue] = useState("");
const confirmed = name === nameValue;
const handleChange = (event: ChangeEvent<HTMLInputElement>) => {
Expand All @@ -35,11 +33,12 @@ export const DeleteDialog: FC<PropsWithChildren<DeleteDialogProps>> = ({

const content = (
<>
<p>{t("deleteDialog.intro", { entity })}</p>
<p>Deleting this {entity} is irreversible!</p>
<Maybe condition={info !== undefined}>
<p className={styles.warning}>{info}</p>
</Maybe>
<p>{t("deleteDialog.confirm", { entity, name })}</p>
<p>Are you sure you want to proceed?</p>
<p>Type {name} below to confirm.</p>

<form
onSubmit={(e) => {
Expand All @@ -59,9 +58,12 @@ export const DeleteDialog: FC<PropsWithChildren<DeleteDialogProps>> = ({
placeholder={name}
value={nameValue}
onChange={handleChange}
label={t("deleteDialog.confirmLabel", { entity })}
label={`Name of the ${entity} to delete`}
error={hasError}
helperText={hasError && t("deleteDialog.incorrectName", { entity })}
helperText={
hasError && `${nameValue} does not match the name of this ${entity}`
}
inputProps={{ ["data-testid"]: "delete-dialog-name-confirmation" }}
/>
</form>
</>
Expand All @@ -72,7 +74,7 @@ export const DeleteDialog: FC<PropsWithChildren<DeleteDialogProps>> = ({
type="delete"
hideCancel={false}
open={isOpen}
title={t("deleteDialog.title", { entity })}
title={`Delete ${entity}`}
onConfirm={onConfirm}
onClose={onCancel}
description={content}
Expand Down
6 changes: 2 additions & 4 deletions site/src/components/Expander/Expander.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
} from "components/DropdownArrows/DropdownArrows";
import { PropsWithChildren, FC } from "react";
import Collapse from "@mui/material/Collapse";
import { useTranslation } from "react-i18next";
import { combineClasses } from "utils/combineClasses";

export interface ExpanderProps {
Expand All @@ -20,7 +19,6 @@ export const Expander: FC<PropsWithChildren<ExpanderProps>> = ({
children,
}) => {
const styles = useStyles();
const { t } = useTranslation("common");

const toggleExpanded = () => setExpanded(!expanded);

Expand All @@ -29,7 +27,7 @@ export const Expander: FC<PropsWithChildren<ExpanderProps>> = ({
{!expanded && (
<Link onClick={toggleExpanded} className={styles.expandLink}>
<span className={styles.text}>
{t("ctas.expand")}
Click here to learn more
<OpenDropdown margin={false} />
</span>
</Link>
Expand All @@ -43,7 +41,7 @@ export const Expander: FC<PropsWithChildren<ExpanderProps>> = ({
className={combineClasses([styles.expandLink, styles.collapseLink])}
>
<span className={styles.text}>
{t("ctas.collapse")}
Click here to hide
<CloseDropdown margin={false} />
</span>
</Link>
Expand Down
6 changes: 2 additions & 4 deletions site/src/components/IconField/IconField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { useRef, FC, useState } from "react";
import Picker from "@emoji-mart/react";
import { makeStyles } from "@mui/styles";
import { colors } from "theme/colors";
import { useTranslation } from "react-i18next";
import data from "@emoji-mart/data/sets/14/twitter.json";
import { Stack } from "components/Stack/Stack";

Expand All @@ -26,15 +25,14 @@ const IconField: FC<IconFieldProps> = ({ onPickEmoji, ...textFieldProps }) => {
const styles = useStyles();
const emojiButtonRef = useRef<HTMLButtonElement>(null);
const [isEmojiPickerOpen, setIsEmojiPickerOpen] = useState(false);
const { t } = useTranslation("templateSettingsPage");
const hasIcon = textFieldProps.value && textFieldProps.value !== "";

return (
<Stack spacing={1}>
<TextField
{...textFieldProps}
fullWidth
label={t("iconLabel")}
label="Icon"
InputProps={{
endAdornment: hasIcon ? (
<InputAdornment position="end" className={styles.adornment}>
Expand All @@ -59,7 +57,7 @@ const IconField: FC<IconFieldProps> = ({ onPickEmoji, ...textFieldProps }) => {
setIsEmojiPickerOpen((v) => !v);
}}
>
{t("selectEmoji")}
Select emoji
</Button>

<Popover
Expand Down
20 changes: 7 additions & 13 deletions site/src/components/Resources/AgentOutdatedTooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {
} from "components/HelpTooltip/HelpTooltip";
import { WorkspaceAgent } from "api/typesGenerated";
import { Stack } from "components/Stack/Stack";
import { useTranslation } from "react-i18next";

type AgentOutdatedTooltipProps = ComponentProps<typeof HelpPopover> & {
agent: WorkspaceAgent;
Expand All @@ -30,7 +29,6 @@ export const AgentOutdatedTooltip: FC<AgentOutdatedTooltipProps> = ({
anchorEl,
}) => {
const styles = useStyles();
const { t } = useTranslation("workspacePage");

return (
<HelpPopover
Expand All @@ -43,25 +41,21 @@ export const AgentOutdatedTooltip: FC<AgentOutdatedTooltipProps> = ({
<HelpTooltipContext.Provider value={{ open, onClose }}>
<Stack spacing={1}>
<div>
<HelpTooltipTitle>
{t("agentOutdatedTooltip.title")}
</HelpTooltipTitle>
<HelpTooltipTitle>Agent Outdated</HelpTooltipTitle>
<HelpTooltipText>
{t("agentOutdatedTooltip.description")}
This agent is an older version than the Coder server. This can
happen after you update Coder with running workspaces. To fix
this, you can stop and start the workspace.
</HelpTooltipText>
</div>

<Stack spacing={0.5}>
<span className={styles.versionLabel}>
{t("agentOutdatedTooltip.agentVersionLabel")}
</span>
<span className={styles.versionLabel}>Agent version</span>
<span>{agent.version}</span>
</Stack>

<Stack spacing={0.5}>
<span className={styles.versionLabel}>
{t("agentOutdatedTooltip.serverVersionLabel")}
</span>
<span className={styles.versionLabel}>Server version</span>
<span>{serverVersion}</span>
</Stack>

Expand All @@ -71,7 +65,7 @@ export const AgentOutdatedTooltip: FC<AgentOutdatedTooltipProps> = ({
onClick={onUpdate}
ariaLabel="Update workspace"
>
{t("agentOutdatedTooltip.updateWorkspaceLabel")}
Update workspace
</HelpTooltipAction>
</HelpTooltipLinksGroup>
</Stack>
Expand Down
Loading