Skip to content

Commit

Permalink
Add translation support to the search loading component. Adds potenti…
Browse files Browse the repository at this point in the history
…al for non-search loading translation as well

Fixes #1937
  • Loading branch information
mdragon committed Sep 20, 2024
1 parent e96eafc commit 7316673
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
6 changes: 4 additions & 2 deletions frontend/src/app/[locale]/search/loading.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
import { useTranslations } from "next-intl";
import React from "react";

import Spinner from "src/components/Spinner";

export default function Loading() {
// TODO (Issue #1937): Use translation utility for strings in this file
const t = useTranslations("Loading");

return (
<div className="display-flex flex-align-center flex-justify-center margin-bottom-15 margin-top-15">
<Spinner />
<span className="font-body-2xl text-bold margin-left-2">
Loading results...
{t("search")}...
</span>
</div>
);
Expand Down
4 changes: 4 additions & 0 deletions frontend/src/i18n/messages/en/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -498,4 +498,8 @@ export const messages = {
clear: "Clear All",
},
},
Loading: {
default: "Loading",
search: "Loading Results",
},
};
10 changes: 10 additions & 0 deletions frontend/stories/pages/loading.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { Meta } from "@storybook/react";

import Loading from "../../src/app/[locale]/search/loading";

const meta: Meta<typeof Loading> = {
component: Loading,
};
export default meta;

export const Default = {};

0 comments on commit 7316673

Please sign in to comment.