diff --git a/cypress/e2e/homepage.spec.ts b/cypress/e2e/homepage.spec.ts index b571dfdb8..567ef0e54 100644 --- a/cypress/e2e/homepage.spec.ts +++ b/cypress/e2e/homepage.spec.ts @@ -91,7 +91,7 @@ viewports.forEach((viewport) => { // No TC it("should have expected Header title and description", () => { cy.findByTestId("header-title").should( - "have.text", + "contain", "Connecting old and new worlds", ); diff --git a/public/locales/de/page-index.json b/public/locales/de/page-index.json index 69af0c283..af5b49fb4 100644 --- a/public/locales/de/page-index.json +++ b/public/locales/de/page-index.json @@ -19,7 +19,7 @@ }, "masternodes": { "title": "MASTERNODES", - "desc": "${{perc}} gesperrt" + "desc": "Über {{perc}} $ gesperrt" } }, "ReadyForFlexibilitySection": { diff --git a/src/components/commons/StatisticPanel.tsx b/src/components/commons/StatisticPanel.tsx index ef6609074..cf3ea6f55 100644 --- a/src/components/commons/StatisticPanel.tsx +++ b/src/components/commons/StatisticPanel.tsx @@ -153,11 +153,8 @@ function getLocaledStatisticValue( end={Number(value)} enableScrollSpy duration={0.5} - /> - {suffix !== "" ? ` ${t(`statisticsDisplay.suffix.${suffix}`)} ` : ``} - - {/* This prefix is for the $ symbol */} - {prefix ?? ""} + />{" "} + {suffix ?? ""} {prefix ?? ""} {/* This prefix is for the $ symbol */} ); diff --git a/src/components/index/BlockchainFeaturesSection.tsx b/src/components/index/BlockchainFeaturesSection.tsx index 6c35b19d1..34534a91e 100644 --- a/src/components/index/BlockchainFeaturesSection.tsx +++ b/src/components/index/BlockchainFeaturesSection.tsx @@ -3,6 +3,7 @@ import { Container } from "@components/commons/Container"; import { useTranslation } from "next-i18next"; import Slider from "react-slick"; import { SectionTitle } from "@components/commons/SectionTitle"; +import { useRouter } from "next/router"; import { BlockchainFeatureColumn } from "./BlockchainFeatureColumn"; export const BlockchainFeatureItems = [ @@ -30,6 +31,7 @@ export const BlockchainFeatureItems = [ export function BlockchainFeaturesSection(): JSX.Element { const { t } = useTranslation("page-index"); + const router = useRouter(); const separatedTitle = t("BlockchainFeatureSection.title").split(" "); const sliderSettings = { arrows: false, @@ -41,6 +43,16 @@ export function BlockchainFeaturesSection(): JSX.Element { dotsClass: "blockchain-features-dots", }; + function displayColorToLanguage(index: number): boolean { + if (router.locale === "de") { + return index === 3; + } + if (router.locale === "en-US") { + return index === 2; + } + return false; + } + return (
{separatedTitle.map((word, index) => - index === 2 ? ( + displayColorToLanguage(index) ? (
@@ -23,11 +34,20 @@ export function HomePageHeader(): JSX.Element { className="w-full text-5xl leading-[52px] lg:text-[80px] lg:leading-[84px]" data-testid="header-title" > - - {firstWord}
-
- {separatedTitle.join(" ")} + {separatedTitle.map((word, index) => + displayColorToLanguage(index) ? ( + + {`${word} `} + + ) : ( + {`${word} `} + ), + )} +
(); const [supply, setSupply] = useState(); const { t } = useTranslation("page-index"); @@ -38,7 +41,10 @@ export function StatsDisplay() { const { suffix, value } = useUnitSuffix( stats ? stats.tvl.masternodes.toString() : "N/A", ); - const masternodeValue = value === "N/A" ? undefined : `${value + suffix}+`; + + const formattedValue = + router.locale === "de" ? `${value} ${suffix}` : value + suffix; + const masternodeValue = value === "N/A" ? undefined : `${formattedValue}`; const statsItems = [ { diff --git a/src/hooks/useUnitSuffix.tsx b/src/hooks/useUnitSuffix.tsx index df43df272..f5dab35c7 100644 --- a/src/hooks/useUnitSuffix.tsx +++ b/src/hooks/useUnitSuffix.tsx @@ -1,4 +1,5 @@ import BigNumber from "bignumber.js"; +import { useRouter } from "next/router"; const units = { 3: "K+", @@ -7,15 +8,31 @@ const units = { 12: "T+", }; +const deUnits = { + 3: "Tsd.", + 6: "Mio.", + 9: "Mrd.", + 12: "Bio.", +}; + interface UnitSuffix { suffix: string; value: string; } +// Function to convert numbers to formatted numbers with units Eg.$161M ++ = Über xxx Mio. $ export function useUnitSuffix(value, decimalPlace = 0): UnitSuffix { + const router = useRouter(); + const updatedValue = BigNumber(value); const places = updatedValue.e !== null ? Math.floor(updatedValue.e / 3) : 0; - const suffix = `${units[places * 3] ?? ""}`; + + let suffix = ""; + if (router.locale === "de") { + suffix = `${deUnits[places * 3] ?? ""}`; + } else { + suffix = `${units[places * 3] ?? ""}`; + } const unitValueWithSuffix = { suffix, value,