diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index 98015eb..05e9a7a 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -13,6 +13,7 @@ jobs: RESULTS_PER_PAGE: "45" NEXT_PUBLIC_SERVER_ADDRESS: "http://localhost:3000" NEXT_PUBLIC_IMAGES_HOSTING_ADDRESS: "https://statify-images.netlify.app" + NEXT_PUBLIC_LANG: "en" runs-on: ubuntu-latest diff --git a/core/package-lock.json b/core/package-lock.json index 386f48d..0299432 100644 --- a/core/package-lock.json +++ b/core/package-lock.json @@ -8,6 +8,7 @@ "name": "statify", "version": "0.1.0", "dependencies": { + "@formatjs/intl": "^3.1.0", "@hookform/resolvers": "^3.9.0", "@prisma/client": "^5.3.1", "@unocss/reset": "^0.64.1", @@ -751,6 +752,78 @@ "node": "^12.22.0 || ^14.17.0 || >=16.0.0" } }, + "node_modules/@formatjs/ecma402-abstract": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/@formatjs/ecma402-abstract/-/ecma402-abstract-2.3.2.tgz", + "integrity": "sha512-6sE5nyvDloULiyOMbOTJEEgWL32w+VHkZQs8S02Lnn8Y/O5aQhjOEXwWzvR7SsBE/exxlSpY2EsWZgqHbtLatg==", + "license": "MIT", + "dependencies": { + "@formatjs/fast-memoize": "2.2.6", + "@formatjs/intl-localematcher": "0.5.10", + "decimal.js": "10", + "tslib": "2" + } + }, + "node_modules/@formatjs/fast-memoize": { + "version": "2.2.6", + "resolved": "https://registry.npmjs.org/@formatjs/fast-memoize/-/fast-memoize-2.2.6.tgz", + "integrity": "sha512-luIXeE2LJbQnnzotY1f2U2m7xuQNj2DA8Vq4ce1BY9ebRZaoPB1+8eZ6nXpLzsxuW5spQxr7LdCg+CApZwkqkw==", + "license": "MIT", + "dependencies": { + "tslib": "2" + } + }, + "node_modules/@formatjs/icu-messageformat-parser": { + "version": "2.9.8", + "resolved": "https://registry.npmjs.org/@formatjs/icu-messageformat-parser/-/icu-messageformat-parser-2.9.8.tgz", + "integrity": "sha512-hZlLNI3+Lev8IAXuwehLoN7QTKqbx3XXwFW1jh0AdIA9XJdzn9Uzr+2LLBspPm/PX0+NLIfykj/8IKxQqHUcUQ==", + "license": "MIT", + "dependencies": { + "@formatjs/ecma402-abstract": "2.3.2", + "@formatjs/icu-skeleton-parser": "1.8.12", + "tslib": "2" + } + }, + "node_modules/@formatjs/icu-skeleton-parser": { + "version": "1.8.12", + "resolved": "https://registry.npmjs.org/@formatjs/icu-skeleton-parser/-/icu-skeleton-parser-1.8.12.tgz", + "integrity": "sha512-QRAY2jC1BomFQHYDMcZtClqHR55EEnB96V7Xbk/UiBodsuFc5kujybzt87+qj1KqmJozFhk6n4KiT1HKwAkcfg==", + "license": "MIT", + "dependencies": { + "@formatjs/ecma402-abstract": "2.3.2", + "tslib": "2" + } + }, + "node_modules/@formatjs/intl": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@formatjs/intl/-/intl-3.1.0.tgz", + "integrity": "sha512-1TIJAPMs8e0O2L/kbIyC0PKmnujO199dhHxCeJ5Loi0FT8K4HAJzcnc/f5buj/OAQZ7m9bw29VjV5uQS0L3Mtw==", + "license": "MIT", + "dependencies": { + "@formatjs/ecma402-abstract": "2.3.2", + "@formatjs/fast-memoize": "2.2.6", + "@formatjs/icu-messageformat-parser": "2.9.8", + "intl-messageformat": "10.7.11", + "tslib": "2" + }, + "peerDependencies": { + "typescript": "5" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@formatjs/intl-localematcher": { + "version": "0.5.10", + "resolved": "https://registry.npmjs.org/@formatjs/intl-localematcher/-/intl-localematcher-0.5.10.tgz", + "integrity": "sha512-af3qATX+m4Rnd9+wHcjJ4w2ijq+rAVP3CCinJQvFv1kgSu1W6jypUmvleJxcewdxmutM8dmIRZFxO/IQBZmP2Q==", + "license": "MIT", + "dependencies": { + "tslib": "2" + } + }, "node_modules/@hookform/resolvers": { "version": "3.9.0", "resolved": "https://registry.npmjs.org/@hookform/resolvers/-/resolvers-3.9.0.tgz", @@ -3503,7 +3576,6 @@ }, "node_modules/decimal.js": { "version": "10.4.3", - "dev": true, "license": "MIT" }, "node_modules/dedent": { @@ -5374,6 +5446,18 @@ "node": ">= 0.4" } }, + "node_modules/intl-messageformat": { + "version": "10.7.11", + "resolved": "https://registry.npmjs.org/intl-messageformat/-/intl-messageformat-10.7.11.tgz", + "integrity": "sha512-IB2N1tmI24k2EFH3PWjU7ivJsnWyLwOWOva0jnXFa29WzB6fb0JZ5EMQGu+XN5lDtjHYFo0/UooP67zBwUg7rQ==", + "license": "BSD-3-Clause", + "dependencies": { + "@formatjs/ecma402-abstract": "2.3.2", + "@formatjs/fast-memoize": "2.2.6", + "@formatjs/icu-messageformat-parser": "2.9.8", + "tslib": "2" + } + }, "node_modules/is-arguments": { "version": "1.1.1", "dev": true, diff --git a/core/package.json b/core/package.json index 891b46b..f2416a9 100644 --- a/core/package.json +++ b/core/package.json @@ -15,6 +15,7 @@ "test:coverage": "jest --coverage" }, "dependencies": { + "@formatjs/intl": "^3.1.0", "@hookform/resolvers": "^3.9.0", "@prisma/client": "^5.3.1", "@unocss/reset": "^0.64.1", diff --git a/core/src/app/(admin)/admin/dashboard/countries/metadata.ts b/core/src/app/(admin)/admin/dashboard/countries/metadata.ts index f13c620..a2ccd9f 100644 --- a/core/src/app/(admin)/admin/dashboard/countries/metadata.ts +++ b/core/src/app/(admin)/admin/dashboard/countries/metadata.ts @@ -1,22 +1,23 @@ import { Metadata } from "next" import { SERVER_ADDRESS } from "@/constants/general" +import translate from "@/modules/i18n" const metadata: Metadata = { metadataBase: new URL(SERVER_ADDRESS), - title: "Countries Dashboard", - description: "Edit countries here: add, update or delete.", + title: translate("pages.indicators_dashboard.metadata.title"), + description: translate("pages.indicators_dashboard.metadata.description"), themeColor: "#ffffff", openGraph: { images: ["/og.png"], - title: "Countries Dashboard", - description: "Edit countries here: add, update or delete.", + title: translate("pages.indicators_dashboard.metadata.title"), + description: translate("pages.indicators_dashboard.metadata.description"), type: "website", url: "/", }, twitter: { images: ["/og.png"], - title: "Countries Dashboard", - description: "Edit countries here: add, update or delete.", + title: translate("pages.indicators_dashboard.metadata.title"), + description: translate("pages.indicators_dashboard.metadata.description"), card: "summary_large_image", site: "@Zhorrrro", }, diff --git a/core/src/app/(admin)/admin/dashboard/indicators/metadata.ts b/core/src/app/(admin)/admin/dashboard/indicators/metadata.ts index 4374ca3..a2ccd9f 100644 --- a/core/src/app/(admin)/admin/dashboard/indicators/metadata.ts +++ b/core/src/app/(admin)/admin/dashboard/indicators/metadata.ts @@ -1,22 +1,23 @@ import { Metadata } from "next" import { SERVER_ADDRESS } from "@/constants/general" +import translate from "@/modules/i18n" const metadata: Metadata = { metadataBase: new URL(SERVER_ADDRESS), - title: "Indicators Dashboard", - description: "Edit indicators here: add, update or delete.", + title: translate("pages.indicators_dashboard.metadata.title"), + description: translate("pages.indicators_dashboard.metadata.description"), themeColor: "#ffffff", openGraph: { images: ["/og.png"], - title: "Indicators Dashboard", - description: "Edit indicators here: add, update or delete.", + title: translate("pages.indicators_dashboard.metadata.title"), + description: translate("pages.indicators_dashboard.metadata.description"), type: "website", url: "/", }, twitter: { images: ["/og.png"], - title: "Indicators Dashboard", - description: "Edit indicators here: add, update or delete.", + title: translate("pages.indicators_dashboard.metadata.title"), + description: translate("pages.indicators_dashboard.metadata.description"), card: "summary_large_image", site: "@Zhorrrro", }, diff --git a/core/src/app/(admin)/admin/dashboard/values/metadata.ts b/core/src/app/(admin)/admin/dashboard/values/metadata.ts index 2179340..a155222 100644 --- a/core/src/app/(admin)/admin/dashboard/values/metadata.ts +++ b/core/src/app/(admin)/admin/dashboard/values/metadata.ts @@ -1,22 +1,23 @@ import { Metadata } from "next" import { SERVER_ADDRESS } from "@/constants/general" +import translate from "@/modules/i18n" const metadata: Metadata = { metadataBase: new URL(SERVER_ADDRESS), - title: "Values Dashboard", - description: "Edit values here: add, update or delete.", + title: translate("pages.values_dashboard.metadata.title"), + description: translate("pages.values_dashboard.metadata.description"), themeColor: "#ffffff", openGraph: { images: ["/og.png"], - title: "Values Dashboard", - description: "Edit values here: add, update or delete.", + title: translate("pages.values_dashboard.metadata.title"), + description: translate("pages.values_dashboard.metadata.description"), type: "website", url: "/", }, twitter: { images: ["/og.png"], - title: "Values Dashboard", - description: "Edit values here: add, update or delete.", + title: translate("pages.values_dashboard.metadata.title"), + description: translate("pages.values_dashboard.metadata.description"), card: "summary_large_image", site: "@Zhorrrro", }, diff --git a/core/src/app/(admin)/admin/signin/metadata.ts b/core/src/app/(admin)/admin/signin/metadata.ts index ccbc114..184f936 100644 --- a/core/src/app/(admin)/admin/signin/metadata.ts +++ b/core/src/app/(admin)/admin/signin/metadata.ts @@ -1,22 +1,23 @@ import { Metadata } from "next" import { SERVER_ADDRESS } from "@/constants/general" +import translate from "@/modules/i18n" const metadata: Metadata = { metadataBase: new URL(SERVER_ADDRESS), - title: "Sign In", - description: "Sign In as administrator to be able to edit data.", + title: translate("pages.signin.metadata.title"), + description: translate("pages.signin.metadata.description"), themeColor: "#ffffff", openGraph: { images: ["/og.png"], - title: "Sign In", - description: "Sign In as administrator to be able to edit data.", + title: translate("pages.signin.metadata.title"), + description: translate("pages.signin.metadata.description"), type: "website", url: "/", }, twitter: { images: ["/og.png"], - title: "Sign In", - description: "Sign In as administrator to be able to edit data.", + title: translate("pages.signin.metadata.title"), + description: translate("pages.signin.metadata.description"), card: "summary_large_image", site: "@Zhorrrro", }, diff --git a/core/src/app/(public)/(with-toolbar)/bookmarks/layout.tsx b/core/src/app/(public)/(with-toolbar)/bookmarks/layout.tsx index 8b84ec2..fcf28e1 100644 --- a/core/src/app/(public)/(with-toolbar)/bookmarks/layout.tsx +++ b/core/src/app/(public)/(with-toolbar)/bookmarks/layout.tsx @@ -1,9 +1,14 @@ import { ReactNode, Suspense } from "react" import IndicatorsListViewLoader from "@/containers/indicators-list-view/IndicatorsListViewLoader" +import translate from "@/modules/i18n" export default function DashboardLayout({ children }: { children: ReactNode }) { return ( - }> + + } + > {children} ) diff --git a/core/src/app/(public)/(with-toolbar)/bookmarks/metadata.ts b/core/src/app/(public)/(with-toolbar)/bookmarks/metadata.ts index 2f57661..6925d20 100644 --- a/core/src/app/(public)/(with-toolbar)/bookmarks/metadata.ts +++ b/core/src/app/(public)/(with-toolbar)/bookmarks/metadata.ts @@ -1,25 +1,23 @@ import { Metadata } from "next/types" import { SERVER_ADDRESS } from "@/constants/general" +import translate from "@/modules/i18n" const metadata: Metadata = { metadataBase: new URL(SERVER_ADDRESS), - title: "Bookmarks", - description: - "Explore our database featuring 100+ indicators for hundreds of regions worldwide.", + title: translate("pages.bookmarks.metadata.title"), + description: translate("pages.bookmarks.metadata.description"), themeColor: "#ffffff", openGraph: { images: ["/og.png"], title: "Statify", - description: - "Explore our database featuring 100+ indicators for hundreds of regions worldwide.", + description: translate("pages.bookmarks.metadata.description"), type: "website", url: "/", }, twitter: { images: ["/og.png"], title: "Statify", - description: - "Explore our database featuring 100+ indicators for hundreds of regions worldwide.", + description: translate("pages.bookmarks.metadata.description"), card: "summary_large_image", site: "@Zhorrrro", }, diff --git a/core/src/app/(public)/(with-toolbar)/bookmarks/page.tsx b/core/src/app/(public)/(with-toolbar)/bookmarks/page.tsx index 1451362..206274a 100644 --- a/core/src/app/(public)/(with-toolbar)/bookmarks/page.tsx +++ b/core/src/app/(public)/(with-toolbar)/bookmarks/page.tsx @@ -5,6 +5,7 @@ import IndicatorsListView from "@/containers/indicators-list-view/IndicatorsList import InfoView from "@/containers/info-view/InfoView" import { CommonValidations } from "@/utils/validation-schemas/common" import pageValidationMiddleware from "@/middlewares/page-validation-middleware/pageValidationMiddleware" +import translate from "@/modules/i18n" export { default as metadata } from "@/app/(public)/(with-toolbar)/bookmarks/metadata" @@ -18,11 +19,14 @@ const Bookmarks = pageValidationMiddleware(async ({ searchParams }) => { return ( } text={"You have no bookmarks yet"} /> + } + text={translate("pages.bookmarks.empty_fallback")} + /> } /> ) diff --git a/core/src/app/(public)/(with-toolbar)/indicator/[id]/[country]/metadata.ts b/core/src/app/(public)/(with-toolbar)/indicator/[id]/[country]/metadata.ts index 0b658f0..1764bb3 100644 --- a/core/src/app/(public)/(with-toolbar)/indicator/[id]/[country]/metadata.ts +++ b/core/src/app/(public)/(with-toolbar)/indicator/[id]/[country]/metadata.ts @@ -4,6 +4,7 @@ import { IndicatorCountryPageProps } from "@/app/(public)/(with-toolbar)/indicat import CountryService from "@/services/country-service/CountryService" import IndicatorService from "@/services/indicator-service/IndicatorService" import { SERVER_ADDRESS } from "@/constants/general" +import translate from "@/modules/i18n" const IMAGES_HOSTING_ADDRESS = process.env.NEXT_PUBLIC_IMAGES_HOSTING_ADDRESS @@ -35,20 +36,20 @@ const generateMetadata = async ({ if (!indicator || !country) { return { metadataBase: new URL(SERVER_ADDRESS), - title: "Not Found", - description: "This page is not exist", + title: translate("pages.not_found.metadata.title"), + description: translate("pages.not_found.metadata.description"), themeColor: "#ffffff", openGraph: { images: [ogImage], - title: "Not Found", - description: "This page is not exist", + title: translate("pages.not_found.metadata.title"), + description: translate("pages.not_found.metadata.description"), type: "website", url: "/", }, twitter: { images: [ogImage], title: "Statify", - description: "This page is not exist", + description: translate("pages.not_found.metadata.description"), card: "summary_large_image", site: "@Zhorrrro", }, @@ -57,20 +58,42 @@ const generateMetadata = async ({ return { metadataBase: new URL(SERVER_ADDRESS), - title: `${indicator.label} in ${country.name}`, - description: `Statistical data of the ${indicator.label} in ${country.name}. ${indicator.description}`, + title: translate("pages.indicator_country.metadata.title", { + country: country.name, + indicator: indicator.label, + }), + description: translate( + "pages.indicator_country.metadata.description_long", + { + country: country.name, + indicator: indicator.label, + description: indicator.description, + } + ), themeColor: "#ffffff", openGraph: { images: [ogImage], - title: `${indicator.label} in ${country.name}`, - description: `Statistical data of the ${indicator.label} in ${country.name}.`, + title: translate("pages.indicator_country.metadata.title", { + country: country.name, + indicator: indicator.label, + }), + description: translate("pages.indicator_country.metadata.description", { + country: country.name, + indicator: indicator.label, + }), type: "website", url: `/indicator/${params.id}/${params.country}`, }, twitter: { images: [ogImage], - title: `${indicator.label} in ${country.name}`, - description: `Statistical data of the ${indicator.label} in ${country.name}.`, + title: translate("pages.indicator_country.metadata.title", { + country: country.name, + indicator: indicator.label, + }), + description: translate("pages.indicator_country.metadata.description", { + country: country.name, + indicator: indicator.label, + }), card: "summary_large_image", site: "@Zhorrrro", }, diff --git a/core/src/app/(public)/(with-toolbar)/indicator/[id]/[country]/page.tsx b/core/src/app/(public)/(with-toolbar)/indicator/[id]/[country]/page.tsx index 263ad83..5bd666e 100644 --- a/core/src/app/(public)/(with-toolbar)/indicator/[id]/[country]/page.tsx +++ b/core/src/app/(public)/(with-toolbar)/indicator/[id]/[country]/page.tsx @@ -7,6 +7,7 @@ import IndicatorChartSection from "@/containers/indicator-chart-section/Indicato import IndicatorCountryTable from "@/containers/indicator-country-table/IndicatorCountryTable" import IndicatorDetailsSection from "@/containers/indicator-details-section/IndicatorDetailsSection" import IndicatorsListView from "@/containers/indicators-list-view/IndicatorsListView" +import translate from "@/modules/i18n" export { default as generateMetadata } from "@/app/(public)/(with-toolbar)/indicator/[id]/[country]/metadata" @@ -44,7 +45,7 @@ async function IndicatorPage({ params }: IndicatorCountryPageProps) { {!!relatedIndicators?.length && ( )} diff --git a/core/src/app/(public)/(with-toolbar)/indicator/[id]/metadata.ts b/core/src/app/(public)/(with-toolbar)/indicator/[id]/metadata.ts index a7e9c20..7e32452 100644 --- a/core/src/app/(public)/(with-toolbar)/indicator/[id]/metadata.ts +++ b/core/src/app/(public)/(with-toolbar)/indicator/[id]/metadata.ts @@ -3,6 +3,7 @@ import { Metadata } from "next/types" import { IndicatorPageProps } from "@/app/(public)/(with-toolbar)/indicator/[id]/types" import IndicatorService from "@/services/indicator-service/IndicatorService" import { SERVER_ADDRESS } from "@/constants/general" +import translate from "@/modules/i18n" const IMAGES_HOSTING_ADDRESS = process.env.NEXT_PUBLIC_IMAGES_HOSTING_ADDRESS @@ -27,20 +28,20 @@ const generateMetadata = async ({ if (!indicator) { return { metadataBase: new URL(SERVER_ADDRESS), - title: "Not Found", - description: "This page is not exist", + title: translate("pages.not_found.metadata.title"), + description: translate("pages.not_found.metadata.description"), themeColor: "#ffffff", openGraph: { images: [ogImage], - title: "Not Found", - description: "This page is not exist", + title: translate("pages.not_found.metadata.title"), + description: translate("pages.not_found.metadata.description"), type: "website", url: "/", }, twitter: { images: [ogImage], title: "Statify", - description: "This page is not exist", + description: translate("pages.not_found.metadata.description"), card: "summary_large_image", site: "@Zhorrrro", }, @@ -50,19 +51,26 @@ const generateMetadata = async ({ return { metadataBase: new URL(SERVER_ADDRESS), title: indicator.label, - description: `Statistical data of ${indicator.label} by country. ${indicator.description}`, + description: translate("pages.indicator.metadata.description_long", { + indicator: indicator.label, + description: indicator.description, + }), themeColor: "#ffffff", openGraph: { images: [ogImage], title: indicator.label, - description: `Statistical data of ${indicator.label} by country.`, + description: translate("pages.indicator.metadata.description", { + indicator: indicator.label, + }), type: "website", url: `/indicator/${params.id}`, }, twitter: { images: [ogImage], title: indicator.label, - description: `Statistical data of ${indicator.label} by country.`, + description: translate("pages.indicator.metadata.description", { + indicator: indicator.label, + }), card: "summary_large_image", site: "@Zhorrrro", }, diff --git a/core/src/app/(public)/(with-toolbar)/indicator/[id]/page.tsx b/core/src/app/(public)/(with-toolbar)/indicator/[id]/page.tsx index d271694..3f800ee 100644 --- a/core/src/app/(public)/(with-toolbar)/indicator/[id]/page.tsx +++ b/core/src/app/(public)/(with-toolbar)/indicator/[id]/page.tsx @@ -8,6 +8,7 @@ import IndicatorDetailsSection from "@/containers/indicator-details-section/Indi import IndicatorTable from "@/containers/indicator-table/IndicatorTable" import IndicatorsListView from "@/containers/indicators-list-view/IndicatorsListView" import { CountryWithValues } from "@/types/country.types" +import translate from "@/modules/i18n" export { default as generateMetadata } from "@/app/(public)/(with-toolbar)/indicator/[id]/metadata" export { default as generateStaticParams } from "@/app/(public)/(with-toolbar)/indicator/[id]/generate-static-params" @@ -63,7 +64,7 @@ async function IndicatorPage({ params }: IndicatorPageProps) { {!!relatedIndicators?.length && ( )} diff --git a/core/src/app/(public)/(with-toolbar)/search/layout.tsx b/core/src/app/(public)/(with-toolbar)/search/layout.tsx index 8b84ec2..04c7250 100644 --- a/core/src/app/(public)/(with-toolbar)/search/layout.tsx +++ b/core/src/app/(public)/(with-toolbar)/search/layout.tsx @@ -1,9 +1,16 @@ import { ReactNode, Suspense } from "react" import IndicatorsListViewLoader from "@/containers/indicators-list-view/IndicatorsListViewLoader" +import translate from "@/modules/i18n" export default function DashboardLayout({ children }: { children: ReactNode }) { return ( - }> + + } + > {children} ) diff --git a/core/src/app/(public)/(with-toolbar)/search/metadata.ts b/core/src/app/(public)/(with-toolbar)/search/metadata.ts index 5c6f0c2..5182858 100644 --- a/core/src/app/(public)/(with-toolbar)/search/metadata.ts +++ b/core/src/app/(public)/(with-toolbar)/search/metadata.ts @@ -1,27 +1,37 @@ import { Metadata } from "next" import { SearchPageProps } from "@/app/(public)/(with-toolbar)/search/types" import { SERVER_ADDRESS } from "@/constants/general" +import translate from "@/modules/i18n" const generateMetadata = async ({ searchParams, }: SearchPageProps): Promise => { return { metadataBase: new URL(SERVER_ADDRESS), - title: `Results for ${searchParams.query}`, - description: `Indicator results for ${searchParams.query}`, + title: translate("pages.search.metadata.title", { + value: searchParams.query, + }), + description: translate("pages.search.metadata.description", { + value: searchParams.query, + }), themeColor: "#ffffff", openGraph: { images: ["/og.png"], - title: `Results for ${searchParams.query}`, - description: `Indicator results for ${searchParams.query}`, + title: translate("pages.search.metadata.title", { + value: searchParams.query, + }), + description: translate("pages.search.metadata.description", { + value: searchParams.query, + }), type: "website", url: `/search?query=${searchParams.query}&page=${searchParams.page}`, }, twitter: { images: ["/og.png"], title: "Statify", - description: - "Explore our database featuring 100+ indicators for hundreds of regions worldwide.", + description: translate("pages.search.metadata.description", { + value: searchParams.query, + }), card: "summary_large_image", site: "@Zhorrrro", }, diff --git a/core/src/app/(public)/(with-toolbar)/search/page.tsx b/core/src/app/(public)/(with-toolbar)/search/page.tsx index 435374f..fc369df 100644 --- a/core/src/app/(public)/(with-toolbar)/search/page.tsx +++ b/core/src/app/(public)/(with-toolbar)/search/page.tsx @@ -4,6 +4,7 @@ import IndicatorsListView from "@/containers/indicators-list-view/IndicatorsList import InfoView from "@/containers/info-view/InfoView" import { CommonValidations } from "@/utils/validation-schemas/common" import pageValidationMiddleware from "@/middlewares/page-validation-middleware/pageValidationMiddleware" +import translate from "@/modules/i18n" export { default as generateMetadata } from "@/app/(public)/(with-toolbar)/search/metadata" @@ -18,18 +19,27 @@ const SearchPage = pageValidationMiddleware(async ({ searchParams }) => { }) : null + const heading = + result && query ? ( + translate("pages.search.heading", { value: query }) + ) : ( + <>  + ) + return (  } + text={heading} pages={result?.pages} page={result?.page} fallback={ } - text={ - result === null ? "Enter a keyword or phrase" : "No datasets found" - } + text={translate( + result === null + ? "pages.search.no_query" + : "pages.search.no_results" + )} /> } /> diff --git a/core/src/app/(public)/(with-toolbar)/terms/metadata.ts b/core/src/app/(public)/(with-toolbar)/terms/metadata.ts index 7ede76f..049e39e 100644 --- a/core/src/app/(public)/(with-toolbar)/terms/metadata.ts +++ b/core/src/app/(public)/(with-toolbar)/terms/metadata.ts @@ -1,25 +1,23 @@ import { Metadata } from "next/types" import { SERVER_ADDRESS } from "@/constants/general" +import translate from "@/modules/i18n" const metadata: Metadata = { metadataBase: new URL(SERVER_ADDRESS), - title: "Terms of Use", - description: - "Terms of Use of Statify. By using our website, you agree to comply with and be bound by the following terms of use. Please read these terms carefully before using Statify.", + title: translate("pages.terms_of_use.metadata.title"), + description: translate("pages.terms_of_use.metadata.description"), themeColor: "#ffffff", openGraph: { images: ["/og.png"], - title: "Terms of Use", - description: - "Terms of Use of Statify. By using our website, you agree to comply with and be bound by the following terms of use. Please read these terms carefully before using Statify.", + title: translate("pages.terms_of_use.metadata.title"), + description: translate("pages.terms_of_use.metadata.description"), type: "website", url: "/terms", }, twitter: { images: ["/og.png"], - title: "Terms of Use", - description: - "Terms of Use of Statify. By using our website, you agree to comply with and be bound by the following terms of use. Please read these terms carefully before using Statify.", + title: translate("pages.terms_of_use.metadata.title"), + description: translate("pages.terms_of_use.metadata.description"), card: "summary_large_image", site: "@Zhorrrro", }, diff --git a/core/src/app/(public)/(with-toolbar)/terms/page.tsx b/core/src/app/(public)/(with-toolbar)/terms/page.tsx index 56bd257..4dd5d14 100644 --- a/core/src/app/(public)/(with-toolbar)/terms/page.tsx +++ b/core/src/app/(public)/(with-toolbar)/terms/page.tsx @@ -1,4 +1,5 @@ import { FC } from "react" +import translate from "@/modules/i18n" import "@/app/(public)/(with-toolbar)/terms/styles.scss" export { default as metadata } from "@/app/(public)/(with-toolbar)/terms/metadata" @@ -7,44 +8,50 @@ const Page: FC = () => { return (
-

