Skip to content
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

Add i18n coverage for ko and other languages #198

Merged
merged 2 commits into from
Sep 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion locales.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
module.exports = ["en", "es"];
module.exports = ["en", "es", "tr", "ru", "ko", "vi"];
1 change: 1 addition & 0 deletions pages/[slug].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export async function getStaticProps({ params, locale }) {
if (!data) {
return {
notFound: true,
revalidate: 5 * 60, // Cache response for 5m
};
}

Expand Down
20 changes: 16 additions & 4 deletions pages/governance.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
fetchImprovementProposals,
fetchVoterCount,
} from "../src/governance/utils";
import { GetStaticProps } from "next";

const overrideCss = "bg-origin-bg-grey";

Expand Down Expand Up @@ -65,10 +66,21 @@ const GovernanceInfo = ({
);
};

export const getStaticProps = async (): Promise<{
props: GovernanceProps;
revalidate: number;
}> => {
export const getStaticProps: GetStaticProps = async ({
locale,
}): Promise<
| {
props: GovernanceProps;
revalidate: number;
}
| { notFound: true }
> => {
if (locale !== "en") {
return {
notFound: true,
};
}

const navResPromise = fetchAPI("/ousd-nav-links", {
populate: {
links: {
Expand Down
8 changes: 7 additions & 1 deletion pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,13 @@ const Home = ({
);
};

export async function getStaticProps() {
export async function getStaticProps({ locale }) {
if (locale !== "en") {
return {
notFound: true,
};
}

const { vault, dripper } = setupContracts();
const initialTvl = await fetchTvl(vault, dripper);
const apyHistory = await fetchApyHistory();
Expand Down
20 changes: 16 additions & 4 deletions pages/ogv-dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,22 @@ const OgvDashboard = ({
);
};

export const getStaticProps: GetStaticProps = async (): Promise<{
props: DashProps;
revalidate: number;
}> => {
export const getStaticProps: GetStaticProps = async ({
locale,
}): Promise<
| {
props: DashProps;
revalidate: number;
}
| {
notFound: true;
}
> => {
if (locale !== "en") {
return {
notFound: true,
};
}
const seoResPromise = fetchAPI("/ousd/page/en/%2Fogv-dashboard");
const navResPromise = fetchAPI("/ousd-nav-links", {
populate: {
Expand Down