Skip to content

Commit

Permalink
Integrate react-i18n to bridge UI
Browse files Browse the repository at this point in the history
Related to #131
  • Loading branch information
nop33 authored and Lbqds committed Jun 24, 2024
1 parent afb6128 commit 9d230ff
Show file tree
Hide file tree
Showing 88 changed files with 1,174 additions and 525 deletions.
302 changes: 302 additions & 0 deletions bridge_ui/locales/en-US/translation.json

Large diffs are not rendered by default.

117 changes: 112 additions & 5 deletions bridge_ui/package-lock.json

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

1 change: 1 addition & 0 deletions bridge_ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"qrcode.react": "^3.0.1",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-i18next": "^14.1.2",
"react-modal": "^3.15.1",
"react-redux": "^7.2.4",
"react-router-dom": "^5.2.0",
Expand Down
28 changes: 14 additions & 14 deletions bridge_ui/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ import { useWallet } from "@alephium/web3-react";
import { useEffect } from "react";
import { web3 } from "@alephium/web3";
import backgroundGradient from "./images/top-gradient.png";
import { useTranslation } from "react-i18next";

const useStyles = makeStyles((theme) => ({
appBar: {
Expand Down Expand Up @@ -129,6 +130,7 @@ const useStyles = makeStyles((theme) => ({
}));

function App() {
const { t } = useTranslation();
const classes = useStyles();
const isBeta = useBetaContext();
const { push } = useHistory();
Expand All @@ -152,7 +154,7 @@ function App() {
{CLUSTER === "mainnet" ? null : (
<AppBar position="static" className={classes.betaBanner} elevation={0}>
<Typography style={{ textAlign: "center" }}>
Caution! You are using the {CLUSTER} build of this app.
{t("Caution! You are using the {{ networkName }} build of this app.", { networkName: CLUSTER })}
</Typography>
</AppBar>
)}
Expand All @@ -171,7 +173,7 @@ function App() {
>
<img
src={Alephium}
alt="Alephium"
alt={t("Alephium")}
className={classes.alephiumLogo}
/>
</Link>
Expand All @@ -184,7 +186,7 @@ function App() {
color="inherit"
className={classes.link}
>
Bridge
{t("Bridge")}
</Link>
<Link
href="https://explorer.bridge.alephium.org"
Expand All @@ -193,7 +195,7 @@ function App() {
color="inherit"
className={classes.link}
>
Explorer
{t("Explorer")}
</Link>
<Link
href="https://alephium.org"
Expand All @@ -202,12 +204,12 @@ function App() {
color="inherit"
className={classes.link}
>
Alephium
{t("Alephium")}
</Link>
</div>
</Hidden>
<Hidden implementation="css" smUp>
<Tooltip title="View the FAQ">
<Tooltip title={t("View the FAQ")}>
<IconButton
href="https://docs.wormholenetwork.com/wormhole/faqs"
target="_blank"
Expand All @@ -224,8 +226,7 @@ function App() {
{isBeta ? (
<AppBar position="static" className={classes.betaBanner} elevation={0}>
<Typography style={{ textAlign: "center" }}>
Caution! You have enabled the beta. Enter the secret code again to
disable.
{t("Caution! You have enabled the beta. Enter the secret code again to disable.")}
</Typography>
</AppBar>
) : null}
Expand All @@ -236,25 +237,24 @@ function App() {
subtitle={
<>
<Typography variant="h5">
A bridge that offers unlimited transfers across chains for
tokens.
{t("A bridge that offers unlimited transfers across chains for tokens.")}
</Typography>
</>
}
>
Token Bridge 🌉
{t("Token Bridge")} 🌉
</HeaderText>
<Tabs
value={pathname}
variant="fullWidth"
onChange={handleTabChange}
indicatorColor="primary"
>
<Tab label="Tokens" value="/transfer" disableRipple />
<Tab label={t("Tokens_other")} value="/transfer" disableRipple />
{/* <Tab label="NFTs" value="/nft" /> */}
<Tab label="Redeem" value="/redeem" to="/redeem" disableRipple />
<Tab label={t("Redeem")} value="/redeem" to="/redeem" disableRipple />
<Tab
label="Transactions"
label={t("Transactions")}
value="/transactions"
to="/transactions"
disableRipple
Expand Down
4 changes: 3 additions & 1 deletion bridge_ui/src/components/Attest/Create.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { CHAIN_ID_TERRA } from "@alephium/wormhole-sdk";
import { CircularProgress, makeStyles } from "@material-ui/core";
import { useTranslation } from "react-i18next";
import { useSelector } from "react-redux";
import useFetchForeignAsset from "../../hooks/useFetchForeignAsset";
import { useHandleCreateWrapped } from "../../hooks/useHandleCreateWrapped";
Expand All @@ -26,6 +27,7 @@ const useStyles = makeStyles((theme) => ({
}));

function Create() {
const { t } = useTranslation();
const classes = useStyles();
const targetChain = useSelector(selectAttestTargetChain);
const originAsset = useSelector(selectAttestSourceAsset);
Expand Down Expand Up @@ -61,7 +63,7 @@ function Create() {
showLoader={showLoader}
error={error}
>
{shouldUpdate ? "Update" : "Create"}
{shouldUpdate ? t("Update") : t("Create")}
</ButtonWithLoader>
<WaitingForWalletMessage />
</>
Expand Down
Loading

0 comments on commit 9d230ff

Please sign in to comment.