Terms of Use

-

Last Updated: 01.02.2024

+

+ {translate("pages.terms_of_use.title")} +

- Welcome to Statify! By using our website, you agree to comply with and - be bound by the following terms of use. Please read these terms - carefully before using Statify. + {translate("pages.terms_of_use.last_update")}

-

Disclaimer of Liability

- We do not guarantee the accuracy, completeness, or reliability of the - data. All data is provided by IMF and The World Bank. + {translate("pages.terms_of_use.welcome")}

-

Use of Information

+

+ {translate("pages.terms_of_use.liability_title")} +

- Users are allowed to use statistical data from Statify for personal, - educational, or commercial purposes. The data should not be used for - illegal or harmful activities. + {translate("pages.terms_of_use.liability_text")}

-

Privacy Policy

+

+ {translate("pages.terms_of_use.use_of_information_title")} +

- Statify does not collect any users' information. So there is no - data to store or share. + {translate("pages.terms_of_use.use_of_information_text")}

-

Ownership

+

+ {translate("pages.terms_of_use.privacy_title")} +

- All design elements, code, scripts, and programming elements used on - Statify are the intellectual property of Heorhii Shvab. Unauthorized - reproduction, modification, or distribution of the code is strictly - prohibited. + {translate("pages.terms_of_use.privacy_text")}

-

Contact Information

-

- For questions, concerns, or requests related to the terms of use, - please contact us at  - - georgiy.shvab@gmail.com - - . +

+ {translate("pages.terms_of_use.ownership_title")} +

+

+ {translate("pages.terms_of_use.ownership_text")} +

+

+ {translate("pages.terms_of_use.contact_title")} +

+

+ {translate("pages.terms_of_use.contact_text", { + a: (chunk: string[]) => ( + + {chunk} + + ), + })}

diff --git a/core/src/app/(public)/metadata.ts b/core/src/app/(public)/metadata.ts index dd0ef4d..ecc8124 100644 --- a/core/src/app/(public)/metadata.ts +++ b/core/src/app/(public)/metadata.ts @@ -1,25 +1,23 @@ import { Metadata } from "next/types" import { SERVER_ADDRESS } from "@/constants/general" +import translate from "@/modules/i18n" const metadata: Metadata = { metadataBase: new URL(SERVER_ADDRESS), title: "Statify", - description: - "Explore our database featuring 100+ indicators for hundreds of regions worldwide. Create customizable charts, view trends, and access hundreds of thousands of data points.", + description: translate("pages.landing.metadata.description_long"), themeColor: "#ffffff", openGraph: { images: ["/og.png"], title: "Statify", - description: - "Explore our database featuring 100+ indicators for hundreds of regions worldwide.", + description: translate("pages.landing.metadata.description"), type: "website", url: "/", }, twitter: { images: ["/og.png"], title: "Statify", - description: - "Explore our database featuring 100+ indicators for hundreds of regions worldwide.", + description: translate("pages.landing.metadata.description"), card: "summary_large_image", site: "@Zhorrrro", }, diff --git a/core/src/app/(public)/page.tsx b/core/src/app/(public)/page.tsx index 83fa308..90ca548 100644 --- a/core/src/app/(public)/page.tsx +++ b/core/src/app/(public)/page.tsx @@ -1,6 +1,7 @@ import { FC, Suspense } from "react" import SearchBar from "@/components/searchbar/SearchBar" import SearchBarLoader from "@/components/searchbar/SearchBarLoader" +import translate from "@/modules/i18n" import "@/app/(public)/styles.scss" export { default as metadata } from "@/app/(public)/metadata" @@ -12,16 +13,22 @@ const Home: FC = () => {

- Discover the World through Data + {translate("pages.landing.title")}

+ } > - +
@@ -30,9 +37,7 @@ const Home: FC = () => { className="landing__subtitle" data-testid="landing-page-description" > - Explore our database featuring 100+ indicators for hundreds of - regions worldwide. Create customizable charts, view trends, and - access hundreds of thousands of data points. + {translate("pages.landing.subtitle")}

diff --git a/core/src/app/error.tsx b/core/src/app/error.tsx index 9d7d44b..5db8f7b 100644 --- a/core/src/app/error.tsx +++ b/core/src/app/error.tsx @@ -5,6 +5,7 @@ import ServerErrorIcon from "@/ui/icons/ServerErrorIcon" import Footer from "@/layout/footer/Footer" import Header from "@/layout/header/Header" import StatusPage from "@/containers/status-page/StatusPage" +import translate from "@/modules/i18n" const Error: FC = () => { return ( @@ -12,8 +13,8 @@ const Error: FC = () => {
} - linkText="To home page" - title="Server Error" + linkText={translate("common.to_home")} + title={translate("errors.server_error")} linkHref="/" />