From 29ae473a96dc405118f80aae247a5d50c63ef06f Mon Sep 17 00:00:00 2001 From: viktoriabakun Date: Thu, 24 Oct 2024 16:28:53 +0200 Subject: [PATCH 01/22] feat: setup namespaces Signed-off-by: viktoriabakun --- apps/shell/src/app/[locale]/layout.tsx | 6 +- .../{messages => src/i18n/authz}/ar.json | 0 .../{messages => src/i18n/authz}/en.json | 0 .../{messages => src/i18n/authz}/id.json | 0 .../{messages => src/i18n/authz}/tr.json | 0 apps/shell/src/i18n/common/ar.json | 3 + apps/shell/src/i18n/common/en.json | 3 + apps/shell/src/i18n/common/id.json | 3 + apps/shell/src/i18n/common/tr.json | 3 + apps/shell/src/i18n/governance/ar.json | 3 + apps/shell/src/i18n/governance/en.json | 3 + apps/shell/src/i18n/governance/id.json | 3 + apps/shell/src/i18n/governance/tr.json | 3 + apps/shell/src/i18n/main/ar.json | 3 + apps/shell/src/i18n/main/en.json | 3 + apps/shell/src/i18n/main/id.json | 3 + apps/shell/src/i18n/main/tr.json | 3 + apps/shell/src/i18n/stacking/ar.json | 3 + apps/shell/src/i18n/stacking/en.json | 3 + apps/shell/src/i18n/stacking/id.json | 3 + apps/shell/src/i18n/stacking/tr.json | 3 + apps/shell/src/i18n/uc-dao/ar.json | 3 + apps/shell/src/i18n/uc-dao/en.json | 3 + apps/shell/src/i18n/uc-dao/id.json | 3 + apps/shell/src/i18n/uc-dao/tr.json | 3 + apps/shell/src/i18n/utils/ar.json | 3 + apps/shell/src/i18n/utils/en.json | 3 + apps/shell/src/i18n/utils/id.json | 3 + apps/shell/src/i18n/utils/tr.json | 3 + apps/shell/src/tolgee/client.tsx | 95 ++++++++++++++++++- apps/shell/src/tolgee/shared.ts | 35 ++++++- 31 files changed, 201 insertions(+), 7 deletions(-) rename apps/shell/{messages => src/i18n/authz}/ar.json (100%) rename apps/shell/{messages => src/i18n/authz}/en.json (100%) rename apps/shell/{messages => src/i18n/authz}/id.json (100%) rename apps/shell/{messages => src/i18n/authz}/tr.json (100%) create mode 100644 apps/shell/src/i18n/common/ar.json create mode 100644 apps/shell/src/i18n/common/en.json create mode 100644 apps/shell/src/i18n/common/id.json create mode 100644 apps/shell/src/i18n/common/tr.json create mode 100644 apps/shell/src/i18n/governance/ar.json create mode 100644 apps/shell/src/i18n/governance/en.json create mode 100644 apps/shell/src/i18n/governance/id.json create mode 100644 apps/shell/src/i18n/governance/tr.json create mode 100644 apps/shell/src/i18n/main/ar.json create mode 100644 apps/shell/src/i18n/main/en.json create mode 100644 apps/shell/src/i18n/main/id.json create mode 100644 apps/shell/src/i18n/main/tr.json create mode 100644 apps/shell/src/i18n/stacking/ar.json create mode 100644 apps/shell/src/i18n/stacking/en.json create mode 100644 apps/shell/src/i18n/stacking/id.json create mode 100644 apps/shell/src/i18n/stacking/tr.json create mode 100644 apps/shell/src/i18n/uc-dao/ar.json create mode 100644 apps/shell/src/i18n/uc-dao/en.json create mode 100644 apps/shell/src/i18n/uc-dao/id.json create mode 100644 apps/shell/src/i18n/uc-dao/tr.json create mode 100644 apps/shell/src/i18n/utils/ar.json create mode 100644 apps/shell/src/i18n/utils/en.json create mode 100644 apps/shell/src/i18n/utils/id.json create mode 100644 apps/shell/src/i18n/utils/tr.json diff --git a/apps/shell/src/app/[locale]/layout.tsx b/apps/shell/src/app/[locale]/layout.tsx index 179764434..ee3205872 100644 --- a/apps/shell/src/app/[locale]/layout.tsx +++ b/apps/shell/src/app/[locale]/layout.tsx @@ -23,7 +23,7 @@ import { env } from '../../env/client'; import { clashDisplayFont, hkGuiseFont } from '../../lib/fonts'; import { AppProviders } from '../../providers/app-providers'; import { PHProvider } from '../../providers/posthog-provider'; -import { ALL_LOCALES, getStaticData } from '../../tolgee/shared'; +import { ALL_LOCALES, getStaticData, Locale } from '../../tolgee/shared'; import '../global.css'; export const metadata: Metadata = { @@ -106,13 +106,13 @@ export default async function RootLayout({ }); } - if (!ALL_LOCALES.includes(params.locale)) { + if (!ALL_LOCALES.includes(params.locale as Locale)) { notFound(); } // make sure you provide all the necessary locales // for the inital SSR render (e.g. fallback languages) - const locales = await getStaticData([params.locale]); + const locales = await getStaticData([params.locale as Locale]); const dehydratedState = dehydrate(queryClient); diff --git a/apps/shell/messages/ar.json b/apps/shell/src/i18n/authz/ar.json similarity index 100% rename from apps/shell/messages/ar.json rename to apps/shell/src/i18n/authz/ar.json diff --git a/apps/shell/messages/en.json b/apps/shell/src/i18n/authz/en.json similarity index 100% rename from apps/shell/messages/en.json rename to apps/shell/src/i18n/authz/en.json diff --git a/apps/shell/messages/id.json b/apps/shell/src/i18n/authz/id.json similarity index 100% rename from apps/shell/messages/id.json rename to apps/shell/src/i18n/authz/id.json diff --git a/apps/shell/messages/tr.json b/apps/shell/src/i18n/authz/tr.json similarity index 100% rename from apps/shell/messages/tr.json rename to apps/shell/src/i18n/authz/tr.json diff --git a/apps/shell/src/i18n/common/ar.json b/apps/shell/src/i18n/common/ar.json new file mode 100644 index 000000000..51be30cee --- /dev/null +++ b/apps/shell/src/i18n/common/ar.json @@ -0,0 +1,3 @@ +{ + "hello-world": "مرحبا بالعالم!" +} diff --git a/apps/shell/src/i18n/common/en.json b/apps/shell/src/i18n/common/en.json new file mode 100644 index 000000000..2d0fed550 --- /dev/null +++ b/apps/shell/src/i18n/common/en.json @@ -0,0 +1,3 @@ +{ + "hello-world": "Hello, World!" +} diff --git a/apps/shell/src/i18n/common/id.json b/apps/shell/src/i18n/common/id.json new file mode 100644 index 000000000..6b8e4db14 --- /dev/null +++ b/apps/shell/src/i18n/common/id.json @@ -0,0 +1,3 @@ +{ + "hello-world": "Halo Dunia!" +} diff --git a/apps/shell/src/i18n/common/tr.json b/apps/shell/src/i18n/common/tr.json new file mode 100644 index 000000000..a6f1ec71d --- /dev/null +++ b/apps/shell/src/i18n/common/tr.json @@ -0,0 +1,3 @@ +{ + "hello-world": "Merhaba Dünya!" +} diff --git a/apps/shell/src/i18n/governance/ar.json b/apps/shell/src/i18n/governance/ar.json new file mode 100644 index 000000000..51be30cee --- /dev/null +++ b/apps/shell/src/i18n/governance/ar.json @@ -0,0 +1,3 @@ +{ + "hello-world": "مرحبا بالعالم!" +} diff --git a/apps/shell/src/i18n/governance/en.json b/apps/shell/src/i18n/governance/en.json new file mode 100644 index 000000000..2d0fed550 --- /dev/null +++ b/apps/shell/src/i18n/governance/en.json @@ -0,0 +1,3 @@ +{ + "hello-world": "Hello, World!" +} diff --git a/apps/shell/src/i18n/governance/id.json b/apps/shell/src/i18n/governance/id.json new file mode 100644 index 000000000..6b8e4db14 --- /dev/null +++ b/apps/shell/src/i18n/governance/id.json @@ -0,0 +1,3 @@ +{ + "hello-world": "Halo Dunia!" +} diff --git a/apps/shell/src/i18n/governance/tr.json b/apps/shell/src/i18n/governance/tr.json new file mode 100644 index 000000000..a6f1ec71d --- /dev/null +++ b/apps/shell/src/i18n/governance/tr.json @@ -0,0 +1,3 @@ +{ + "hello-world": "Merhaba Dünya!" +} diff --git a/apps/shell/src/i18n/main/ar.json b/apps/shell/src/i18n/main/ar.json new file mode 100644 index 000000000..51be30cee --- /dev/null +++ b/apps/shell/src/i18n/main/ar.json @@ -0,0 +1,3 @@ +{ + "hello-world": "مرحبا بالعالم!" +} diff --git a/apps/shell/src/i18n/main/en.json b/apps/shell/src/i18n/main/en.json new file mode 100644 index 000000000..2d0fed550 --- /dev/null +++ b/apps/shell/src/i18n/main/en.json @@ -0,0 +1,3 @@ +{ + "hello-world": "Hello, World!" +} diff --git a/apps/shell/src/i18n/main/id.json b/apps/shell/src/i18n/main/id.json new file mode 100644 index 000000000..6b8e4db14 --- /dev/null +++ b/apps/shell/src/i18n/main/id.json @@ -0,0 +1,3 @@ +{ + "hello-world": "Halo Dunia!" +} diff --git a/apps/shell/src/i18n/main/tr.json b/apps/shell/src/i18n/main/tr.json new file mode 100644 index 000000000..a6f1ec71d --- /dev/null +++ b/apps/shell/src/i18n/main/tr.json @@ -0,0 +1,3 @@ +{ + "hello-world": "Merhaba Dünya!" +} diff --git a/apps/shell/src/i18n/stacking/ar.json b/apps/shell/src/i18n/stacking/ar.json new file mode 100644 index 000000000..51be30cee --- /dev/null +++ b/apps/shell/src/i18n/stacking/ar.json @@ -0,0 +1,3 @@ +{ + "hello-world": "مرحبا بالعالم!" +} diff --git a/apps/shell/src/i18n/stacking/en.json b/apps/shell/src/i18n/stacking/en.json new file mode 100644 index 000000000..2d0fed550 --- /dev/null +++ b/apps/shell/src/i18n/stacking/en.json @@ -0,0 +1,3 @@ +{ + "hello-world": "Hello, World!" +} diff --git a/apps/shell/src/i18n/stacking/id.json b/apps/shell/src/i18n/stacking/id.json new file mode 100644 index 000000000..6b8e4db14 --- /dev/null +++ b/apps/shell/src/i18n/stacking/id.json @@ -0,0 +1,3 @@ +{ + "hello-world": "Halo Dunia!" +} diff --git a/apps/shell/src/i18n/stacking/tr.json b/apps/shell/src/i18n/stacking/tr.json new file mode 100644 index 000000000..a6f1ec71d --- /dev/null +++ b/apps/shell/src/i18n/stacking/tr.json @@ -0,0 +1,3 @@ +{ + "hello-world": "Merhaba Dünya!" +} diff --git a/apps/shell/src/i18n/uc-dao/ar.json b/apps/shell/src/i18n/uc-dao/ar.json new file mode 100644 index 000000000..51be30cee --- /dev/null +++ b/apps/shell/src/i18n/uc-dao/ar.json @@ -0,0 +1,3 @@ +{ + "hello-world": "مرحبا بالعالم!" +} diff --git a/apps/shell/src/i18n/uc-dao/en.json b/apps/shell/src/i18n/uc-dao/en.json new file mode 100644 index 000000000..2d0fed550 --- /dev/null +++ b/apps/shell/src/i18n/uc-dao/en.json @@ -0,0 +1,3 @@ +{ + "hello-world": "Hello, World!" +} diff --git a/apps/shell/src/i18n/uc-dao/id.json b/apps/shell/src/i18n/uc-dao/id.json new file mode 100644 index 000000000..6b8e4db14 --- /dev/null +++ b/apps/shell/src/i18n/uc-dao/id.json @@ -0,0 +1,3 @@ +{ + "hello-world": "Halo Dunia!" +} diff --git a/apps/shell/src/i18n/uc-dao/tr.json b/apps/shell/src/i18n/uc-dao/tr.json new file mode 100644 index 000000000..a6f1ec71d --- /dev/null +++ b/apps/shell/src/i18n/uc-dao/tr.json @@ -0,0 +1,3 @@ +{ + "hello-world": "Merhaba Dünya!" +} diff --git a/apps/shell/src/i18n/utils/ar.json b/apps/shell/src/i18n/utils/ar.json new file mode 100644 index 000000000..51be30cee --- /dev/null +++ b/apps/shell/src/i18n/utils/ar.json @@ -0,0 +1,3 @@ +{ + "hello-world": "مرحبا بالعالم!" +} diff --git a/apps/shell/src/i18n/utils/en.json b/apps/shell/src/i18n/utils/en.json new file mode 100644 index 000000000..2d0fed550 --- /dev/null +++ b/apps/shell/src/i18n/utils/en.json @@ -0,0 +1,3 @@ +{ + "hello-world": "Hello, World!" +} diff --git a/apps/shell/src/i18n/utils/id.json b/apps/shell/src/i18n/utils/id.json new file mode 100644 index 000000000..6b8e4db14 --- /dev/null +++ b/apps/shell/src/i18n/utils/id.json @@ -0,0 +1,3 @@ +{ + "hello-world": "Halo Dunia!" +} diff --git a/apps/shell/src/i18n/utils/tr.json b/apps/shell/src/i18n/utils/tr.json new file mode 100644 index 000000000..a6f1ec71d --- /dev/null +++ b/apps/shell/src/i18n/utils/tr.json @@ -0,0 +1,3 @@ +{ + "hello-world": "Merhaba Dünya!" +} diff --git a/apps/shell/src/tolgee/client.tsx b/apps/shell/src/tolgee/client.tsx index 64734af0d..cc56fb6df 100644 --- a/apps/shell/src/tolgee/client.tsx +++ b/apps/shell/src/tolgee/client.tsx @@ -11,7 +11,100 @@ type Props = { children: React.ReactNode; }; -const tolgee = TolgeeBase().init(); +const tolgee = TolgeeBase().init({ + defaultNs: 'common', + defaultLanguage: 'en', + staticData: { + // ENGLISH + 'en:common': () => { + return import('../i18n/common/en.json'); + }, + 'en:utils': () => { + return import('../i18n/utils/en.json'); + }, + 'en:uc-dao': () => { + return import('../i18n/uc-dao/en.json'); + }, + 'en:main': () => { + return import('../i18n/main/en.json'); + }, + 'en:stacking': () => { + return import('../i18n/stacking/en.json'); + }, + 'en:governance': () => { + return import('../i18n/governance/en.json'); + }, + 'en:authz': () => { + return import('../i18n/authz/en.json'); + }, + // ARABIC + 'ar:common': () => { + return import('../i18n/common/ar.json'); + }, + 'ar:utils': () => { + return import('../i18n/utils/ar.json'); + }, + 'ar:uc-dao': () => { + return import('../i18n/uc-dao/ar.json'); + }, + 'ar:main': () => { + return import('../i18n/main/ar.json'); + }, + 'ar:stacking': () => { + return import('../i18n/stacking/ar.json'); + }, + 'ar:governance': () => { + return import('../i18n/governance/ar.json'); + }, + 'ar:authz': () => { + return import('../i18n/authz/ar.json'); + }, + // INDONESIAN (BAHASA) + 'id:common': () => { + return import('../i18n/common/id.json'); + }, + 'id:utils': () => { + return import('../i18n/utils/id.json'); + }, + 'id:uc-dao': () => { + return import('../i18n/uc-dao/id.json'); + }, + 'id:main': () => { + return import('../i18n/main/id.json'); + }, + 'id:stacking': () => { + return import('../i18n/stacking/id.json'); + }, + 'id:governance': () => { + return import('../i18n/governance/id.json'); + }, + 'id:authz': () => { + return import('../i18n/authz/id.json'); + }, + // TURKISH + 'tr:common': () => { + return import('../i18n/common/tr.json'); + }, + 'tr:utils': () => { + return import('../i18n/utils/tr.json'); + }, + 'tr:uc-dao': () => { + return import('../i18n/uc-dao/tr.json'); + }, + 'tr:main': () => { + return import('../i18n/main/tr.json'); + }, + 'tr:stacking': () => { + return import('../i18n/stacking/tr.json'); + }, + 'tr:governance': () => { + return import('../i18n/governance/tr.json'); + }, + 'tr:authz': () => { + return import('../i18n/authz/tr.json'); + }, + }, +}); export const TolgeeNextProvider = ({ locale, locales, children }: Props) => { // synchronize SSR and client first render diff --git a/apps/shell/src/tolgee/shared.ts b/apps/shell/src/tolgee/shared.ts index a6da327f6..9e32b8dd1 100644 --- a/apps/shell/src/tolgee/shared.ts +++ b/apps/shell/src/tolgee/shared.ts @@ -1,16 +1,45 @@ import { DevTools, Tolgee, FormatSimple } from '@tolgee/web'; -export const ALL_LOCALES = ['en', 'ar', 'id', 'tr']; +export type Locale = 'en' | 'ar' | 'id' | 'tr'; +export const ALL_LOCALES: Locale[] = ['en', 'ar', 'id', 'tr']; + +export type Namespace = + | 'common' + | 'utils' + | 'uc-dao' + | 'main' + | 'stacking' + | 'governance' + | 'authz'; +export const ALL_NAMESPACES: Namespace[] = [ + 'common', + 'utils', + 'uc-dao', + 'main', + 'stacking', + 'governance', + 'authz', +]; export const DEFAULT_LOCALE = 'en'; const apiKey = process.env.NEXT_PUBLIC_TOLGEE_API_KEY; const apiUrl = process.env.NEXT_PUBLIC_TOLGEE_API_URL; -export async function getStaticData(languages: string[]) { +export async function getStaticData(languages: Locale[]) { const result: Record = {}; for (const lang of languages) { - result[lang] = (await import(`../../messages/${lang}.json`)).default; + for (const ns of ALL_NAMESPACES) { + try { + const data = (await import(`../i18n/${ns}/${lang}.json`)).default; + result[`${lang}:${ns}`] = data; + } catch (error) { + console.error( + `Error loading namespace "${ns}" for language "${lang}":`, + { error, languages, ALL_NAMESPACES }, + ); + } + } } return result; } From 84dc94398659fe2f413c7119e08e7eb79fa62bcc Mon Sep 17 00:00:00 2001 From: viktoriabakun Date: Thu, 24 Oct 2024 17:25:03 +0200 Subject: [PATCH 02/22] feat: leave single translation file by lang with namespaces as keys in it Signed-off-by: viktoriabakun --- apps/shell/src/i18n/ar.json | 11 +++ apps/shell/src/i18n/authz/ar.json | 3 - apps/shell/src/i18n/authz/en.json | 3 - apps/shell/src/i18n/authz/id.json | 3 - apps/shell/src/i18n/authz/tr.json | 3 - apps/shell/src/i18n/common/ar.json | 3 - apps/shell/src/i18n/common/en.json | 3 - apps/shell/src/i18n/common/id.json | 3 - apps/shell/src/i18n/common/tr.json | 3 - apps/shell/src/i18n/en.json | 11 +++ apps/shell/src/i18n/governance/ar.json | 3 - apps/shell/src/i18n/governance/en.json | 3 - apps/shell/src/i18n/governance/id.json | 3 - apps/shell/src/i18n/governance/tr.json | 3 - apps/shell/src/i18n/id.json | 11 +++ apps/shell/src/i18n/main/ar.json | 3 - apps/shell/src/i18n/main/en.json | 3 - apps/shell/src/i18n/main/id.json | 3 - apps/shell/src/i18n/main/tr.json | 3 - apps/shell/src/i18n/stacking/ar.json | 3 - apps/shell/src/i18n/stacking/en.json | 3 - apps/shell/src/i18n/stacking/id.json | 3 - apps/shell/src/i18n/stacking/tr.json | 3 - apps/shell/src/i18n/tr.json | 11 +++ apps/shell/src/i18n/uc-dao/ar.json | 3 - apps/shell/src/i18n/uc-dao/en.json | 3 - apps/shell/src/i18n/uc-dao/id.json | 3 - apps/shell/src/i18n/uc-dao/tr.json | 3 - apps/shell/src/i18n/utils/ar.json | 3 - apps/shell/src/i18n/utils/en.json | 3 - apps/shell/src/i18n/utils/id.json | 3 - apps/shell/src/i18n/utils/tr.json | 3 - apps/shell/src/tolgee/client.tsx | 108 ++++--------------------- apps/shell/src/tolgee/shared.ts | 4 +- 34 files changed, 61 insertions(+), 179 deletions(-) create mode 100644 apps/shell/src/i18n/ar.json delete mode 100644 apps/shell/src/i18n/authz/ar.json delete mode 100644 apps/shell/src/i18n/authz/en.json delete mode 100644 apps/shell/src/i18n/authz/id.json delete mode 100644 apps/shell/src/i18n/authz/tr.json delete mode 100644 apps/shell/src/i18n/common/ar.json delete mode 100644 apps/shell/src/i18n/common/en.json delete mode 100644 apps/shell/src/i18n/common/id.json delete mode 100644 apps/shell/src/i18n/common/tr.json create mode 100644 apps/shell/src/i18n/en.json delete mode 100644 apps/shell/src/i18n/governance/ar.json delete mode 100644 apps/shell/src/i18n/governance/en.json delete mode 100644 apps/shell/src/i18n/governance/id.json delete mode 100644 apps/shell/src/i18n/governance/tr.json create mode 100644 apps/shell/src/i18n/id.json delete mode 100644 apps/shell/src/i18n/main/ar.json delete mode 100644 apps/shell/src/i18n/main/en.json delete mode 100644 apps/shell/src/i18n/main/id.json delete mode 100644 apps/shell/src/i18n/main/tr.json delete mode 100644 apps/shell/src/i18n/stacking/ar.json delete mode 100644 apps/shell/src/i18n/stacking/en.json delete mode 100644 apps/shell/src/i18n/stacking/id.json delete mode 100644 apps/shell/src/i18n/stacking/tr.json create mode 100644 apps/shell/src/i18n/tr.json delete mode 100644 apps/shell/src/i18n/uc-dao/ar.json delete mode 100644 apps/shell/src/i18n/uc-dao/en.json delete mode 100644 apps/shell/src/i18n/uc-dao/id.json delete mode 100644 apps/shell/src/i18n/uc-dao/tr.json delete mode 100644 apps/shell/src/i18n/utils/ar.json delete mode 100644 apps/shell/src/i18n/utils/en.json delete mode 100644 apps/shell/src/i18n/utils/id.json delete mode 100644 apps/shell/src/i18n/utils/tr.json diff --git a/apps/shell/src/i18n/ar.json b/apps/shell/src/i18n/ar.json new file mode 100644 index 000000000..41989fa7e --- /dev/null +++ b/apps/shell/src/i18n/ar.json @@ -0,0 +1,11 @@ +{ + "authz": {}, + "common": { + "hello-world": "مرحبا بالعالم!" + }, + "governance": {}, + "main": {}, + "stacking": {}, + "uc-dao": {}, + "utils": {} +} diff --git a/apps/shell/src/i18n/authz/ar.json b/apps/shell/src/i18n/authz/ar.json deleted file mode 100644 index 51be30cee..000000000 --- a/apps/shell/src/i18n/authz/ar.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "hello-world": "مرحبا بالعالم!" -} diff --git a/apps/shell/src/i18n/authz/en.json b/apps/shell/src/i18n/authz/en.json deleted file mode 100644 index 2d0fed550..000000000 --- a/apps/shell/src/i18n/authz/en.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "hello-world": "Hello, World!" -} diff --git a/apps/shell/src/i18n/authz/id.json b/apps/shell/src/i18n/authz/id.json deleted file mode 100644 index 6b8e4db14..000000000 --- a/apps/shell/src/i18n/authz/id.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "hello-world": "Halo Dunia!" -} diff --git a/apps/shell/src/i18n/authz/tr.json b/apps/shell/src/i18n/authz/tr.json deleted file mode 100644 index a6f1ec71d..000000000 --- a/apps/shell/src/i18n/authz/tr.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "hello-world": "Merhaba Dünya!" -} diff --git a/apps/shell/src/i18n/common/ar.json b/apps/shell/src/i18n/common/ar.json deleted file mode 100644 index 51be30cee..000000000 --- a/apps/shell/src/i18n/common/ar.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "hello-world": "مرحبا بالعالم!" -} diff --git a/apps/shell/src/i18n/common/en.json b/apps/shell/src/i18n/common/en.json deleted file mode 100644 index 2d0fed550..000000000 --- a/apps/shell/src/i18n/common/en.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "hello-world": "Hello, World!" -} diff --git a/apps/shell/src/i18n/common/id.json b/apps/shell/src/i18n/common/id.json deleted file mode 100644 index 6b8e4db14..000000000 --- a/apps/shell/src/i18n/common/id.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "hello-world": "Halo Dunia!" -} diff --git a/apps/shell/src/i18n/common/tr.json b/apps/shell/src/i18n/common/tr.json deleted file mode 100644 index a6f1ec71d..000000000 --- a/apps/shell/src/i18n/common/tr.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "hello-world": "Merhaba Dünya!" -} diff --git a/apps/shell/src/i18n/en.json b/apps/shell/src/i18n/en.json new file mode 100644 index 000000000..c976efa80 --- /dev/null +++ b/apps/shell/src/i18n/en.json @@ -0,0 +1,11 @@ +{ + "authz": {}, + "common": { + "hello-world": "Hello, World!" + }, + "governance": {}, + "main": {}, + "stacking": {}, + "uc-dao": {}, + "utils": {} +} diff --git a/apps/shell/src/i18n/governance/ar.json b/apps/shell/src/i18n/governance/ar.json deleted file mode 100644 index 51be30cee..000000000 --- a/apps/shell/src/i18n/governance/ar.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "hello-world": "مرحبا بالعالم!" -} diff --git a/apps/shell/src/i18n/governance/en.json b/apps/shell/src/i18n/governance/en.json deleted file mode 100644 index 2d0fed550..000000000 --- a/apps/shell/src/i18n/governance/en.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "hello-world": "Hello, World!" -} diff --git a/apps/shell/src/i18n/governance/id.json b/apps/shell/src/i18n/governance/id.json deleted file mode 100644 index 6b8e4db14..000000000 --- a/apps/shell/src/i18n/governance/id.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "hello-world": "Halo Dunia!" -} diff --git a/apps/shell/src/i18n/governance/tr.json b/apps/shell/src/i18n/governance/tr.json deleted file mode 100644 index a6f1ec71d..000000000 --- a/apps/shell/src/i18n/governance/tr.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "hello-world": "Merhaba Dünya!" -} diff --git a/apps/shell/src/i18n/id.json b/apps/shell/src/i18n/id.json new file mode 100644 index 000000000..a75b2f5b4 --- /dev/null +++ b/apps/shell/src/i18n/id.json @@ -0,0 +1,11 @@ +{ + "authz": {}, + "common": { + "hello-world": "Halo Dunia!" + }, + "governance": {}, + "main": {}, + "stacking": {}, + "uc-dao": {}, + "utils": {} +} diff --git a/apps/shell/src/i18n/main/ar.json b/apps/shell/src/i18n/main/ar.json deleted file mode 100644 index 51be30cee..000000000 --- a/apps/shell/src/i18n/main/ar.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "hello-world": "مرحبا بالعالم!" -} diff --git a/apps/shell/src/i18n/main/en.json b/apps/shell/src/i18n/main/en.json deleted file mode 100644 index 2d0fed550..000000000 --- a/apps/shell/src/i18n/main/en.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "hello-world": "Hello, World!" -} diff --git a/apps/shell/src/i18n/main/id.json b/apps/shell/src/i18n/main/id.json deleted file mode 100644 index 6b8e4db14..000000000 --- a/apps/shell/src/i18n/main/id.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "hello-world": "Halo Dunia!" -} diff --git a/apps/shell/src/i18n/main/tr.json b/apps/shell/src/i18n/main/tr.json deleted file mode 100644 index a6f1ec71d..000000000 --- a/apps/shell/src/i18n/main/tr.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "hello-world": "Merhaba Dünya!" -} diff --git a/apps/shell/src/i18n/stacking/ar.json b/apps/shell/src/i18n/stacking/ar.json deleted file mode 100644 index 51be30cee..000000000 --- a/apps/shell/src/i18n/stacking/ar.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "hello-world": "مرحبا بالعالم!" -} diff --git a/apps/shell/src/i18n/stacking/en.json b/apps/shell/src/i18n/stacking/en.json deleted file mode 100644 index 2d0fed550..000000000 --- a/apps/shell/src/i18n/stacking/en.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "hello-world": "Hello, World!" -} diff --git a/apps/shell/src/i18n/stacking/id.json b/apps/shell/src/i18n/stacking/id.json deleted file mode 100644 index 6b8e4db14..000000000 --- a/apps/shell/src/i18n/stacking/id.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "hello-world": "Halo Dunia!" -} diff --git a/apps/shell/src/i18n/stacking/tr.json b/apps/shell/src/i18n/stacking/tr.json deleted file mode 100644 index a6f1ec71d..000000000 --- a/apps/shell/src/i18n/stacking/tr.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "hello-world": "Merhaba Dünya!" -} diff --git a/apps/shell/src/i18n/tr.json b/apps/shell/src/i18n/tr.json new file mode 100644 index 000000000..7a298fd2c --- /dev/null +++ b/apps/shell/src/i18n/tr.json @@ -0,0 +1,11 @@ +{ + "authz": {}, + "common": { + "hello-world": "Merhaba Dünya!" + }, + "governance": {}, + "main": {}, + "stacking": {}, + "uc-dao": {}, + "utils": {} +} diff --git a/apps/shell/src/i18n/uc-dao/ar.json b/apps/shell/src/i18n/uc-dao/ar.json deleted file mode 100644 index 51be30cee..000000000 --- a/apps/shell/src/i18n/uc-dao/ar.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "hello-world": "مرحبا بالعالم!" -} diff --git a/apps/shell/src/i18n/uc-dao/en.json b/apps/shell/src/i18n/uc-dao/en.json deleted file mode 100644 index 2d0fed550..000000000 --- a/apps/shell/src/i18n/uc-dao/en.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "hello-world": "Hello, World!" -} diff --git a/apps/shell/src/i18n/uc-dao/id.json b/apps/shell/src/i18n/uc-dao/id.json deleted file mode 100644 index 6b8e4db14..000000000 --- a/apps/shell/src/i18n/uc-dao/id.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "hello-world": "Halo Dunia!" -} diff --git a/apps/shell/src/i18n/uc-dao/tr.json b/apps/shell/src/i18n/uc-dao/tr.json deleted file mode 100644 index a6f1ec71d..000000000 --- a/apps/shell/src/i18n/uc-dao/tr.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "hello-world": "Merhaba Dünya!" -} diff --git a/apps/shell/src/i18n/utils/ar.json b/apps/shell/src/i18n/utils/ar.json deleted file mode 100644 index 51be30cee..000000000 --- a/apps/shell/src/i18n/utils/ar.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "hello-world": "مرحبا بالعالم!" -} diff --git a/apps/shell/src/i18n/utils/en.json b/apps/shell/src/i18n/utils/en.json deleted file mode 100644 index 2d0fed550..000000000 --- a/apps/shell/src/i18n/utils/en.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "hello-world": "Hello, World!" -} diff --git a/apps/shell/src/i18n/utils/id.json b/apps/shell/src/i18n/utils/id.json deleted file mode 100644 index 6b8e4db14..000000000 --- a/apps/shell/src/i18n/utils/id.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "hello-world": "Halo Dunia!" -} diff --git a/apps/shell/src/i18n/utils/tr.json b/apps/shell/src/i18n/utils/tr.json deleted file mode 100644 index a6f1ec71d..000000000 --- a/apps/shell/src/i18n/utils/tr.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "hello-world": "Merhaba Dünya!" -} diff --git a/apps/shell/src/tolgee/client.tsx b/apps/shell/src/tolgee/client.tsx index cc56fb6df..843d656fd 100644 --- a/apps/shell/src/tolgee/client.tsx +++ b/apps/shell/src/tolgee/client.tsx @@ -1,109 +1,31 @@ 'use client'; -import { useEffect } from 'react'; +import { ReactNode, useEffect } from 'react'; import { TolgeeProvider, useTolgeeSSR } from '@tolgee/react'; import { useRouter } from 'next/navigation'; -import { TolgeeBase } from './shared'; +import { ALL_LOCALES, ALL_NAMESPACES, TolgeeBase } from './shared'; type Props = { locales: any; locale: string; - children: React.ReactNode; + children: ReactNode; }; +const staticData: Record Promise> = {}; + +ALL_LOCALES.forEach((loc) => { + ALL_NAMESPACES.forEach((ns) => { + staticData[`${loc}:${ns}`] = async () => { + const data = await import(`../i18n/${loc}.json`); + return data[ns]; + }; + }); +}); + const tolgee = TolgeeBase().init({ defaultNs: 'common', defaultLanguage: 'en', - staticData: { - // ENGLISH - 'en:common': () => { - return import('../i18n/common/en.json'); - }, - 'en:utils': () => { - return import('../i18n/utils/en.json'); - }, - 'en:uc-dao': () => { - return import('../i18n/uc-dao/en.json'); - }, - 'en:main': () => { - return import('../i18n/main/en.json'); - }, - 'en:stacking': () => { - return import('../i18n/stacking/en.json'); - }, - 'en:governance': () => { - return import('../i18n/governance/en.json'); - }, - 'en:authz': () => { - return import('../i18n/authz/en.json'); - }, - // ARABIC - 'ar:common': () => { - return import('../i18n/common/ar.json'); - }, - 'ar:utils': () => { - return import('../i18n/utils/ar.json'); - }, - 'ar:uc-dao': () => { - return import('../i18n/uc-dao/ar.json'); - }, - 'ar:main': () => { - return import('../i18n/main/ar.json'); - }, - 'ar:stacking': () => { - return import('../i18n/stacking/ar.json'); - }, - 'ar:governance': () => { - return import('../i18n/governance/ar.json'); - }, - 'ar:authz': () => { - return import('../i18n/authz/ar.json'); - }, - // INDONESIAN (BAHASA) - 'id:common': () => { - return import('../i18n/common/id.json'); - }, - 'id:utils': () => { - return import('../i18n/utils/id.json'); - }, - 'id:uc-dao': () => { - return import('../i18n/uc-dao/id.json'); - }, - 'id:main': () => { - return import('../i18n/main/id.json'); - }, - 'id:stacking': () => { - return import('../i18n/stacking/id.json'); - }, - 'id:governance': () => { - return import('../i18n/governance/id.json'); - }, - 'id:authz': () => { - return import('../i18n/authz/id.json'); - }, - // TURKISH - 'tr:common': () => { - return import('../i18n/common/tr.json'); - }, - 'tr:utils': () => { - return import('../i18n/utils/tr.json'); - }, - 'tr:uc-dao': () => { - return import('../i18n/uc-dao/tr.json'); - }, - 'tr:main': () => { - return import('../i18n/main/tr.json'); - }, - 'tr:stacking': () => { - return import('../i18n/stacking/tr.json'); - }, - 'tr:governance': () => { - return import('../i18n/governance/tr.json'); - }, - 'tr:authz': () => { - return import('../i18n/authz/tr.json'); - }, - }, + staticData, }); export const TolgeeNextProvider = ({ locale, locales, children }: Props) => { diff --git a/apps/shell/src/tolgee/shared.ts b/apps/shell/src/tolgee/shared.ts index 9e32b8dd1..0c690b2a0 100644 --- a/apps/shell/src/tolgee/shared.ts +++ b/apps/shell/src/tolgee/shared.ts @@ -31,8 +31,8 @@ export async function getStaticData(languages: Locale[]) { for (const lang of languages) { for (const ns of ALL_NAMESPACES) { try { - const data = (await import(`../i18n/${ns}/${lang}.json`)).default; - result[`${lang}:${ns}`] = data; + const data = (await import(`../i18n/${lang}.json`)).default; + result[`${lang}:${ns}`] = data[ns]; } catch (error) { console.error( `Error loading namespace "${ns}" for language "${lang}":`, From b19d35e156268de75a7098b3dbdd6872598f9ceb Mon Sep 17 00:00:00 2001 From: viktoriabakun Date: Mon, 28 Oct 2024 10:05:48 +0100 Subject: [PATCH 03/22] feat(utils): use tolgee keys Signed-off-by: viktoriabakun --- apps/shell/src/i18n/ar.json | 11 ++++++-- apps/shell/src/i18n/en.json | 11 ++++++-- apps/shell/src/i18n/id.json | 11 ++++++-- apps/shell/src/i18n/tr.json | 11 ++++++-- .../src/lib/address-conversion-page.tsx | 25 +++++++++++++------ 5 files changed, 53 insertions(+), 16 deletions(-) diff --git a/apps/shell/src/i18n/ar.json b/apps/shell/src/i18n/ar.json index 41989fa7e..3c51fec74 100644 --- a/apps/shell/src/i18n/ar.json +++ b/apps/shell/src/i18n/ar.json @@ -1,11 +1,18 @@ { "authz": {}, "common": { - "hello-world": "مرحبا بالعالم!" + "click-to-copy": "", + "copied": "" }, "governance": {}, "main": {}, "stacking": {}, "uc-dao": {}, - "utils": {} + "utils": { + "address-conversion-title": "", + "address-label": "", + "balance-label": "", + "converted-address-label": "", + "invalid-address": "" + } } diff --git a/apps/shell/src/i18n/en.json b/apps/shell/src/i18n/en.json index c976efa80..58a18e3c3 100644 --- a/apps/shell/src/i18n/en.json +++ b/apps/shell/src/i18n/en.json @@ -1,11 +1,18 @@ { "authz": {}, "common": { - "hello-world": "Hello, World!" + "copied": "Copied!", + "click-to-copy": "Click to copy" }, "governance": {}, "main": {}, "stacking": {}, "uc-dao": {}, - "utils": {} + "utils": { + "invalid-address": "Please enter a valid address", + "address-conversion-title": "Address Conversion", + "address-label": "Address", + "converted-address-label": "Converted address", + "balance-label": "Balance" + } } diff --git a/apps/shell/src/i18n/id.json b/apps/shell/src/i18n/id.json index a75b2f5b4..3c51fec74 100644 --- a/apps/shell/src/i18n/id.json +++ b/apps/shell/src/i18n/id.json @@ -1,11 +1,18 @@ { "authz": {}, "common": { - "hello-world": "Halo Dunia!" + "click-to-copy": "", + "copied": "" }, "governance": {}, "main": {}, "stacking": {}, "uc-dao": {}, - "utils": {} + "utils": { + "address-conversion-title": "", + "address-label": "", + "balance-label": "", + "converted-address-label": "", + "invalid-address": "" + } } diff --git a/apps/shell/src/i18n/tr.json b/apps/shell/src/i18n/tr.json index 7a298fd2c..3c51fec74 100644 --- a/apps/shell/src/i18n/tr.json +++ b/apps/shell/src/i18n/tr.json @@ -1,11 +1,18 @@ { "authz": {}, "common": { - "hello-world": "Merhaba Dünya!" + "click-to-copy": "", + "copied": "" }, "governance": {}, "main": {}, "stacking": {}, "uc-dao": {}, - "utils": {} + "utils": { + "address-conversion-title": "", + "address-label": "", + "balance-label": "", + "converted-address-label": "", + "invalid-address": "" + } } diff --git a/libs/address-conversion/src/lib/address-conversion-page.tsx b/libs/address-conversion/src/lib/address-conversion-page.tsx index d52613902..0e68ce356 100644 --- a/libs/address-conversion/src/lib/address-conversion-page.tsx +++ b/libs/address-conversion/src/lib/address-conversion-page.tsx @@ -1,6 +1,7 @@ 'use client'; import { ChangeEvent, useCallback, useEffect, useState } from 'react'; +import { useTranslate } from '@tolgee/react'; import clsx from 'clsx'; import debounce from 'lodash/debounce'; import { @@ -25,6 +26,7 @@ import { LabeledBlock } from './components/labeled-block'; const symbol = 'ISLM'; export function AddressConversionPage() { + const { t } = useTranslate(); const { copyText } = useClipboard(); const [enteredAddress, setEnteredAddress] = useState(''); @@ -54,14 +56,16 @@ export function AddressConversionPage() { } else { setConvertedAddress(''); setValidHaqqAddress(''); - setInputError('Please enter a valid address'); + setInputError( + t('invalid-address', 'Please enter a valid address', { ns: 'utils' }), + ); } } else { setInputError(''); setValidHaqqAddress(''); setConvertedAddress(''); } - }, [enteredAddress]); + }, [enteredAddress, t]); const handleValidateAddressDebounced = debounce(handleValidateAddress, 200); @@ -89,7 +93,9 @@ export function AddressConversionPage() {
- Address Conversion + {t('address-conversion-title', 'Address Conversion', { + ns: 'utils', + })}
@@ -98,6 +104,7 @@ export function AddressConversionPage() {
+ {/* eslint-disable-next-line i18next/no-literal-string */} Bech32 / EVM @@ -106,7 +113,7 @@ export function AddressConversionPage() {
Date: Mon, 28 Oct 2024 10:26:27 +0100 Subject: [PATCH 04/22] feat(utils): remove empty vals from json files Signed-off-by: viktoriabakun --- apps/shell/src/i18n/ar.json | 13 ++----------- apps/shell/src/i18n/id.json | 13 ++----------- apps/shell/src/i18n/tr.json | 13 ++----------- 3 files changed, 6 insertions(+), 33 deletions(-) diff --git a/apps/shell/src/i18n/ar.json b/apps/shell/src/i18n/ar.json index 3c51fec74..b571f58fc 100644 --- a/apps/shell/src/i18n/ar.json +++ b/apps/shell/src/i18n/ar.json @@ -1,18 +1,9 @@ { "authz": {}, - "common": { - "click-to-copy": "", - "copied": "" - }, + "common": {}, "governance": {}, "main": {}, "stacking": {}, "uc-dao": {}, - "utils": { - "address-conversion-title": "", - "address-label": "", - "balance-label": "", - "converted-address-label": "", - "invalid-address": "" - } + "utils": {} } diff --git a/apps/shell/src/i18n/id.json b/apps/shell/src/i18n/id.json index 3c51fec74..b571f58fc 100644 --- a/apps/shell/src/i18n/id.json +++ b/apps/shell/src/i18n/id.json @@ -1,18 +1,9 @@ { "authz": {}, - "common": { - "click-to-copy": "", - "copied": "" - }, + "common": {}, "governance": {}, "main": {}, "stacking": {}, "uc-dao": {}, - "utils": { - "address-conversion-title": "", - "address-label": "", - "balance-label": "", - "converted-address-label": "", - "invalid-address": "" - } + "utils": {} } diff --git a/apps/shell/src/i18n/tr.json b/apps/shell/src/i18n/tr.json index 3c51fec74..b571f58fc 100644 --- a/apps/shell/src/i18n/tr.json +++ b/apps/shell/src/i18n/tr.json @@ -1,18 +1,9 @@ { "authz": {}, - "common": { - "click-to-copy": "", - "copied": "" - }, + "common": {}, "governance": {}, "main": {}, "stacking": {}, "uc-dao": {}, - "utils": { - "address-conversion-title": "", - "address-label": "", - "balance-label": "", - "converted-address-label": "", - "invalid-address": "" - } + "utils": {} } From ef9f82ebcc3ad9137dad9dc51c82660853e7e777 Mon Sep 17 00:00:00 2001 From: Oleg Shilov Date: Mon, 28 Oct 2024 22:06:51 +0700 Subject: [PATCH 05/22] chore: get rid of `any` in localisation components --- apps/shell/src/providers/app-providers.tsx | 3 ++- apps/shell/src/tolgee/client.tsx | 4 ++-- apps/shell/src/tolgee/shared.ts | 10 +++++++--- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/apps/shell/src/providers/app-providers.tsx b/apps/shell/src/providers/app-providers.tsx index 9477aebb6..39c6d7bef 100644 --- a/apps/shell/src/providers/app-providers.tsx +++ b/apps/shell/src/providers/app-providers.tsx @@ -1,6 +1,7 @@ 'use client'; import { PropsWithChildren } from 'react'; import { DehydratedState } from '@tanstack/react-query'; +import { TolgeeStaticData } from '@tolgee/web'; import { State, WagmiProvider, Config } from 'wagmi'; import { CosmosProvider, @@ -30,7 +31,7 @@ export function AppProviders({ dehydratedState?: DehydratedState; wagmiConfig?: Config; isMobileUA: boolean; - locales: Record; + locales: TolgeeStaticData; locale: string; }>) { const actualWagmiConfig = wagmiConfig diff --git a/apps/shell/src/tolgee/client.tsx b/apps/shell/src/tolgee/client.tsx index 843d656fd..e223b39c0 100644 --- a/apps/shell/src/tolgee/client.tsx +++ b/apps/shell/src/tolgee/client.tsx @@ -1,12 +1,12 @@ 'use client'; import { ReactNode, useEffect } from 'react'; -import { TolgeeProvider, useTolgeeSSR } from '@tolgee/react'; +import { TolgeeProvider, TolgeeStaticData, useTolgeeSSR } from '@tolgee/react'; import { useRouter } from 'next/navigation'; import { ALL_LOCALES, ALL_NAMESPACES, TolgeeBase } from './shared'; type Props = { - locales: any; + locales: TolgeeStaticData; locale: string; children: ReactNode; }; diff --git a/apps/shell/src/tolgee/shared.ts b/apps/shell/src/tolgee/shared.ts index 0c690b2a0..af64acc1e 100644 --- a/apps/shell/src/tolgee/shared.ts +++ b/apps/shell/src/tolgee/shared.ts @@ -1,4 +1,4 @@ -import { DevTools, Tolgee, FormatSimple } from '@tolgee/web'; +import { DevTools, Tolgee, FormatSimple, TolgeeStaticData } from '@tolgee/web'; export type Locale = 'en' | 'ar' | 'id' | 'tr'; export const ALL_LOCALES: Locale[] = ['en', 'ar', 'id', 'tr']; @@ -26,8 +26,11 @@ export const DEFAULT_LOCALE = 'en'; const apiKey = process.env.NEXT_PUBLIC_TOLGEE_API_KEY; const apiUrl = process.env.NEXT_PUBLIC_TOLGEE_API_URL; -export async function getStaticData(languages: Locale[]) { - const result: Record = {}; +export async function getStaticData( + languages: string[], +): Promise { + const result: TolgeeStaticData = {}; + for (const lang of languages) { for (const ns of ALL_NAMESPACES) { try { @@ -41,6 +44,7 @@ export async function getStaticData(languages: Locale[]) { } } } + return result; } From f1d6c4828aa254ec668b260f5e6e3644eb5cde87 Mon Sep 17 00:00:00 2001 From: Viktoryia Date: Thu, 31 Oct 2024 13:52:56 +0100 Subject: [PATCH 06/22] feat(authz): use tolgee keys (#974) * feat(tolgee-keys): revoke-button Signed-off-by: viktoriabakun * feat(tolgee-keys): granter-table Signed-off-by: viktoriabakun * feat(tolgee-keys): grantee-table and some corrections Signed-off-by: viktoriabakun * feat(tolgee-keys): grantee-card Signed-off-by: viktoriabakun * feat(tolgee-keys): authz-grants-actions Signed-off-by: viktoriabakun * feat(tolgee-keys): authz-page Signed-off-by: viktoriabakun * feat(tolgee-keys): select options Signed-off-by: viktoriabakun --------- Signed-off-by: viktoriabakun --- apps/shell/src/i18n/en.json | 43 +++++- libs/authz/src/lib/authz-grants-actions.tsx | 161 +++++++++++--------- libs/authz/src/lib/authz-page.tsx | 6 +- libs/authz/src/lib/grantee-card.tsx | 24 +-- libs/authz/src/lib/grantee-table.tsx | 10 +- libs/authz/src/lib/granter-table.tsx | 10 +- libs/authz/src/lib/revoke-button.tsx | 13 +- 7 files changed, 163 insertions(+), 104 deletions(-) diff --git a/apps/shell/src/i18n/en.json b/apps/shell/src/i18n/en.json index 58a18e3c3..cc7f26936 100644 --- a/apps/shell/src/i18n/en.json +++ b/apps/shell/src/i18n/en.json @@ -1,8 +1,46 @@ { - "authz": {}, + "authz": { + "revoke-button": "Revoke", + "revoke-loading": "Revoke in progress", + "revoke-success": "Revoke successful", + "access-you-granted": "Access you have granted", + "access-granted-to-you": "Access you have been granted", + "grantee": "Grantee", + "message": "Message", + "valid-thru": "Valid thru", + "selected-grantee": "Selected grantee", + "staked": "Staked", + "rewards": "Rewards", + "unbonding": "Unbonding", + "grant-access": "Grant access", + "grantee-address": "Grantee address", + "grant-type": "Grant type", + "grant-period": "Grant period", + "memo": "Memo", + "add-your-memo": "Add your memo", + "grant-access-button": "Grant Access", + "invalid-grantee-wallet-message": "You should enter valid grantee wallet to see info", + "submit-proposal": "Submit proposal", + "vote": "Vote", + "one-week": "1 week", + "one-month": "1 month", + "three-months": "3 months", + "six-months": "6 months", + "one-year": "1 year", + "five-years": "5 years", + "hundred-years": "100 years" + }, "common": { + "address-label": "Address", "copied": "Copied!", - "click-to-copy": "Click to copy" + "click-to-copy": "Click to copy", + "connect-wallet-message": "You should connect wallet first", + "connect-wallet-button": "Connect wallet", + "governance": "Governance", + "staking": "Staking", + "delegate": "Delegate", + "undelegate": "Undelegate", + "redelegate": "Redelegate" }, "governance": {}, "main": {}, @@ -11,7 +49,6 @@ "utils": { "invalid-address": "Please enter a valid address", "address-conversion-title": "Address Conversion", - "address-label": "Address", "converted-address-label": "Converted address", "balance-label": "Balance" } diff --git a/libs/authz/src/lib/authz-grants-actions.tsx b/libs/authz/src/lib/authz-grants-actions.tsx index 3f2a716c0..bb3042385 100644 --- a/libs/authz/src/lib/authz-grants-actions.tsx +++ b/libs/authz/src/lib/authz-grants-actions.tsx @@ -1,5 +1,6 @@ 'use client'; import { useCallback, useEffect, useState } from 'react'; +import { useTranslate } from '@tolgee/react'; import clsx from 'clsx'; import Link from 'next/link'; import { isAddress } from 'viem'; @@ -35,75 +36,77 @@ export const enum GRANT_TYPES { Undelegate = '/cosmos.staking.v1beta1.MsgUndelegate', } -const GRANT_TYPE_OPTIONS = [ - { - label: 'Governance', - options: [ - { - label: 'Submit Proposal', - value: GRANT_TYPES.SubmitProposal, - }, - { - label: 'Vote', - value: GRANT_TYPES.Vote, - }, - ], - }, - { - label: 'Staking', - options: [ - { - label: 'Delegate', - value: GRANT_TYPES.Delegate, - }, - { - label: 'Undelegate', - value: GRANT_TYPES.Undelegate, - }, - { - label: 'Redelegate', - value: GRANT_TYPES.Redelegate, - }, - ], - }, -]; +export function AuthzGrantsActions() { + const { t } = useTranslate(); -export const GRANT_TYPE_DEFAULT_OPTION = GRANT_TYPE_OPTIONS[0].options[0]; + const GRANT_TYPE_OPTIONS = [ + { + label: t('governance', 'Governance', { ns: 'common' }), + options: [ + { + label: t('submit-proposal', 'Submit Proposal', { ns: 'authz' }), + value: GRANT_TYPES.SubmitProposal, + }, + { + label: t('vote', 'Vote', { ns: 'authz' }), + value: GRANT_TYPES.Vote, + }, + ], + }, + { + label: t('staking', 'Staking', { ns: 'common' }), + options: [ + { + label: t('delegate', 'Delegate', { ns: 'common' }), + value: GRANT_TYPES.Delegate, + }, + { + label: t('undelegate', 'Undelegate', { ns: 'common' }), + value: GRANT_TYPES.Undelegate, + }, + { + label: t('redelegate', 'Redelegate', { ns: 'common' }), + value: GRANT_TYPES.Redelegate, + }, + ], + }, + ]; -export const GRANT_PERIOD_OPTIONS = [ - { - label: '1 Week', - value: '1w', - }, - { - label: '1 Month', - value: '1m', - }, - { - label: '3 Months', - value: '3m', - }, - { - label: '6 Months', - value: '6m', - }, - { - label: '1 Year', - value: '1y', - }, - { - label: '5 Years', - value: '5y', - }, - { - label: '100 Years', - value: '100y', - }, -]; + const GRANT_TYPE_DEFAULT_OPTION = GRANT_TYPE_OPTIONS[0].options[0]; -export const GRANT_PERIOD_DEFAULT_OPTION = GRANT_PERIOD_OPTIONS[4]; + const GRANT_PERIOD_OPTIONS = [ + { + label: t('one-week', '1 Week', { ns: 'auth' }), + value: '1w', + }, + { + label: t('one-month', '1 Month', { ns: 'auth' }), + value: '1m', + }, + { + label: t('three-months', '3 Months', { ns: 'auth' }), + value: '3m', + }, + { + label: t('six-months', '6 Months', { ns: 'auth' }), + value: '6m', + }, + { + label: t('one-year', '1 Year', { ns: 'auth' }), + value: '1y', + }, + { + label: t('five-years', '5 Years', { ns: 'auth' }), + value: '5y', + }, + { + label: t('hundred-years', '100 Years', { ns: 'auth' }), + value: '100y', + }, + ]; + + const GRANT_PERIOD_DEFAULT_OPTION = GRANT_PERIOD_OPTIONS[4]; -export function AuthzGrantsActions() { const [grantee, setGrantee] = useState(''); const [isGranteeValid, setGranteeValid] = useState(false); const [granteeAddresses, setGranteeAddresses] = useState<{ @@ -194,7 +197,9 @@ export function AuthzGrantsActions() { }); await toast.promise(grantPromise, { - loading: Grant in progress, + loading: ( + {t('grant-loading', 'Grant in progress')} + ), success: (tx) => { console.log('Grant successful', { tx }); const txHash = tx?.txhash; @@ -202,7 +207,7 @@ export function AuthzGrantsActions() { return (
-
Grant successful
+
{t('grant-success', 'Grant successful')}
- Grant access + {t('grant-access', 'Grant access')}
@@ -317,7 +323,7 @@ export function AuthzGrantsActions() { htmlFor="grantee" className="cursor-pointer text-[12px] font-[500] uppercase leading-[24px] text-white/50" > - Grantee address + {t('grantee-address', 'Grantee address')}
@@ -344,7 +350,7 @@ export function AuthzGrantsActions() {
{ if (period) { @@ -376,7 +382,7 @@ export function AuthzGrantsActions() { htmlFor="memo" className="cursor-pointer text-[12px] font-[500] uppercase leading-[24px] text-white/50" > - Memo + {t('memo', 'Memo')}
@@ -389,7 +395,7 @@ export function AuthzGrantsActions() { 'max-w-xl', )} type="text" - placeholder="Add your memo" + placeholder={t('add-your-memo', 'Add your memo')} id="memo" name="memo" value={memo} @@ -408,7 +414,7 @@ export function AuthzGrantsActions() { variant={2} disabled={!isGranteeValid} > - Grant Access + {t('grant-access', 'Grant access')}
@@ -428,14 +434,17 @@ export function AuthzGrantsActions() {
- Selected grantee + {t('selected-grantee', 'Selected grantee')}
- You should enter valid grantee wallet to see info + {t( + 'invalid-grantee-wallet-message', + 'You should enter valid grantee wallet to see info', + )}
diff --git a/libs/authz/src/lib/authz-page.tsx b/libs/authz/src/lib/authz-page.tsx index c140c7ccb..19fab975b 100644 --- a/libs/authz/src/lib/authz-page.tsx +++ b/libs/authz/src/lib/authz-page.tsx @@ -1,4 +1,5 @@ 'use client'; +import { useTranslate } from '@tolgee/react'; import clsx from 'clsx'; import { useAddress, useWallet } from '@haqq/shell-shared'; import { Button } from '@haqq/shell-ui-kit'; @@ -10,6 +11,7 @@ import { GranterGrantsTable } from './granter-table'; export function AuthzPage() { const { ethAddress } = useAddress(); const { openSelectWallet, isHaqqWallet } = useWallet(); + const { t } = useTranslate('common'); return (
@@ -32,10 +34,10 @@ export function AuthzPage() { )} >
- You should connect wallet first + {t('connect-wallet-message', 'You should connect wallet first')}
) : ( diff --git a/libs/authz/src/lib/grantee-card.tsx b/libs/authz/src/lib/grantee-card.tsx index a38f4ca5a..d3d819919 100644 --- a/libs/authz/src/lib/grantee-card.tsx +++ b/libs/authz/src/lib/grantee-card.tsx @@ -6,6 +6,7 @@ import { useMemo, useState, } from 'react'; +import { useTranslate } from '@tolgee/react'; import clsx from 'clsx'; import { formatUnits, parseUnits } from 'viem'; import { @@ -72,6 +73,7 @@ export function GranteeCard({ haqq: string; }; }) { + const { t } = useTranslate(); const [isEthAddressCopy, setEthAddressCopy] = useState(false); const [isHaqqAddressCopy, setHaqqAddressCopy] = useState(false); const { copyText } = useClipboard(); @@ -152,22 +154,22 @@ export function GranteeCard({
- Selected grantee + {t('selected-grantee', 'Selected grantee', { ns: 'authz' })}
@@ -226,7 +226,7 @@ export function GranteeCard({
diff --git a/libs/authz/src/lib/grantee-table.tsx b/libs/authz/src/lib/grantee-table.tsx index c1ceec8c8..8fd61dbc5 100644 --- a/libs/authz/src/lib/grantee-table.tsx +++ b/libs/authz/src/lib/grantee-table.tsx @@ -1,9 +1,11 @@ import { useMemo } from 'react'; +import { useTranslate } from '@tolgee/react'; import { useAddress, useAuthzGranteeGrants } from '@haqq/shell-shared'; import { Container, Heading } from '@haqq/shell-ui-kit/server'; import { mapRPCGrantToWebGrant } from './utils/map-rpc-grant-to-web-grant'; export function GranteeGrantsTable() { + const { t } = useTranslate('authz'); const { haqqAddress } = useAddress(); const { data: granteeGrants } = useAuthzGranteeGrants(haqqAddress ?? ''); @@ -25,7 +27,7 @@ export function GranteeGrantsTable() {
- Access you have been granted + {t('access-granted-to-you', 'Access you have been granted')}
@@ -33,13 +35,13 @@ export function GranteeGrantsTable() { - Granter + {t('granter', 'Granter')} - Message + {t('message', 'Message')} {/* - Valid tru + {t('valid-thru', 'Valid thru')} */} diff --git a/libs/authz/src/lib/granter-table.tsx b/libs/authz/src/lib/granter-table.tsx index 049c3272e..078fdf4c2 100644 --- a/libs/authz/src/lib/granter-table.tsx +++ b/libs/authz/src/lib/granter-table.tsx @@ -1,4 +1,5 @@ import { useMemo } from 'react'; +import { useTranslate } from '@tolgee/react'; import dynamic from 'next/dynamic'; import { useAddress, useAuthzGranterGrants } from '@haqq/shell-shared'; import { Container, Heading, formatDate } from '@haqq/shell-ui-kit/server'; @@ -17,6 +18,7 @@ const RevokeButton = dynamic( ); export function GranterGrantsTable() { + const { t } = useTranslate('authz'); const { haqqAddress } = useAddress(); const { data: granterGrants } = useAuthzGranterGrants(haqqAddress ?? ''); @@ -38,7 +40,7 @@ export function GranterGrantsTable() {
- Access you have granted + {t('access-you-granted', 'Access you have granted')}
@@ -46,13 +48,13 @@ export function GranterGrantsTable() { - Grantee + {t('grantee', 'Grantee')} - Message + {t('message', 'Message')} - Valid thru + {t('valid-thru', 'Valid thru')}   diff --git a/libs/authz/src/lib/revoke-button.tsx b/libs/authz/src/lib/revoke-button.tsx index 59a10f553..1ba2b8d06 100644 --- a/libs/authz/src/lib/revoke-button.tsx +++ b/libs/authz/src/lib/revoke-button.tsx @@ -1,5 +1,6 @@ 'use client'; import { useCallback } from 'react'; +import { useTranslate } from '@tolgee/react'; import Link from 'next/link'; import { useAccount, useChains } from 'wagmi'; import { haqqMainnet } from 'wagmi/chains'; @@ -27,6 +28,7 @@ export function RevokeButton({ grantee: string; msg: string; }) { + const { t } = useTranslate('authz'); const invalidateQueries = useQueryInvalidate(); const { revoke, getRevokeEstimatedFee } = useAuthzActions(); const toast = useToast(); @@ -48,7 +50,11 @@ export function RevokeButton({ ); await toast.promise(revokePromise, { - loading: Revoke in progress, + loading: ( + + {t('revoke-loading', 'Revoke in progress')} + + ), success: (tx) => { console.log('Revoke successful', { tx }); const txHash = tx?.txhash; @@ -56,7 +62,7 @@ export function RevokeButton({ return (
-
Revoke successful
+
{t('revoke-success', 'Revoke successful')}
- Revoke + {t('revoke-button', 'Revoke')} ); } From 363d671f9230e6420b150a204e5b392c80084625 Mon Sep 17 00:00:00 2001 From: Viktoryia Date: Mon, 4 Nov 2024 12:18:12 +0100 Subject: [PATCH 07/22] feat(shell): setup tolgee-cli (#973) * feat: setup namespaces Signed-off-by: viktoriabakun * feat: leave single translation file by lang with namespaces as keys in it Signed-off-by: viktoriabakun * feat(utils): use tolgee keys Signed-off-by: viktoriabakun * feat(utils): remove empty vals from json files Signed-off-by: viktoriabakun * chore: get rid of `any` in localisation components * feat(authz): use tolgee keys (#974) * feat(tolgee-keys): revoke-button Signed-off-by: viktoriabakun * feat(tolgee-keys): granter-table Signed-off-by: viktoriabakun * feat(tolgee-keys): grantee-table and some corrections Signed-off-by: viktoriabakun * feat(tolgee-keys): grantee-card Signed-off-by: viktoriabakun * feat(tolgee-keys): authz-grants-actions Signed-off-by: viktoriabakun * feat(tolgee-keys): authz-page Signed-off-by: viktoriabakun * feat(tolgee-keys): select options Signed-off-by: viktoriabakun --------- Signed-off-by: viktoriabakun * feat: setup tolgee-cli Signed-off-by: viktoriabakun * chore: move tolgee config to apps, add tolgee scripts Signed-off-by: viktoriabakun * chore: add @tolgee/cli to devDep Signed-off-by: viktoriabakun * chore: pnpm lock Signed-off-by: viktoriabakun --------- Signed-off-by: viktoriabakun Co-authored-by: Oleg Shilov --- apps/shell/.tolgeerc.js | 32 ++++++++++++++++++++++++++++++++ package.json | 8 +++++++- 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 apps/shell/.tolgeerc.js diff --git a/apps/shell/.tolgeerc.js b/apps/shell/.tolgeerc.js new file mode 100644 index 000000000..f9ef0ff08 --- /dev/null +++ b/apps/shell/.tolgeerc.js @@ -0,0 +1,32 @@ +module.exports = { + $schema: 'https://tolgee.io/cli-schema.json', + projectId: 10781, + format: 'JSON_TOLGEE', + patterns: ['../../libs/**/*.ts?(x)'], + defaultNamespace: 'common', + push: { + files: [ + { + path: './src/i18n/en.json', + language: 'en', + }, + { + path: './src/i18n/ar.json', + language: 'ar', + }, + { + path: './src/i18n/id.json', + language: 'id', + }, + { + path: './src/i18n/tr.json', + language: 'tr', + }, + ], + forceMode: 'OVERRIDE', + }, + pull: { + path: './src/i18n', + }, + apiKey: process.env.NEXT_PUBLIC_TOLGEE_API_KEY, +}; diff --git a/package.json b/package.json index a7d5395d9..09cb114e7 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,12 @@ "lint": "pnpm exec nx run-many --target lint --verbose", "test": "pnpm exec nx run-many --target test --verbose", "format": "pnpm exec prettier --write '**/*.{ts,js,tsx,jsx,cjs,mjs,css,json,md,mdx,html,yaml,yml}'", - "prepare": "pnpm exec husky" + "prepare": "pnpm exec husky", + "tolgee": "pnpm exec tolgee --config ./apps/shell/.tolgeerc.js", + "tolgee:pull": "pnpm exec tolgee pull --config ./apps/shell/.tolgeerc.js", + "tolgee:push": "pnpm exec tolgee push --config ./apps/shell/.tolgeerc.js", + "tolgee:extract:check": "pnpm exec tolgee extract check --config ./apps/shell/.tolgeerc.js", + "tolgee:compare": "pnpm exec tolgee compare --config ./apps/shell/.tolgeerc.js" }, "dependencies": { "@auth0/auth0-react": "2.2.4", @@ -113,6 +118,7 @@ "@testing-library/jest-dom": "6.6.3", "@testing-library/react": "16.0.1", "@testing-library/user-event": "14.5.2", + "@tolgee/cli": "2.3.1", "@types/cookie": "0.6.0", "@types/elliptic": "6.4.18", "@types/jest": "29.5.14", From 47ec71c2a49280943a3f4662ecda5a9a6b1123c2 Mon Sep 17 00:00:00 2001 From: Viktoryia Date: Mon, 4 Nov 2024 12:28:48 +0100 Subject: [PATCH 08/22] feat(tolgee-keys): main (#977) * feat: setup namespaces Signed-off-by: viktoriabakun * feat: leave single translation file by lang with namespaces as keys in it Signed-off-by: viktoriabakun * feat(utils): use tolgee keys Signed-off-by: viktoriabakun * feat(utils): remove empty vals from json files Signed-off-by: viktoriabakun * chore: get rid of `any` in localisation components * feat(authz): use tolgee keys (#974) * feat(tolgee-keys): revoke-button Signed-off-by: viktoriabakun * feat(tolgee-keys): granter-table Signed-off-by: viktoriabakun * feat(tolgee-keys): grantee-table and some corrections Signed-off-by: viktoriabakun * feat(tolgee-keys): grantee-card Signed-off-by: viktoriabakun * feat(tolgee-keys): authz-grants-actions Signed-off-by: viktoriabakun * feat(tolgee-keys): authz-page Signed-off-by: viktoriabakun * feat(tolgee-keys): select options Signed-off-by: viktoriabakun --------- Signed-off-by: viktoriabakun * feat(tolgee-keys): main Signed-off-by: viktoriabakun * feat(tolgee-keys): do not translate errors Signed-off-by: viktoriabakun --------- Signed-off-by: viktoriabakun Co-authored-by: Oleg Shilov --- .../lib/components/account-footer-mobile.tsx | 4 +- .../src/lib/components/delegation-list.tsx | 49 +++++++++++++++---- .../src/lib/components/delegations-block.tsx | 11 +++-- .../src/lib/components/my-account-block.tsx | 44 ++++++++++------- .../lib/components/proposal-list-block.tsx | 8 +-- .../src/lib/components/statistics-block.tsx | 14 ++++-- libs/main/src/lib/main-page.tsx | 4 +- 7 files changed, 95 insertions(+), 39 deletions(-) diff --git a/libs/main/src/lib/components/account-footer-mobile.tsx b/libs/main/src/lib/components/account-footer-mobile.tsx index a73abe88b..f66a57861 100644 --- a/libs/main/src/lib/components/account-footer-mobile.tsx +++ b/libs/main/src/lib/components/account-footer-mobile.tsx @@ -1,3 +1,4 @@ +import { useTranslate } from '@tolgee/react'; import { useAccount } from 'wagmi'; import { getFormattedAddress, @@ -9,6 +10,7 @@ import { Button, AccountButton } from '@haqq/shell-ui-kit'; import { Container, LogoutIcon } from '@haqq/shell-ui-kit/server'; export function AccountFooterMobile() { + const { t } = useTranslate('common'); const { isConnected } = useAccount(); const { disconnect, openSelectWallet } = useWallet(); const { haqqAddress, ethAddress } = useAddress(); @@ -39,7 +41,7 @@ export function AccountFooterMobile() { ) : (
)} diff --git a/libs/main/src/lib/components/delegation-list.tsx b/libs/main/src/lib/components/delegation-list.tsx index 1b2483016..298c65276 100644 --- a/libs/main/src/lib/components/delegation-list.tsx +++ b/libs/main/src/lib/components/delegation-list.tsx @@ -4,6 +4,7 @@ import { Validator, DistributionRewardsResponse, } from '@evmos/provider'; +import { useTranslate } from '@tolgee/react'; import { bondStatusFromJSON } from 'cosmjs-types/cosmos/staking/v1beta1/staking'; import Link from 'next/link'; import { formatUnits } from 'viem'; @@ -131,6 +132,7 @@ function mapAndSortValidators( } export function ShellIndexPageDelegationList() { + const { t } = useTranslate(); const { haqqAddress } = useAddress(); const { data: validatorsList, @@ -156,7 +158,11 @@ export function ShellIndexPageDelegationList() { if (!haqqAddress) { return ( -
You should connect wallet first
+
+ {t('connect-wallet-message', 'You should connect wallet first', { + ns: 'common', + })} +
); } @@ -167,22 +173,39 @@ export function ShellIndexPageDelegationList() {
-
Name
+
+ {t('name', 'Name', { ns: 'main' })} +
+
+
+ {t('status', 'Status', { ns: 'main' })} +
+
+ {t('fee', 'Fee', { ns: 'main' })} +
+
+ {t('voting-power', 'Voting power', { ns: 'main' })} +
+
+ {t('staked', 'Staked', { ns: 'main' })} +
+
+ {t('rewards', 'Rewards', { ns: 'main' })}
-
Status
-
Fee
-
Voting power
-
Staked
-
Rewards
{status === 'pending' && (
-
Fetching validators list
+
+ {t('fetching-validators', 'Fetching validators list', { + ns: 'main', + })} +
)} + {/* eslint-disable-next-line i18next/no-literal-string */} {status === 'error' &&

Error: {(error as Error).message}

} {status === 'success' && (
@@ -198,7 +221,15 @@ export function ShellIndexPageDelegationList() { }) ) : (
- You don't have active delegations + + {t( + 'no-delegations', + "You don't have any active delegations", + { + ns: 'main', + }, + )} +
)}
diff --git a/libs/main/src/lib/components/delegations-block.tsx b/libs/main/src/lib/components/delegations-block.tsx index f832e2d4e..29dea08c5 100644 --- a/libs/main/src/lib/components/delegations-block.tsx +++ b/libs/main/src/lib/components/delegations-block.tsx @@ -1,5 +1,6 @@ 'use client'; import { useCallback } from 'react'; +import { useTranslate } from '@tolgee/react'; import Link from 'next/link'; import { useRouter } from 'next/navigation'; import { useMediaQuery } from 'usehooks-ts'; @@ -23,6 +24,7 @@ export function DelegationsBlock({ isMobileUserAgent: boolean; seedPhrase: string; }) { + const { t } = useTranslate('main'); const { totalStaked, status, @@ -57,7 +59,7 @@ export function DelegationsBlock({
- My delegations + {t('my-delegations', 'My delegations')}
@@ -74,6 +76,7 @@ export function DelegationsBlock({ )}
*/} + {/* eslint-disable-next-line i18next/no-literal-string */} {status === 'error' &&

Error: {(error as Error).message}

} {status === 'success' && ( @@ -121,10 +124,12 @@ export function DelegationsBlock({ ) : (
- You don't have any active delegations + {t('no-delegations', "You don't have any active delegations")}
- Go to Staking + + {t('link-to-stacking', 'Go to Staking')} +
)} diff --git a/libs/main/src/lib/components/my-account-block.tsx b/libs/main/src/lib/components/my-account-block.tsx index c0282b3ae..715c2322f 100644 --- a/libs/main/src/lib/components/my-account-block.tsx +++ b/libs/main/src/lib/components/my-account-block.tsx @@ -1,4 +1,5 @@ import { ReactNode, useCallback, useMemo, useState } from 'react'; +import { useTranslate } from '@tolgee/react'; import clsx from 'clsx'; import Link from 'next/link'; import { useMediaQuery } from 'usehooks-ts'; @@ -73,20 +74,21 @@ function MyAccountAmountBlock({ } export function MyAccountBlock() { + const { t } = useTranslate('common'); const { ethAddress, haqqAddress } = useAddress(); const { openSelectWallet } = useWallet(); return !ethAddress || !haqqAddress ? (
- You should connect wallet first + {t('connect-wallet-message', 'You should connect wallet first')}
) : ( @@ -101,6 +103,7 @@ function MyAccountConnected({ ethAddress: Hex; haqqAddress: string; }) { + const { t } = useTranslate(); const [isEthAddressCopy, setEthAddressCopy] = useState(false); const [isHaqqAddressCopy, setHaqqAddressCopy] = useState(false); const { copyText } = useClipboard(); @@ -160,6 +163,8 @@ function MyAccountConnected({ handleMouseLeave: handleMouseLeaveLiquidStaking, } = useHoverPopover(100); + const lockedTokensDescription = t('about-locked-tokens', 'Locked tokens are your tokens but you cannot transfer to other users or use them to pay for gas, but you can delegate to validators - stake to improve the reliability of the HAQQ network, and make a profit. Locked tokens are unlocked according to the schedule.', { ns: 'main'}) + if (!balances) { return null; } @@ -170,11 +175,11 @@ function MyAccountConnected({
- My account + {t('my-account', 'My account', { ns: 'main' })} - Go to Staking + {t('link-to-staking', 'Go to Staking', { ns: 'main' })}
@@ -182,7 +187,7 @@ function MyAccountConnected({
- Balance + {t('balance', 'Balance', { ns: 'common' })}
@@ -191,12 +196,14 @@ function MyAccountConnected({
{isTablet ? ( } /> @@ -215,7 +222,10 @@ function MyAccountConnected({ )} > - Available for staking:{' '} + {t('available-stacking', 'Available for staking', { + ns: 'main', + })} + {': '} {formatNumber(balances.availableForStake)} @@ -225,7 +235,7 @@ function MyAccountConnected({ @@ -288,28 +298,28 @@ function MyAccountConnected({
- Latest proposals + {t('latest-proposals', 'Latest proposals')} - Go to Governance + {t('link-to-governance', 'Go to Governance')}
@@ -89,7 +91,7 @@ export function ProposalListBlock() {
- Fetching proposals + {t('fetching-proposals', 'Fetching proposals')}
) : ( diff --git a/libs/main/src/lib/components/statistics-block.tsx b/libs/main/src/lib/components/statistics-block.tsx index 598c55450..3145aa53a 100644 --- a/libs/main/src/lib/components/statistics-block.tsx +++ b/libs/main/src/lib/components/statistics-block.tsx @@ -1,8 +1,10 @@ import { useMemo } from 'react'; +import { useTranslate } from '@tolgee/react'; import { useChainStatsQuery } from '@haqq/shell-shared'; import { formatNumber, formatPercents } from '@haqq/shell-ui-kit/server'; export function StatisticsBlock() { + const { t } = useTranslate('main'); const { data: chainStats, isFetching, isFetched } = useChainStatsQuery(); const { @@ -38,7 +40,7 @@ export function StatisticsBlock() {
- Total supply + {t('total-supply', 'Total supply')}
{!isFetching && ( @@ -51,7 +53,7 @@ export function StatisticsBlock() {
- Total staked ({formatPercents(stakeRatio)}%) + {t('total-stacked', 'Total staked')} ({formatPercents(stakeRatio)}%)
{!isFetching && ( @@ -64,7 +66,7 @@ export function StatisticsBlock() {
- Accounts + {t('accounts', 'Accounts')}
{!isFetching &&
{totalAccounts}
} @@ -72,13 +74,15 @@ export function StatisticsBlock() {
- Active validators + {t('active-validators', 'Active validators')}
{!isFetching && (
{valsActive} -  out of {valsTotal} + +  {t('out of', 'out of')} {valsTotal} +
)}
diff --git a/libs/main/src/lib/main-page.tsx b/libs/main/src/lib/main-page.tsx index 8193ba6b2..b76620a5d 100644 --- a/libs/main/src/lib/main-page.tsx +++ b/libs/main/src/lib/main-page.tsx @@ -1,4 +1,5 @@ 'use client'; +import { useTranslate } from '@tolgee/react'; import { useMediaQuery } from 'usehooks-ts'; import { useWallet } from '@haqq/shell-shared'; import { Container } from '@haqq/shell-ui-kit/server'; @@ -30,6 +31,7 @@ export function MainPage({ isMobileUserAgent: boolean; seedPhrase: string; }) { + const { t } = useTranslate('main'); const { isHaqqWallet } = useWallet(); const isTablet = useMediaQuery('(max-width: 1023px)'); @@ -40,7 +42,7 @@ export function MainPage({
{!isHaqqWallet && (
- Shell + {t('shell-title', 'Shell')}
)} From 9938b5a762818b399edbe97bbb023c501a3e498b Mon Sep 17 00:00:00 2001 From: Viktoryia Date: Mon, 4 Nov 2024 12:45:19 +0100 Subject: [PATCH 09/22] feat(staking): use tolgee keys (#976) * feat: setup namespaces Signed-off-by: viktoriabakun * feat: leave single translation file by lang with namespaces as keys in it Signed-off-by: viktoriabakun * feat(utils): use tolgee keys Signed-off-by: viktoriabakun * feat(utils): remove empty vals from json files Signed-off-by: viktoriabakun * chore: get rid of `any` in localisation components * feat(authz): use tolgee keys (#974) * feat(tolgee-keys): revoke-button Signed-off-by: viktoriabakun * feat(tolgee-keys): granter-table Signed-off-by: viktoriabakun * feat(tolgee-keys): grantee-table and some corrections Signed-off-by: viktoriabakun * feat(tolgee-keys): grantee-card Signed-off-by: viktoriabakun * feat(tolgee-keys): authz-grants-actions Signed-off-by: viktoriabakun * feat(tolgee-keys): authz-page Signed-off-by: viktoriabakun * feat(tolgee-keys): select options Signed-off-by: viktoriabakun --------- Signed-off-by: viktoriabakun * feat(tolgee-keys): stacking/stride, stacking validator page Signed-off-by: viktoriabakun * feat(tolgee-keys): finish stacking Signed-off-by: viktoriabakun * fix(tolgee-keys): plurals Signed-off-by: viktoriabakun --------- Signed-off-by: viktoriabakun Co-authored-by: Oleg Shilov --- apps/shell/src/i18n/en.json | 5 +- apps/shell/src/tolgee/shared.ts | 2 + .../lib/components/delegate-modal-hooked.tsx | 14 +++- .../src/lib/components/delegate-modal.tsx | 40 +++++++--- .../components/redelegate-modal-hooked.tsx | 13 +++- .../src/lib/components/redelegate-modal.tsx | 16 ++-- .../src/lib/components/staking-info.tsx | 7 +- .../src/lib/components/staking-stats.tsx | 27 ++++--- .../liquid-staking-delegate-modal-hooked.tsx | 17 +++- .../stride/liquid-staking-delegate-modal.tsx | 40 +++++++--- ...liquid-staking-undelegate-modal-hooked.tsx | 21 ++++- .../liquid-staking-undelegate-modal.tsx | 22 ++++-- .../stride/statistics/stride-stats.tsx | 27 ++++--- .../components/undelegate-modal-hooked.tsx | 16 +++- .../src/lib/components/undelegate-modal.tsx | 32 +++++--- .../lib/components/validator-block-mobile.tsx | 28 ++++--- .../src/lib/components/validator-info.tsx | 78 ++++++++++++------- .../lib/components/validator-list-desktop.tsx | 16 ++-- .../components/validator-list-item-mobile.tsx | 24 ++++-- .../lib/components/validator-list-mobile.tsx | 4 +- .../src/lib/components/validator-list.tsx | 27 ++++--- .../src/lib/components/validator-select.tsx | 4 +- .../src/lib/validator-details-page.tsx | 6 +- libs/staking/src/lib/validator-list-page.tsx | 4 +- package.json | 1 + 25 files changed, 332 insertions(+), 159 deletions(-) diff --git a/apps/shell/src/i18n/en.json b/apps/shell/src/i18n/en.json index cc7f26936..3d4ae4773 100644 --- a/apps/shell/src/i18n/en.json +++ b/apps/shell/src/i18n/en.json @@ -44,7 +44,10 @@ }, "governance": {}, "main": {}, - "stacking": {}, + "stacking": { + "attention-withdrawal-warning": "Attention! If in the future you want to withdraw the staked funds, it will take {{count}} day{count, plural, one {} other {s}}", + "funds-undelegated-in-days": "The funds will be undelegated within {count, plural, one {# day} other {# days}}" + }, "uc-dao": {}, "utils": { "invalid-address": "Please enter a valid address", diff --git a/apps/shell/src/tolgee/shared.ts b/apps/shell/src/tolgee/shared.ts index af64acc1e..fbaf89ba0 100644 --- a/apps/shell/src/tolgee/shared.ts +++ b/apps/shell/src/tolgee/shared.ts @@ -1,3 +1,4 @@ +import { FormatIcu } from '@tolgee/format-icu'; import { DevTools, Tolgee, FormatSimple, TolgeeStaticData } from '@tolgee/web'; export type Locale = 'en' | 'ar' | 'id' | 'tr'; @@ -53,6 +54,7 @@ export function TolgeeBase() { Tolgee() .use(FormatSimple()) .use(DevTools()) + .use(FormatIcu()) // Preset shared settings .updateDefaults({ apiKey, diff --git a/libs/staking/src/lib/components/delegate-modal-hooked.tsx b/libs/staking/src/lib/components/delegate-modal-hooked.tsx index bf31b382e..b111e568f 100644 --- a/libs/staking/src/lib/components/delegate-modal-hooked.tsx +++ b/libs/staking/src/lib/components/delegate-modal-hooked.tsx @@ -1,5 +1,6 @@ 'use client'; import { useCallback, useEffect, useRef, useState } from 'react'; +import { useTranslate } from '@tolgee/react'; import Link from 'next/link'; import { usePostHog } from 'posthog-js/react'; import { useDebounceValue } from 'usehooks-ts'; @@ -46,8 +47,8 @@ export function DelegateModalHooked({ unboundingTime, validatorCommission, }: DelegateModalProps) { - const { delegate, getDelegateEstimatedFee, approveStaking } = - useStakingActions(); + const { t } = useTranslate('staking'); + const { delegate, getDelegateEstimatedFee, approveStaking } = useStakingActions(); const [delegateAmount, setDelegateAmount] = useState( undefined, ); @@ -100,7 +101,11 @@ export function DelegateModalHooked({ await toast.promise( delegationPromise, { - loading: Delegation in progress, + loading: ( + + {t('delegation-progress', 'Delegation in progress')} + + ), success: (tx) => { console.log('Delegation successful', { tx }); const txHash = tx?.txhash; @@ -119,7 +124,7 @@ export function DelegateModalHooked({ return (
-
Delegation successful
+
{t('delegation-success', 'Delegation successful')}
{ if (amountError === 'min') { - return Bellow minimal value; + return ( + + {t('amount-error-min', 'Bellow minimal value')} + + ); } else if (amountError === 'max') { - return More than you have; + return ( + + {t('amount-error-more-than-have', 'More than you have')} + + ); } return undefined; - }, [amountError]); + }, [amountError, t]); const delegateAmountNumber = useMemo(() => { if (delegateAmount) { @@ -197,25 +207,31 @@ export function DelegateModal({
- Delegate + {t('delegate', 'Delegate')} - {`Attention! If in the future you want to withdraw the staked funds, it will take ${unboundingTime} ${unboundingTime === 1 ? 'day' : 'days'}`} + {t( + 'attention-withdrawal-warning', + 'Attention! If in the future you want to withdraw the staked funds, it will take {count} day{count, plural, one {} other {s}}', + { + count: unboundingTime, + }, + )}
@@ -241,7 +257,7 @@ export function DelegateModal({ setMemoVisible(true); }} > - Add memo + {t('add-memo', 'Add memo')}
) : ( @@ -259,14 +275,14 @@ export function DelegateModal({ 'px-[16px] py-[12px] text-[14px] font-[500] leading-[22px]', 'bg-[#E7E7E7]', )} - placeholder="Add your memo" + placeholder={t('memo-placeholder', 'Add your memo')} />
)}
@@ -294,7 +310,7 @@ export function DelegateModal({ className="w-full" disabled={isDisabled} > - Delegate + {t('delegate', 'Delegate')}
diff --git a/libs/staking/src/lib/components/redelegate-modal-hooked.tsx b/libs/staking/src/lib/components/redelegate-modal-hooked.tsx index a967bf8ec..4f8fad336 100644 --- a/libs/staking/src/lib/components/redelegate-modal-hooked.tsx +++ b/libs/staking/src/lib/components/redelegate-modal-hooked.tsx @@ -1,6 +1,7 @@ 'use client'; import { useCallback, useEffect, useMemo, useRef, useState } from 'react'; import { Validator } from '@evmos/provider'; +import { useTranslate } from '@tolgee/react'; import Link from 'next/link'; import { usePostHog } from 'posthog-js/react'; import { useDebounceValue } from 'usehooks-ts'; @@ -47,6 +48,7 @@ export function RedelegateModalHooked({ validatorsList, balance, }: RedelegateModalProps) { + const { t } = useTranslate('stacking'); const { haqqAddress, ethAddress } = useAddress(); const { data: redelegationValidatorAmount } = useRedelegationValidatorAmount( haqqAddress, @@ -122,7 +124,11 @@ export function RedelegateModalHooked({ await toast.promise( redelegationPromise, { - loading: Redelegate in progress, + loading: ( + + {t('redelegate-progress', 'Redelegate in progress')} + + ), success: (tx) => { console.log('Redelegation successful', { tx }); const txHash = tx?.txhash; @@ -141,7 +147,9 @@ export function RedelegateModalHooked({ return (
-
Redelegation successful
+
+ {t('redelegate-success', 'Redelegation successful')} +
- Redelegate + {t('redelegate', 'Redelegate')}
@@ -175,7 +177,7 @@ export function RedelegateModal({
@@ -209,7 +211,7 @@ export function RedelegateModal({ setMemoVisible(true); }} > - Add memo + {t('add-memo', 'Add memo')}
) : ( @@ -227,14 +229,14 @@ export function RedelegateModal({ 'px-[16px] py-[12px] text-[14px] font-[500] leading-[22px]', 'bg-[#E7E7E7]', )} - placeholder="Add your memo" + placeholder={t('memo-placeholder', 'Add your memo')} />
)}
@@ -264,7 +266,7 @@ export function RedelegateModal({ className="w-full" disabled={isDisabled} > - Confirm redelegation + {t('confirm-redelegation', 'Confirm redelegation')}
diff --git a/libs/staking/src/lib/components/staking-info.tsx b/libs/staking/src/lib/components/staking-info.tsx index 5aa43c18f..cec7abb85 100644 --- a/libs/staking/src/lib/components/staking-info.tsx +++ b/libs/staking/src/lib/components/staking-info.tsx @@ -1,5 +1,7 @@ 'use client'; import { useMemo } from 'react'; +import { useCallback, useEffect, useMemo, useState } from 'react'; +import { useTranslate } from '@tolgee/react'; import clsx from 'clsx'; import { useMediaQuery } from 'usehooks-ts'; import { useAccount, useChains } from 'wagmi'; @@ -11,6 +13,7 @@ import { StakingStatsDesktop, StakingStatsMobile } from './staking-stats'; import { useStakingStats } from '../hooks/use-staking-stats'; export function StakingInfo() { + const { t } = useTranslate('common'); const { ethAddress, haqqAddress } = useAddress(); const { openSelectWallet, isHaqqWallet } = useWallet(); const isWalletConnected = Boolean(ethAddress && haqqAddress); @@ -42,7 +45,7 @@ export function StakingInfo() { >
- You should connect wallet first + {t('connect-wallet-message', 'You should connect wallet first')}
diff --git a/libs/staking/src/lib/components/staking-stats.tsx b/libs/staking/src/lib/components/staking-stats.tsx index dc9950ff0..53283db4e 100644 --- a/libs/staking/src/lib/components/staking-stats.tsx +++ b/libs/staking/src/lib/components/staking-stats.tsx @@ -1,4 +1,5 @@ import { ReactNode } from 'react'; +import { useTranslate } from '@tolgee/react'; import clsx from 'clsx'; import { Button, Tooltip } from '@haqq/shell-ui-kit'; import { @@ -71,12 +72,13 @@ export function StakingStatsDesktop({ onRewardsClaim, isRewardsPending = false, }: StakingStatsProps) { + const { t } = useTranslate('staking'); return (
- Regular staking + {t('regular-staking', 'Regular staking')}
@@ -85,7 +87,7 @@ export function StakingStatsDesktop({
@@ -93,7 +95,7 @@ export function StakingStatsDesktop({
@@ -101,7 +103,7 @@ export function StakingStatsDesktop({
@@ -109,7 +111,7 @@ export function StakingStatsDesktop({
@@ -131,7 +133,7 @@ export function StakingStatsDesktop({ variant={2} isLoading={isRewardsPending} > - Claim all rewards + {t('claim-all-rewards', 'Claim all rewards')}
@@ -183,6 +185,7 @@ export function StakingStatsMobile({ unbounded, isRewardsPending = false, }: StakingStatsProps) { + const { t } = useTranslate('staking'); return (
@@ -194,22 +197,22 @@ export function StakingStatsMobile({
- Get rewards + {t('get-rewards', 'Get rewards')}
diff --git a/libs/staking/src/lib/components/stride/liquid-staking-delegate-modal-hooked.tsx b/libs/staking/src/lib/components/stride/liquid-staking-delegate-modal-hooked.tsx index 2d568b0d2..659112ce6 100644 --- a/libs/staking/src/lib/components/stride/liquid-staking-delegate-modal-hooked.tsx +++ b/libs/staking/src/lib/components/stride/liquid-staking-delegate-modal-hooked.tsx @@ -1,5 +1,6 @@ 'use client'; import { useCallback, useEffect, useRef, useState } from 'react'; +import { useTranslate } from '@tolgee/react'; import Link from 'next/link'; import { usePostHog } from 'posthog-js/react'; import { useDebounceValue } from 'usehooks-ts'; @@ -37,6 +38,7 @@ export function LiquidStakingDelegateModalHooked({ balance, unboundingTime, }: LiquidStakingDelegateModalProps) { + const { t } = useTranslate('staking'); const [delegateAmount, setDelegateAmount] = useState( undefined, ); @@ -82,13 +84,21 @@ export function LiquidStakingDelegateModalHooked({ await toast.promise( delegationPromise, { - loading: Delegation in progress, + loading: ( + + {t('delegation-progress', 'Delegation in progress')} + + ), success: (tx) => { console.log('Delegation successful', { tx }); const txHash = tx?.txhash; if (!txHash) { - return Delegation declined; + return ( + + {t('delegation-declined', 'Delegation declined')} + + ); } posthog.capture('delegate success', { @@ -105,7 +115,7 @@ export function LiquidStakingDelegateModalHooked({ return (
-
Delegation successful
+
{t('delegation-success', 'Delegation successful')}
{ onChange(Math.floor(balance)); }, [balance, onChange]); @@ -208,13 +210,21 @@ export function LiquidStakingDelegateModal({ const amountHint = useMemo(() => { if (amountError === 'min') { - return Bellow minimal value; + return ( + + {t('amount-error-min', 'Bellow minimal value')} + + ); } else if (amountError === 'max') { - return More than you have; + return ( + + {t('amount-error-more-than-have', 'More than you have')} + + ); } return undefined; - }, [amountError]); + }, [amountError, t]); const { stIslmFormIslm } = useStIslmFormIslm(delegateAmount || 0); @@ -238,26 +248,32 @@ export function LiquidStakingDelegateModal({
- Delegate + {t('delegate-title', 'Delegate')} - {`Attention! If in the future you want to withdraw the staked funds, it will take ${unboundingTime} ${unboundingTime === 1 ? 'day' : 'days'}`} + {t( + 'attention-withdrawal-warning', + 'Attention! If in the future you want to withdraw the staked funds, it will take {count} day{count, plural, one {} other {s}}', + { + count: unboundingTime, + }, + )}
@@ -281,9 +297,10 @@ export function LiquidStakingDelegateModal({
- What you'll get: + {t('you-will-get', "What you'll get:")}
+ {/* eslint-disable-next-line i18next/no-literal-string */} {formatNumber(stIslmFormIslm)} stISLM
@@ -291,9 +308,10 @@ export function LiquidStakingDelegateModal({ {annualizedYield ? (
- Annual percentage yield + {t('annualized-yield', 'Annual percentage yield')}
+ {/* eslint-disable-next-line i18next/no-literal-string */} {formatNumber(annualizedYield)} stISLM
@@ -307,7 +325,7 @@ export function LiquidStakingDelegateModal({ className="w-full" disabled={isDisabled || !isValidStrideAddress} > - Confirm delegation + {t('confirm-delegation', 'Confirm delegation')}
diff --git a/libs/staking/src/lib/components/stride/liquid-staking-undelegate-modal-hooked.tsx b/libs/staking/src/lib/components/stride/liquid-staking-undelegate-modal-hooked.tsx index b4450bb89..84243256d 100644 --- a/libs/staking/src/lib/components/stride/liquid-staking-undelegate-modal-hooked.tsx +++ b/libs/staking/src/lib/components/stride/liquid-staking-undelegate-modal-hooked.tsx @@ -1,5 +1,6 @@ 'use client'; import { useCallback, useEffect, useRef, useState } from 'react'; +import { useTranslate } from '@tolgee/react'; import Link from 'next/link'; import { usePostHog } from 'posthog-js/react'; import { useDebounceValue } from 'usehooks-ts'; @@ -39,6 +40,7 @@ export function LiquidStakingUndelegateModalHooked({ delegation, unboundingTime, }: LiquidStakingUndelegateModalProps) { + const { t } = useTranslate('stacking'); const { undelegate, setStrideAddress, strideAddress } = useLiquidStakingUndelegate(); const [undelegateAmount, setUndelegateAmount] = useState( @@ -80,13 +82,21 @@ export function LiquidStakingUndelegateModalHooked({ await toast.promise( undelegationPromise, { - loading: Undlegation in progress, + loading: ( + + {t('undelegation-progress', 'Undelegation in progress')} + + ), success: (tx) => { - console.log('Undlegation successful', { tx }); + console.log('Undelegation successful', { tx }); const txHash = tx?.txhash; if (!txHash) { - return Undelegation declined; + return ( + + {t('undelegation-declined', 'Undelegation declined')} + + ); } posthog.capture('undelegate success', { @@ -103,7 +113,9 @@ export function LiquidStakingUndelegateModalHooked({ return (
-
Undelegation successful
+
+ {t('undelegation-success', 'Undelegation successful')} +
{ onChange(delegation); }, [delegation, onChange]); @@ -75,15 +77,23 @@ export function LiquidStakingUndelegateModal({ const amountHint = useMemo(() => { if (amountError === 'min') { - return Bellow minimal value; + return ( + + {t('amount-error-min', 'Bellow minimal value', { ns: 'stacking' })} + + ); } else if (amountError === 'max') { return ( - More than your delegation + + {t('amount-error-more-than-delegation', 'More than your delegation', { + ns: 'stacking', + })} + ); } return undefined; - }, [amountError]); + }, [amountError, t]); const isValidStrideAddress = useStrideAddressValidation(strideAddress); @@ -99,7 +109,7 @@ export function LiquidStakingUndelegateModal({
- Undelegate + {t('undelegate', 'Undelegate', { ns: 'common' })} - Confirm undelegation + {t('confirm-undelegation', 'Confirm undelegation', { + ns: 'stacking', + })}
diff --git a/libs/staking/src/lib/components/stride/statistics/stride-stats.tsx b/libs/staking/src/lib/components/stride/statistics/stride-stats.tsx index 713d64efd..6731587d7 100644 --- a/libs/staking/src/lib/components/stride/statistics/stride-stats.tsx +++ b/libs/staking/src/lib/components/stride/statistics/stride-stats.tsx @@ -1,5 +1,6 @@ 'use client'; import { useCallback, useMemo } from 'react'; +import { useTranslate } from '@tolgee/react'; import clsx from 'clsx'; import { useRouter } from 'next/navigation'; import { useMediaQuery } from 'usehooks-ts'; @@ -133,6 +134,7 @@ function StrideStatsDesktop({ islmAmountFromStIslm: number; unbondingTotal: bigint; }) { + const { t } = useTranslate(); const { handleDelegateContinue, handleUndelegateContinue } = useHandleDelegateContinue(); @@ -141,7 +143,7 @@ function StrideStatsDesktop({
- Liquid staking + {t('liquid-staking', 'Liquid staking', { ns: 'stacking' })}
@@ -150,7 +152,7 @@ function StrideStatsDesktop({
- Delegate + {t('delegate', 'Delegate', { ns: 'common' })}
@@ -202,7 +204,7 @@ function StrideStatsDesktop({ handleUndelegateContinue(); }} > - Undelegate + {t('undelegate', 'Undelegate', { ns: 'common' })}
@@ -268,6 +270,7 @@ function StrideStatsMobile({ islmAmountFromStIslm: number; unbondingTotal: bigint; }) { + const { t } = useTranslate(); const { handleDelegateContinue, handleUndelegateContinue } = useHandleDelegateContinue(); const isTablet = useMediaQuery('(max-width: 1023px)'); @@ -279,19 +282,19 @@ function StrideStatsMobile({
- Liquid staking + {t('liquid-staking', 'Liquid staking', { ns: 'stacking' })}
)} - Delegate + {t('delegate', 'Delegate', { ns: 'common' })}
diff --git a/libs/staking/src/lib/components/undelegate-modal-hooked.tsx b/libs/staking/src/lib/components/undelegate-modal-hooked.tsx index 756c4b6f1..b4ba6b4a7 100644 --- a/libs/staking/src/lib/components/undelegate-modal-hooked.tsx +++ b/libs/staking/src/lib/components/undelegate-modal-hooked.tsx @@ -1,5 +1,6 @@ 'use client'; import { useCallback, useEffect, useRef, useState } from 'react'; +import { useTranslate } from '@tolgee/react'; import Link from 'next/link'; import { usePostHog } from 'posthog-js/react'; import { useDebounceValue } from 'usehooks-ts'; @@ -43,8 +44,8 @@ export function UndelegateModalHooked({ unboundingTime, validatorAddress, }: UndelegateModalProps) { - const { undelegate, getUndelegateEstimatedFee, approveStaking } = - useStakingActions(); + const { t } = useTranslate('staking'); + const { undelegate, getUndelegateEstimatedFee, approveStaking } = useStakingActions(); const [undelegateAmount, setUndelegateAmount] = useState( undefined, ); @@ -96,7 +97,11 @@ export function UndelegateModalHooked({ await toast.promise( undelegationPromise, { - loading: Undelegation in progress, + loading: ( + + {t('undelegation-progress', 'Undelegation in progress')} + + ), success: (tx) => { console.log('Undelegation successful', { tx }); const txHash = tx?.txhash; @@ -114,7 +119,9 @@ export function UndelegateModalHooked({ return (
-
Undelegation successful
+
+ {t('undelegation-success', 'Undelegation successful')} +
{ if (amountError === 'min') { - return Bellow minimal value; + return ( + + {t('amount-error-min', 'Bellow minimal value')} + + ); } else if (amountError === 'max') { return ( - More than your delegation + + {t('amount-error-more-than-delegation', 'More than your delegation')} + ); } return undefined; - }, [amountError]); + }, [amountError, t]); const undelegateAmountNumber = useMemo(() => { if (undelegateAmount) { @@ -115,7 +123,7 @@ export function UndelegateModal({
- Undelegate + {t('undelegate', 'Undelegate')} - {`The funds will be undelegated within ${unboundingTime} day`} + {t('funds-undelegated-in-days', { + count: unboundingTime, + })}
@@ -158,7 +168,7 @@ export function UndelegateModal({ setMemoVisible(true); }} > - Add memo + {t('add-memo', 'Add memo')}
) : ( @@ -176,14 +186,14 @@ export function UndelegateModal({ 'px-[16px] py-[12px] text-[14px] font-[500] leading-[22px]', 'bg-[#E7E7E7]', )} - placeholder="Add your memo" + placeholder={t('memo-placeholder', 'Add your memo')} />
)}
@@ -213,7 +223,7 @@ export function UndelegateModal({ className="w-full" disabled={isDisabled} > - Confirm undelegation + {t('confirm-undelegation', 'Confirm undelegation')}
diff --git a/libs/staking/src/lib/components/validator-block-mobile.tsx b/libs/staking/src/lib/components/validator-block-mobile.tsx index 002dd926a..e8cc38837 100644 --- a/libs/staking/src/lib/components/validator-block-mobile.tsx +++ b/libs/staking/src/lib/components/validator-block-mobile.tsx @@ -1,4 +1,5 @@ import { PropsWithChildren } from 'react'; +import { useTranslate } from '@tolgee/react'; import clsx from 'clsx'; import { Button, Tooltip } from '@haqq/shell-ui-kit'; import { @@ -77,42 +78,49 @@ export function ValidatorBlockMobileComponent({ isRewardPending = false, minRewardsToClaim = 1, }: ValidatorBlockMobileProps) { + const { t } = useTranslate('staking'); return (
- Validator + {t('validator', 'Validator')}
{isWarningShown && (
- While the validator is inactive, you will not be able to receive a - reward. + {t( + 'validator-inactive-warning', + 'While the validator is inactive, you will not be able to receive a reward.', + )}
)}
- My delegation + + {t('my-delegation', 'My delegation')} + {formatNumber(delegation)} {symbol.toLocaleUpperCase()}
{undelegate && undelegate > 0 && (
- Undelegate in process + + {t('undelegate-process', 'Undelegate in process')} + {formatNumber(undelegate)} {symbol.toLocaleUpperCase()}
)}
- My rewards + {t('my-rewards', 'My rewards')} {formatNumber(rewards)} {symbol.toLocaleUpperCase()} @@ -129,7 +137,7 @@ export function ValidatorBlockMobileComponent({ disabled={isDelegateDisabled} data-attr="delegate" > - Delegate + {t('delegate', 'Delegate')}
@@ -140,7 +148,7 @@ export function ValidatorBlockMobileComponent({ disabled={isUndelegateDisabled} data-attr="undelegate" > - Undelegate + {t('undelegate', 'Undelegate')}
@@ -152,7 +160,7 @@ export function ValidatorBlockMobileComponent({ disabled={isRedelegateDisabled} data-attr="redelegate" > - Redelegate + {t('redelegate', 'Redelegate')}
@@ -171,7 +179,7 @@ export function ValidatorBlockMobileComponent({ isLoading={isRewardPending} data-attr="get-my-rewards" > - Get my rewards + {t('get-my-rewards', 'Get my rewards')}
diff --git a/libs/staking/src/lib/components/validator-info.tsx b/libs/staking/src/lib/components/validator-info.tsx index 05048bf36..f4aa5b730 100644 --- a/libs/staking/src/lib/components/validator-info.tsx +++ b/libs/staking/src/lib/components/validator-info.tsx @@ -1,6 +1,7 @@ 'use client'; import { Fragment, useCallback, useEffect, useMemo, useState } from 'react'; import type { Validator } from '@evmos/provider'; +import { useTranslate } from '@tolgee/react'; import clsx from 'clsx'; import Markdown from 'marked-react'; import dynamic from 'next/dynamic'; @@ -137,28 +138,29 @@ function CommissionCardInnerBlock({ } function CommissionCard({ commission }: CommissionCardProps) { + const { t } = useTranslate('stacking'); return (
- Commission + {t('comission', 'Commission')}
@@ -182,6 +184,7 @@ export function ValidatorInfoComponent({ isRewardPending, isRewardsPending, }: ValidatorInfoComponentProps) { + const { t } = useTranslate('stacking'); const [isHaqqAddressCopy, setHaqqAddressCopy] = useState(false); const { copyText } = useClipboard(); const isDesktop = useMediaQuery('(min-width: 1024px)', { @@ -250,7 +253,7 @@ export function ValidatorInfoComponent({
- Info + {t('info', 'Info')}
@@ -264,7 +267,7 @@ export function ValidatorInfoComponent({ target="_blank" rel="noreferrer noreferrer" > - Website + {t('website', 'Website')} )} @@ -272,7 +275,7 @@ export function ValidatorInfoComponent({ - E-mail + {t('email', 'E-mail')} )}
@@ -280,12 +283,14 @@ export function ValidatorInfoComponent({
- + {formatNumber(votingPower)} {symbol.toLocaleUpperCase()}
- + {votingPowerInPercents}
@@ -293,7 +298,7 @@ export function ValidatorInfoComponent({ {validatorInfo.description?.details && (
- Description + {t('description', 'Description')}
)} - + void; }) { + const { t } = useTranslate('common'); return (
- You should connect wallet first + {t('connect-wallet-message', 'You should connect wallet first')}
@@ -447,6 +453,7 @@ export function ValidatorInfo({ }: { validatorAddress: string; }) { + const { t } = useTranslate('stacking'); const { haqqAddress } = useAddress(); const chains = useChains(); const { chain = chains[0] } = useAccount(); @@ -550,7 +557,11 @@ export function ValidatorInfo({ }); await toast.promise(claimRewardPromise, { - loading: Rewards claim in progress, + loading: ( + + {t('rewards-claim-in-progress', 'Rewards claim in progress')} + + ), success: (tx) => { console.log('Rewards claimed', { tx }); const txHash = tx?.txhash; @@ -558,7 +569,7 @@ export function ValidatorInfo({ return (
-
Rewards claimed
+
{t('rewards-claimed', 'Rewards claimed')}
Rewards claim in progress, + loading: ( + + {t('rewards-claim-in-progress', 'Rewards claim in progress')} + + ), success: (tx) => { console.log('All rewards claimed', { tx }); const txHash = tx?.txhash; return (
-
Rewards claimed
+
{t('rewards-claimed', 'Rewards claimed')}
- Explorer link + {t('explorer-link', 'Explorer link')}
); @@ -716,6 +732,7 @@ export function ValidatorInfo({ getTotalRewards, invalidateQueries, posthog, + t, toast, ]); @@ -724,7 +741,7 @@ export function ValidatorInfo({
- Fetching validator information + {t('validator-info-loading', 'Fetching validator information')}
); @@ -772,6 +789,7 @@ export function ValidatorBlockDesktop({ symbol: string; isRewardPending?: boolean; }) { + const { t } = useTranslate('stacking'); const router = useRouter(); const isWarningShown = validatorInfo.jailed || validatorInfo.status === 'BOND_STATUS_UNBONDED'; @@ -797,15 +815,17 @@ export function ValidatorBlockDesktop({
- Validator + {t('validator', 'Validator')}
{isWarningShown && (
- While the validator is inactive, you will not be able to receive a - reward. + {t( + 'validator-inactive-warning', + 'While the validator is inactive, you will not be able to receive a reward.', + )}
)} @@ -813,7 +833,7 @@ export function ValidatorBlockDesktop({
- My delegation + {t('my-delegation', 'My delegation')} {formatNumber(delegation)} {symbol.toLocaleUpperCase()} @@ -834,7 +854,7 @@ export function ValidatorBlockDesktop({ }} data-attr="delegate" > - Delegate + {t('delegate', 'Delegate')}
@@ -852,7 +872,7 @@ export function ValidatorBlockDesktop({ }} data-attr="undelegate" > - Undelegate + {t('undelegate', 'Undelegate')}
@@ -871,14 +891,14 @@ export function ValidatorBlockDesktop({ }} data-attr="redelegate" > - Redelegate + {t('redelegate', 'Redelegate')}
- My rewards + {t('my-rewards', 'My rewards')} {formatNumber(rewards)} {symbol.toLocaleUpperCase()} @@ -888,7 +908,7 @@ export function ValidatorBlockDesktop({ @@ -900,7 +920,7 @@ export function ValidatorBlockDesktop({ className="w-full" data-attr="get-my-rewards" > - Get my rewards + {t('get-my-rewards', 'Get my rewards')}
diff --git a/libs/staking/src/lib/components/validator-list-desktop.tsx b/libs/staking/src/lib/components/validator-list-desktop.tsx index ad21c0233..4a9f74816 100644 --- a/libs/staking/src/lib/components/validator-list-desktop.tsx +++ b/libs/staking/src/lib/components/validator-list-desktop.tsx @@ -4,6 +4,7 @@ import { GetDelegationsResponse, Validator, } from '@evmos/provider'; +import { useTranslate } from '@tolgee/react'; import clsx from 'clsx'; import { ValidatorListItemDesktop } from './validator-list-item-desktop'; import { SortDirection, SortState } from '../hooks/use-validator-sort'; @@ -37,6 +38,7 @@ export function ValidatorsListDesktop({ onDesktopSortClick: (key: string) => void; sortState: SortState; }) { + const { t } = useTranslate('staking'); const getValidatorRewards = useCallback( (address: string) => { const rewards = rewardsInfo?.rewards?.find((rewardsItem) => { @@ -82,7 +84,7 @@ export function ValidatorsListDesktop({ onDesktopSortClick('name'); }} > - Name + {t('name', 'Name')} {sortState.key !== 'random' && sortState.key === 'name' && ( )} @@ -90,7 +92,7 @@ export function ValidatorsListDesktop({
- Status + {t('status', 'Status')} {sortState.key !== 'random' && sortState.key === 'status' && ( )} @@ -108,7 +110,7 @@ export function ValidatorsListDesktop({ onDesktopSortClick('fee'); }} > - Fee + {t('fee', 'Fee')} {sortState.key !== 'random' && sortState.key === 'fee' && ( )} @@ -126,7 +128,7 @@ export function ValidatorsListDesktop({ onDesktopSortClick('votingPower'); }} > - Voting power + {t('voting-power', 'Voting power')} {sortState.key !== 'random' && sortState.key === 'votingPower' && ( @@ -145,7 +147,7 @@ export function ValidatorsListDesktop({ onDesktopSortClick('votingPowerPercent'); }} > - Voting power % + {t('voting-power', 'Voting power')} % {sortState.key !== 'random' && sortState.key === 'votingPowerPercent' && ( @@ -164,7 +166,7 @@ export function ValidatorsListDesktop({ onDesktopSortClick('staked'); }} > - My stake + {t('my-stake', 'My stake')} {sortState.key !== 'random' && sortState.key === 'staked' && ( )} @@ -182,7 +184,7 @@ export function ValidatorsListDesktop({ onDesktopSortClick('reward'); }} > - My rewards + {t('my-rewards', 'My rewards')} {sortState.key !== 'random' && sortState.key === 'reward' && ( )} diff --git a/libs/staking/src/lib/components/validator-list-item-mobile.tsx b/libs/staking/src/lib/components/validator-list-item-mobile.tsx index ccc9d92f6..c8ee2f99c 100644 --- a/libs/staking/src/lib/components/validator-list-item-mobile.tsx +++ b/libs/staking/src/lib/components/validator-list-item-mobile.tsx @@ -1,6 +1,7 @@ 'use client'; import { PropsWithChildren, useCallback, useMemo } from 'react'; import type { Validator, DelegationResponse, Reward } from '@evmos/provider'; +import { useTranslate } from '@tolgee/react'; import { formatUnits, parseUnits } from 'viem'; import { formatNumber, Card } from '@haqq/shell-ui-kit/server'; @@ -35,6 +36,7 @@ export function ValidatorListItemMobileComponent({ votingPower, votingPowerPercent, }: ValidatorListItemMobileProps) { + const { t } = useTranslate('staking'); return (
@@ -43,28 +45,34 @@ export function ValidatorListItemMobileComponent({ {status === 'jailed' && ( - Jailed + + {t('jailed-status', 'Jailed')} + )} {status === 'active' && ( - Active + + {t('active-status', 'Active')} + )} {status === 'inactive' && ( - Inactive + + {t('inactive-status', 'Inactive')} + )} - + {fee} - + {votingPower} - + {votingPowerPercent} - + {staked} - + {reward}
diff --git a/libs/staking/src/lib/components/validator-list-mobile.tsx b/libs/staking/src/lib/components/validator-list-mobile.tsx index e625477d5..538e203f5 100644 --- a/libs/staking/src/lib/components/validator-list-mobile.tsx +++ b/libs/staking/src/lib/components/validator-list-mobile.tsx @@ -4,6 +4,7 @@ import { GetDelegationsResponse, Validator, } from '@evmos/provider'; +import { useTranslate } from '@tolgee/react'; import { ValidatorListItemMobile } from './validator-list-item-mobile'; export function ValidatorsListMobile({ @@ -19,6 +20,7 @@ export function ValidatorsListMobile({ onValidatorClick: (validatorAddress: string) => void; totalStaked: number; }) { + const { t } = useTranslate('common'); const getValidatorRewards = useCallback( (address: string) => { const rewards = rewardsInfo?.rewards?.find((rewardsItem) => { @@ -47,7 +49,7 @@ export function ValidatorsListMobile({ return (
- Nothing found + {t('nothing-found', 'Nothing found')}
); diff --git a/libs/staking/src/lib/components/validator-list.tsx b/libs/staking/src/lib/components/validator-list.tsx index 270ee61a2..ec5b89c3f 100644 --- a/libs/staking/src/lib/components/validator-list.tsx +++ b/libs/staking/src/lib/components/validator-list.tsx @@ -1,5 +1,6 @@ 'use client'; import { useCallback, useMemo } from 'react'; +import { useTranslate } from '@tolgee/react'; import clsx from 'clsx'; import { useRouter } from 'next/navigation'; import { useMediaQuery } from 'usehooks-ts'; @@ -23,6 +24,7 @@ export function ValidatorList({ isMobileUserAgent: boolean; seedPhrase: string; }) { + const { t } = useTranslate('staking'); const { totalStaked, valsTotal, @@ -109,7 +111,7 @@ export function ValidatorList({
- Validators + {t('validators', 'Validators')} {status !== 'pending' && (  ({validatorsCounterText}) @@ -121,17 +123,17 @@ export function ValidatorList({
@@ -143,7 +145,7 @@ export function ValidatorList({ disabled={!isWalletConnected} value={isWalletConnected ? isShowMyDelegation : false} > - My delegations + {t('my-delegations', 'My delegations')}
@@ -151,7 +153,7 @@ export function ValidatorList({ onChange={setInactiveValidatorsVisible} value={isInactiveValidatorsVisible} > - Show Inactive + {t('show-inactive', 'Show inactive')}
@@ -163,12 +165,13 @@ export function ValidatorList({
- Fetching validators list + {t('fetching-validators-message', 'Fetching validators list')}
)} + {/* TODO: how to translate such errors if they come from BE?*/} {status === 'error' && (

Error: {error?.message ?? 'unknown error'}

)} diff --git a/libs/staking/src/lib/components/validator-select.tsx b/libs/staking/src/lib/components/validator-select.tsx index 8131924e6..d87c241f9 100644 --- a/libs/staking/src/lib/components/validator-select.tsx +++ b/libs/staking/src/lib/components/validator-select.tsx @@ -1,5 +1,6 @@ 'uce client'; import { useCallback, useMemo } from 'react'; +import { useTranslate } from '@tolgee/react'; import clsx from 'clsx'; import Select, { components as validatorSelectComponents, @@ -33,6 +34,7 @@ export function ValidatorSelect({ validators: Array; onChange: (validatorAddress?: string) => void; }) { + const { t } = useTranslate('stacking'); const handleFilterOption = useCallback( ({ label, value }: ValidatorSelectOption, inputValue: string) => { const inputLower = inputValue.toLowerCase(); @@ -94,7 +96,7 @@ export function ValidatorSelect({ return ( - - {t('link-to-stacking', 'Go to Staking')} - + {t('link-to-staking', 'Go to Staking')}
)} diff --git a/libs/staking/src/lib/components/delegate-modal.tsx b/libs/staking/src/lib/components/delegate-modal.tsx index 93e2d38ae..82eba5838 100644 --- a/libs/staking/src/lib/components/delegate-modal.tsx +++ b/libs/staking/src/lib/components/delegate-modal.tsx @@ -140,7 +140,7 @@ export function DelegateModal({ onMemoChange, onApprove, }: DelegateModalProps) { - const { t } = useTranslate('stacking'); + const { t } = useTranslate('staking'); const [isMemoVisible, setMemoVisible] = useState(false); const { isSafe } = useConnectorType(); diff --git a/libs/staking/src/lib/components/redelegate-modal-hooked.tsx b/libs/staking/src/lib/components/redelegate-modal-hooked.tsx index 4f8fad336..3c3ea9732 100644 --- a/libs/staking/src/lib/components/redelegate-modal-hooked.tsx +++ b/libs/staking/src/lib/components/redelegate-modal-hooked.tsx @@ -48,7 +48,7 @@ export function RedelegateModalHooked({ validatorsList, balance, }: RedelegateModalProps) { - const { t } = useTranslate('stacking'); + const { t } = useTranslate('staking'); const { haqqAddress, ethAddress } = useAddress(); const { data: redelegationValidatorAmount } = useRedelegationValidatorAmount( haqqAddress, diff --git a/libs/staking/src/lib/components/redelegate-modal.tsx b/libs/staking/src/lib/components/redelegate-modal.tsx index dc1674e86..a5cc26415 100644 --- a/libs/staking/src/lib/components/redelegate-modal.tsx +++ b/libs/staking/src/lib/components/redelegate-modal.tsx @@ -91,7 +91,7 @@ export function RedelegateModal({ onApprove, amountError, }: RedelegateModalProps) { - const { t } = useTranslate('stacking'); + const { t } = useTranslate('staking'); const [isMemoVisible, setMemoVisible] = useState(false); const { isSafe } = useConnectorType(); diff --git a/libs/staking/src/lib/components/stride/liquid-staking-delegate-modal.tsx b/libs/staking/src/lib/components/stride/liquid-staking-delegate-modal.tsx index 9af83080f..a699fca58 100644 --- a/libs/staking/src/lib/components/stride/liquid-staking-delegate-modal.tsx +++ b/libs/staking/src/lib/components/stride/liquid-staking-delegate-modal.tsx @@ -182,7 +182,7 @@ export function LiquidStakingDelegateModal({ strideAddress, setStrideAddress, }: LiquidStakingDelegateModalProps) { - const { t } = useTranslate('stacking'); + const { t } = useTranslate('staking'); const handleMaxButtonClick = useCallback(() => { onChange(Math.floor(balance)); }, [balance, onChange]); diff --git a/libs/staking/src/lib/components/stride/liquid-staking-undelegate-modal-hooked.tsx b/libs/staking/src/lib/components/stride/liquid-staking-undelegate-modal-hooked.tsx index 84243256d..3aea64559 100644 --- a/libs/staking/src/lib/components/stride/liquid-staking-undelegate-modal-hooked.tsx +++ b/libs/staking/src/lib/components/stride/liquid-staking-undelegate-modal-hooked.tsx @@ -40,7 +40,7 @@ export function LiquidStakingUndelegateModalHooked({ delegation, unboundingTime, }: LiquidStakingUndelegateModalProps) { - const { t } = useTranslate('stacking'); + const { t } = useTranslate('staking'); const { undelegate, setStrideAddress, strideAddress } = useLiquidStakingUndelegate(); const [undelegateAmount, setUndelegateAmount] = useState( diff --git a/libs/staking/src/lib/components/stride/statistics/stride-stats.tsx b/libs/staking/src/lib/components/stride/statistics/stride-stats.tsx index 6731587d7..5fd6566f8 100644 --- a/libs/staking/src/lib/components/stride/statistics/stride-stats.tsx +++ b/libs/staking/src/lib/components/stride/statistics/stride-stats.tsx @@ -143,7 +143,7 @@ function StrideStatsDesktop({
- {t('liquid-staking', 'Liquid staking', { ns: 'stacking' })} + {t('liquid-staking', 'Liquid staking', { ns: 'staking' })}
@@ -152,7 +152,7 @@ function StrideStatsDesktop({
- {t('liquid-staking', 'Liquid staking', { ns: 'stacking' })} + {t('liquid-staking', 'Liquid staking', { ns: 'staking' })}
@@ -184,7 +184,7 @@ export function ValidatorInfoComponent({ isRewardPending, isRewardsPending, }: ValidatorInfoComponentProps) { - const { t } = useTranslate('stacking'); + const { t } = useTranslate('staking'); const [isHaqqAddressCopy, setHaqqAddressCopy] = useState(false); const { copyText } = useClipboard(); const isDesktop = useMediaQuery('(min-width: 1024px)', { @@ -453,7 +453,7 @@ export function ValidatorInfo({ }: { validatorAddress: string; }) { - const { t } = useTranslate('stacking'); + const { t } = useTranslate('staking'); const { haqqAddress } = useAddress(); const chains = useChains(); const { chain = chains[0] } = useAccount(); @@ -789,7 +789,7 @@ export function ValidatorBlockDesktop({ symbol: string; isRewardPending?: boolean; }) { - const { t } = useTranslate('stacking'); + const { t } = useTranslate('staking'); const router = useRouter(); const isWarningShown = validatorInfo.jailed || validatorInfo.status === 'BOND_STATUS_UNBONDED'; diff --git a/libs/staking/src/lib/components/validator-select.tsx b/libs/staking/src/lib/components/validator-select.tsx index d87c241f9..9028d5e8b 100644 --- a/libs/staking/src/lib/components/validator-select.tsx +++ b/libs/staking/src/lib/components/validator-select.tsx @@ -34,7 +34,7 @@ export function ValidatorSelect({ validators: Array; onChange: (validatorAddress?: string) => void; }) { - const { t } = useTranslate('stacking'); + const { t } = useTranslate('staking'); const handleFilterOption = useCallback( ({ label, value }: ValidatorSelectOption, inputValue: string) => { const inputLower = inputValue.toLowerCase(); diff --git a/libs/staking/src/lib/validator-details-page.tsx b/libs/staking/src/lib/validator-details-page.tsx index bd14fa0f4..6144126ac 100644 --- a/libs/staking/src/lib/validator-details-page.tsx +++ b/libs/staking/src/lib/validator-details-page.tsx @@ -11,9 +11,7 @@ export function ValidatorDetailsPage({ address }: { address: string }) {
- - {t('stacking', 'Staking', { ns: 'common' })} - + {t('staking', 'Staking', { ns: 'common' })}
diff --git a/libs/staking/src/lib/validator-list-page.tsx b/libs/staking/src/lib/validator-list-page.tsx index c8f788e37..24a52a8d4 100644 --- a/libs/staking/src/lib/validator-list-page.tsx +++ b/libs/staking/src/lib/validator-list-page.tsx @@ -24,7 +24,7 @@ export function ValidatorListPage({
- {t('stacking', 'Staking', { ns: 'common' })} + {t('staking', 'Staking', { ns: 'common' })}
diff --git a/libs/ucdao/src/lib/ucdao-confirm-modal.tsx b/libs/ucdao/src/lib/ucdao-confirm-modal.tsx index cfa4a69d3..616afcd94 100644 --- a/libs/ucdao/src/lib/ucdao-confirm-modal.tsx +++ b/libs/ucdao/src/lib/ucdao-confirm-modal.tsx @@ -1,3 +1,4 @@ +import { T, useTranslate } from '@tolgee/react'; import clsx from 'clsx'; import { formatUnits } from 'viem'; import { @@ -24,6 +25,7 @@ export function ConfirmModal({ address: string; className?: string; }) { + const { t } = useTranslate(); return (
- Select wallet + + {t('select-wallet-heading', 'Select wallet', { ns: 'uc-dao' })} +
- You confirm you want to transfer coins ownership in DAO{' '} + {t( + 'confirm-ownership-transfer', + 'You confirm you want to transfer coins ownership in DAO', + { ns: 'uc-dao' }, + )}{' '} {' '} - - to the address {address} ? + /> + }} + />
@@ -63,12 +76,12 @@ export function ConfirmModal({ )} onClick={onClose} > - Cancel + {t('cancel-button', 'Cancel', { ns: 'common' })}
@@ -92,7 +105,12 @@ function DaoBalanceConfirmAmount({ if (balanceNum !== 0 && tokensNum !== 0) { return ( <> - {balanceNum} ISLM and {tokensNum} LIQUID + }} + /> ); } else if (tokensNum === 0) { @@ -104,7 +122,12 @@ function DaoBalanceConfirmAmount({ } else if (balanceNum === 0) { return ( <> - {tokensNum} LIQUID token{tokensNum !== 1 ? 's' : ''} + }} + /> ); } else { diff --git a/libs/ucdao/src/lib/ucdao-fund-modal.tsx b/libs/ucdao/src/lib/ucdao-fund-modal.tsx index 046d1ed60..c62f2dfad 100644 --- a/libs/ucdao/src/lib/ucdao-fund-modal.tsx +++ b/libs/ucdao/src/lib/ucdao-fund-modal.tsx @@ -1,5 +1,6 @@ 'use client'; import { useCallback, useEffect, useMemo, useState } from 'react'; +import { useTranslate } from '@tolgee/react'; import clsx from 'clsx'; import Link from 'next/link'; import { formatUnits, parseUnits } from 'viem'; @@ -38,6 +39,7 @@ export function FundModal({ onClose: () => void; className?: string; }) { + const { t } = useTranslate('uc-dao'); const { haqqAddress } = useAddress(); const { data: bankBalance } = useBankBalance(haqqAddress); const [fundAmount, setFundAmount] = useState(undefined); @@ -89,14 +91,18 @@ export function FundModal({ await toast.promise( fund(amountToFund.toString(), fundSymbol.value), { - loading: Transfer in progress, + loading: ( + + {t('transfer-progress', 'Transfer in progress')} + + ), success: (tx) => { const txHash = tx.txhash; return (
-
Transfer successful
+
{t('transfer-success', 'Transfer successful')}
{txHash && (
@@ -182,7 +188,7 @@ export function FundModal({
- Deposit to DAO + {t('deposit-dao', 'Deposit to DAO')}
@@ -206,7 +212,7 @@ export function FundModal({ htmlFor="amount" className="text-haqq-black font-guise cursor-pointer text-[13px] font-[500] leading-[22px]" > - Amount + {t('amount', 'Amount')}
@@ -229,7 +235,7 @@ export function FundModal({ className="w-full" disabled={!isFundEnabled || isFundPending} > - Deposit + {t('deposit', 'Deposit')}
diff --git a/libs/ucdao/src/lib/ucdao-page-balance.tsx b/libs/ucdao/src/lib/ucdao-page-balance.tsx index cab4f1f73..23c04eef0 100644 --- a/libs/ucdao/src/lib/ucdao-page-balance.tsx +++ b/libs/ucdao/src/lib/ucdao-page-balance.tsx @@ -1,4 +1,7 @@ 'use client'; +import { useState } from 'react'; +import { useTranslate } from '@tolgee/react'; +import { formatUnits } from 'viem'; import { useMemo, useState } from 'react'; import { Coin } from '@evmos/provider'; import { useTranslate } from '@tolgee/react'; @@ -25,7 +28,7 @@ const useFilterZeroBalances = (balances?: Coin[] | null) => { }; export function DaoPageBalance() { - const { t } = useTranslate(); + const { t } = useTranslate('uc-dao'); const { haqqAddress } = useAddress(); const { data: daoBalances } = useDaoAllBalancesQuery(haqqAddress); const { data: bankBalances } = useBankBalance(haqqAddress); @@ -47,24 +50,20 @@ export function DaoPageBalance() {
- My account + {t('account-heading', 'My account')}
- {filteredBankBalances && filteredBankBalances.length > 0 && ( + {filteredBankBalances?.length > 0 && ( )} - {filteredDaoBalances && filteredDaoBalances.length > 0 && ( + {filteredDaoBalances?.length > 0 && ( )} @@ -77,7 +76,7 @@ export function DaoPageBalance() { setFundModalOpen(true); }} > - Deposit to DAO + {t('deposit-to-dao', 'Deposit to DAO')}
*/} diff --git a/libs/ucdao/src/lib/ucdao-page.tsx b/libs/ucdao/src/lib/ucdao-page.tsx index 56033b7f9..03d647dba 100644 --- a/libs/ucdao/src/lib/ucdao-page.tsx +++ b/libs/ucdao/src/lib/ucdao-page.tsx @@ -1,4 +1,5 @@ 'use client'; +import { useTranslate } from '@tolgee/react'; import clsx from 'clsx'; import { useAddress, useWallet } from '@haqq/shell-shared'; import { Button } from '@haqq/shell-ui-kit'; @@ -7,6 +8,7 @@ import { DaoPageBalance } from './ucdao-page-balance'; import { DaoTransferForm } from './ucdao-transfer-form'; export function UCDaoPage() { + const { t } = useTranslate(); const { ethAddress } = useAddress(); const { openSelectWallet, isHaqqWallet } = useWallet(); @@ -16,7 +18,7 @@ export function UCDaoPage() {
- UnitedContributors DAO + {t('dao-page-title', 'UnitedContributors DAO', { ns: 'uc-dao' })}
@@ -31,10 +33,12 @@ export function UCDaoPage() { )} >
- You should connect wallet first + {t('connect-wallet-message', 'You should connect wallet first', { + ns: 'common', + })}
) : ( diff --git a/libs/ucdao/src/lib/ucdao-transfer-form.tsx b/libs/ucdao/src/lib/ucdao-transfer-form.tsx index d4ddb4028..fadf93cac 100644 --- a/libs/ucdao/src/lib/ucdao-transfer-form.tsx +++ b/libs/ucdao/src/lib/ucdao-transfer-form.tsx @@ -1,5 +1,6 @@ 'use client'; import { useCallback, useEffect, useMemo, useState } from 'react'; +import { useTranslate } from '@tolgee/react'; import clsx from 'clsx'; import Link from 'next/link'; import { isAddress } from 'viem'; @@ -30,6 +31,7 @@ import { import { ConfirmModal } from './ucdao-confirm-modal'; export function DaoTransferForm() { + const { t } = useTranslate(); const { haqqAddress } = useAddress(); const [isConfirmModalOpen, setConfirmModalOpen] = useState(false); const [targetAddress, setTargetAddress] = useState(''); @@ -93,14 +95,24 @@ export function DaoTransferForm() { await toast.promise( transfer(validatedAddress), { - loading: Transfer in progress, + loading: ( + + {t('transfer-progress', 'Transfer in progress', { + ns: 'uc-dao', + })} + + ), success: (tx) => { const txHash = tx.txhash; return (
-
Transfer successful
+
+ {t('transfer-success', 'Transfer successful', { + ns: 'uc-dao', + })} +
{txHash && (
@@ -153,7 +165,9 @@ export function DaoTransferForm() {
- Transfer coins ownership + {t('transfer-heading', 'Transfer coins ownership', { + ns: 'uc-dao', + })}
@@ -163,7 +177,7 @@ export function DaoTransferForm() { htmlFor="targetAddress" className="cursor-pointer text-[13px] font-[500] leading-[22px] text-white" > - Address + {t('address-label', 'Address', { ns: 'common' })}
@@ -177,7 +191,11 @@ export function DaoTransferForm() { 'w-full', )} type="text" - placeholder="Address in EVM/Bech32 format" + placeholder={t( + 'address-placeholder', + 'Address in EVM/Bech32 format', + { ns: 'uc-dao' }, + )} required id="targetAddress" name="targetAddress" @@ -197,7 +215,7 @@ export function DaoTransferForm() { }} className="w-full md:min-w-[120px]" > - Send + {t('send-button', 'Send', { ns: 'common' })}
From 83ea773302cb93fdfd5229fa6a9029176c5be7d3 Mon Sep 17 00:00:00 2001 From: Oleg Shilov Date: Thu, 31 Oct 2024 19:51:12 +0700 Subject: [PATCH 11/22] feat+refactor(shell): implement language switcher, refactor header, some more work on i18n --- apps/shell/{src/i18n => messages}/ar.json | 0 apps/shell/{src/i18n => messages}/en.json | 0 apps/shell/{src/i18n => messages}/id.json | 0 apps/shell/{src/i18n => messages}/tr.json | 0 apps/shell/src/app/{ => [locale]}/global.css | 0 apps/shell/src/app/[locale]/layout.tsx | 6 +- apps/shell/src/components/header-desktop.tsx | 21 +-- apps/shell/src/components/header-mobile.tsx | 16 +-- .../src/components/header-utils-menu.tsx | 53 ------- apps/shell/src/components/locale-dropdown.tsx | 14 ++ apps/shell/src/config/header-links.ts | 58 ++++---- .../src/hooks/use-available-locale-links.tsx | 10 ++ .../src/hooks/use-filtered-header-links.ts | 30 ++++ apps/shell/src/hooks/use-locale-switcher.tsx | 32 +++++ apps/shell/src/i18n/request.ts | 15 +- apps/shell/src/i18n/routing.ts | 17 +++ apps/shell/src/middleware.ts | 6 +- apps/shell/src/navigation.ts | 5 - apps/shell/src/tolgee/client.tsx | 4 +- apps/shell/src/tolgee/server.tsx | 4 +- apps/shell/src/tolgee/shared.ts | 18 ++- libs/ui-kit/src/index.ts | 1 + libs/ui-kit/src/lib/header-mobile.tsx | 75 ++++++---- libs/ui-kit/src/lib/header.tsx | 134 ++++++++++++++++-- libs/ui-kit/src/lib/icons.tsx | 40 ++++++ libs/ui-kit/src/lib/locale-dropdown.tsx | 79 +++++++++++ 26 files changed, 471 insertions(+), 167 deletions(-) rename apps/shell/{src/i18n => messages}/ar.json (100%) rename apps/shell/{src/i18n => messages}/en.json (100%) rename apps/shell/{src/i18n => messages}/id.json (100%) rename apps/shell/{src/i18n => messages}/tr.json (100%) rename apps/shell/src/app/{ => [locale]}/global.css (100%) delete mode 100644 apps/shell/src/components/header-utils-menu.tsx create mode 100644 apps/shell/src/components/locale-dropdown.tsx create mode 100644 apps/shell/src/hooks/use-available-locale-links.tsx create mode 100644 apps/shell/src/hooks/use-filtered-header-links.ts create mode 100644 apps/shell/src/hooks/use-locale-switcher.tsx create mode 100644 apps/shell/src/i18n/routing.ts delete mode 100644 apps/shell/src/navigation.ts create mode 100644 libs/ui-kit/src/lib/locale-dropdown.tsx diff --git a/apps/shell/src/i18n/ar.json b/apps/shell/messages/ar.json similarity index 100% rename from apps/shell/src/i18n/ar.json rename to apps/shell/messages/ar.json diff --git a/apps/shell/src/i18n/en.json b/apps/shell/messages/en.json similarity index 100% rename from apps/shell/src/i18n/en.json rename to apps/shell/messages/en.json diff --git a/apps/shell/src/i18n/id.json b/apps/shell/messages/id.json similarity index 100% rename from apps/shell/src/i18n/id.json rename to apps/shell/messages/id.json diff --git a/apps/shell/src/i18n/tr.json b/apps/shell/messages/tr.json similarity index 100% rename from apps/shell/src/i18n/tr.json rename to apps/shell/messages/tr.json diff --git a/apps/shell/src/app/global.css b/apps/shell/src/app/[locale]/global.css similarity index 100% rename from apps/shell/src/app/global.css rename to apps/shell/src/app/[locale]/global.css diff --git a/apps/shell/src/app/[locale]/layout.tsx b/apps/shell/src/app/[locale]/layout.tsx index ee3205872..9cf876844 100644 --- a/apps/shell/src/app/[locale]/layout.tsx +++ b/apps/shell/src/app/[locale]/layout.tsx @@ -23,8 +23,8 @@ import { env } from '../../env/client'; import { clashDisplayFont, hkGuiseFont } from '../../lib/fonts'; import { AppProviders } from '../../providers/app-providers'; import { PHProvider } from '../../providers/posthog-provider'; -import { ALL_LOCALES, getStaticData, Locale } from '../../tolgee/shared'; -import '../global.css'; +import { AVAILABLE_LOCALES, getStaticData, Locale } from '../../tolgee/shared'; +import './global.css'; export const metadata: Metadata = { title: { @@ -106,7 +106,7 @@ export default async function RootLayout({ }); } - if (!ALL_LOCALES.includes(params.locale as Locale)) { + if (!AVAILABLE_LOCALES.includes(params.locale as Locale)) { notFound(); } diff --git a/apps/shell/src/components/header-desktop.tsx b/apps/shell/src/components/header-desktop.tsx index e809b3750..2d8e312c1 100644 --- a/apps/shell/src/components/header-desktop.tsx +++ b/apps/shell/src/components/header-desktop.tsx @@ -1,10 +1,10 @@ 'use client'; -import { useMemo } from 'react'; import dynamic from 'next/dynamic'; import { useAccount, useChains } from 'wagmi'; import { haqqTestedge2 } from 'wagmi/chains'; import { Header } from '@haqq/shell-ui-kit'; -import { headerLinks } from '../config/header-links'; +import { useFilteredLinks } from '../hooks/use-filtered-header-links'; +import { useLocaleSwitcher } from '../hooks/use-locale-switcher'; const Web3ConnectButtons = dynamic(async () => { const { Web3ConnectButtons } = await import( @@ -13,29 +13,22 @@ const Web3ConnectButtons = dynamic(async () => { return { default: Web3ConnectButtons }; }); -const HeaderUtilsMenu = dynamic(async () => { - const { HeaderUtilsMenu } = await import('../components/header-utils-menu'); - return { default: HeaderUtilsMenu }; -}); - export function AppHeaderDesktop({ className }: { className?: string }) { const chains = useChains(); const { chain = chains[0] } = useAccount(); const isTestedge = chain.id === haqqTestedge2.id; - - const links = useMemo(() => { - return headerLinks.filter((link) => { - return link.chains.includes(chain.id); - }); - }, [chain.id]); + const links = useFilteredLinks(chain); + const { switchLocale, locales, currentLocale } = useLocaleSwitcher(); return (
} - utilsSlot={} className={className} isTestedge={isTestedge} + locales={locales} + switchLocale={switchLocale} + currentLocale={currentLocale} /> ); } diff --git a/apps/shell/src/components/header-mobile.tsx b/apps/shell/src/components/header-mobile.tsx index 8792b15ee..9592e88cb 100644 --- a/apps/shell/src/components/header-mobile.tsx +++ b/apps/shell/src/components/header-mobile.tsx @@ -1,10 +1,9 @@ 'use client'; -import { useMemo } from 'react'; import dynamic from 'next/dynamic'; import { useAccount, useChains } from 'wagmi'; import { haqqTestedge2 } from 'wagmi/chains'; import { HeaderMobile } from '@haqq/shell-ui-kit'; -import { headerLinks } from '../config/header-links'; +import { useFilteredLinks } from '../hooks/use-filtered-header-links'; const Web3ConnectButtonsMobile = dynamic(async () => { const { Web3ConnectButtonsMobile } = await import( @@ -13,27 +12,16 @@ const Web3ConnectButtonsMobile = dynamic(async () => { return { default: Web3ConnectButtonsMobile }; }); -const HeaderUtilsMenu = dynamic(async () => { - const { HeaderUtilsMenu } = await import('../components/header-utils-menu'); - return { default: HeaderUtilsMenu }; -}); - export function AppHeaderMobile({ className }: { className?: string }) { const chains = useChains(); const { chain = chains[0] } = useAccount(); const isTestedge = chain.id === haqqTestedge2.id; - - const links = useMemo(() => { - return headerLinks.filter((link) => { - return link.chains.includes(chain.id); - }); - }, [chain.id]); + const links = useFilteredLinks(chain); return ( } - utilsSlot={} className={className} isTestedge={isTestedge} /> diff --git a/apps/shell/src/components/header-utils-menu.tsx b/apps/shell/src/components/header-utils-menu.tsx deleted file mode 100644 index 0674469e9..000000000 --- a/apps/shell/src/components/header-utils-menu.tsx +++ /dev/null @@ -1,53 +0,0 @@ -import { Menu, MenuButton, MenuItem, MenuItems } from '@headlessui/react'; -import clsx from 'clsx'; -import Link from 'next/link'; -import { ArrowDownIcon } from '@haqq/shell-ui-kit/server'; -import { headerUtilsLinks } from '../config/header-links'; - -export function HeaderUtilsMenu() { - return ( - - -
Utils
- -
- - - {headerUtilsLinks.map(({ name, link }) => { - return ( - - {name} - - ); - })} - -
- ); -} diff --git a/apps/shell/src/components/locale-dropdown.tsx b/apps/shell/src/components/locale-dropdown.tsx new file mode 100644 index 000000000..7c1cff9b7 --- /dev/null +++ b/apps/shell/src/components/locale-dropdown.tsx @@ -0,0 +1,14 @@ +import { useLocaleSwitcher } from '../hooks/use-locale-switcher'; +import { LocaleDropdown } from '@haqq/shell-ui-kit'; + +export function AppLocaleDropdown() { + const { switchLocale, locales, currentLocale } = useLocaleSwitcher(); + + return ( + + ); +} diff --git a/apps/shell/src/config/header-links.ts b/apps/shell/src/config/header-links.ts index e87f0d128..428110633 100644 --- a/apps/shell/src/config/header-links.ts +++ b/apps/shell/src/config/header-links.ts @@ -1,43 +1,53 @@ import { haqqMainnet, haqqTestedge2 } from 'wagmi/chains'; +import { HeaderLink } from '@haqq/shell-ui-kit'; -export const headerLinks: { - href: string; - label: string; - chains: number[]; -}[] = [ - // { - // href: '/', - // label: 'Home', - // chains: [haqqMainnet.id, haqqTestedge2.id], - // }, +export const headerLinks: HeaderLink[] = [ { - href: '/uc-dao', + type: 'link', label: 'UC DAO', + href: '/uc-dao', chains: [haqqMainnet.id, haqqTestedge2.id], }, { - href: '/staking', + type: 'link', label: 'Staking', + href: '/staking', chains: [haqqMainnet.id, haqqTestedge2.id], }, { - href: '/governance', + type: 'link', label: 'Governance', + href: '/governance', chains: [haqqMainnet.id, haqqTestedge2.id], }, { - href: '/authz', - label: 'Authz', - chains: [haqqMainnet.id, haqqTestedge2.id], + type: 'dropdown', + label: 'Tools', + children: [ + { + type: 'link', + label: 'Authz', + href: '/authz', + chains: [haqqMainnet.id, haqqTestedge2.id], + }, + { + type: 'link', + label: 'Faucet', + href: '/faucet', + chains: [haqqTestedge2.id], + }, + ], }, { - href: '/faucet', - label: 'Faucet', - chains: [haqqTestedge2.id], + type: 'dropdown', + label: 'Utils', + children: [ + { + type: 'link', + label: 'Address conversion', + href: '/utils/address-conversion', + chains: [haqqMainnet.id, haqqTestedge2.id], + }, + ], }, ]; - -export const headerUtilsLinks: { - name: string; - link: string; -}[] = [{ name: 'Address conversion', link: '/utils/address-conversion' }]; diff --git a/apps/shell/src/hooks/use-available-locale-links.tsx b/apps/shell/src/hooks/use-available-locale-links.tsx new file mode 100644 index 000000000..46d40ac60 --- /dev/null +++ b/apps/shell/src/hooks/use-available-locale-links.tsx @@ -0,0 +1,10 @@ +import { AVAILABLE_LOCALES, LOCALE_LABELS } from '../tolgee/shared'; + +export function useAvailableLocaleLinks() { + return AVAILABLE_LOCALES.map((locale) => { + return { + id: locale, + label: `${LOCALE_LABELS[locale].emoji} ${LOCALE_LABELS[locale].label}`, + }; + }); +} diff --git a/apps/shell/src/hooks/use-filtered-header-links.ts b/apps/shell/src/hooks/use-filtered-header-links.ts new file mode 100644 index 000000000..ecb924096 --- /dev/null +++ b/apps/shell/src/hooks/use-filtered-header-links.ts @@ -0,0 +1,30 @@ +import { useMemo } from 'react'; +import { Chain } from 'wagmi/chains'; +import { HeaderLink } from '@haqq/shell-ui-kit'; +import { headerLinks } from '../config/header-links'; + +export function useFilteredLinks(chain: Chain) { + const links = useMemo(() => { + return headerLinks + .map((link) => { + if (link.type === 'dropdown') { + const filteredChildren = link.children.filter((child) => { + return !child.chains || child.chains.includes(chain.id); + }); + if (filteredChildren.length > 0) { + return { ...link, children: filteredChildren }; + } + return null; + } + + if (link.type === 'link' && link.chains.includes(chain.id)) { + return link; + } + + return null; + }) + .filter(Boolean) as HeaderLink[]; + }, [chain.id]); + + return links; +} diff --git a/apps/shell/src/hooks/use-locale-switcher.tsx b/apps/shell/src/hooks/use-locale-switcher.tsx new file mode 100644 index 000000000..87bc7930f --- /dev/null +++ b/apps/shell/src/hooks/use-locale-switcher.tsx @@ -0,0 +1,32 @@ +'use client'; +import { useCallback } from 'react'; +import { useLocale } from 'next-intl'; +import { useRouter, usePathname } from '../i18n/routing'; +import { AVAILABLE_LOCALES, LOCALE_LABELS } from '../tolgee/shared'; + +export function useLocaleSwitcher() { + const router = useRouter(); + const pathname = usePathname(); + const currentLocale = useLocale(); + + const switchLocale = useCallback( + (locale: string) => { + router.replace(pathname, { locale }); + }, + [router, pathname], + ); + + const locales = AVAILABLE_LOCALES.map((locale) => { + return { + id: locale, + label: LOCALE_LABELS[locale].label, + emoji: LOCALE_LABELS[locale].emoji, + }; + }); + + return { + switchLocale, + locales, + currentLocale, + }; +} diff --git a/apps/shell/src/i18n/request.ts b/apps/shell/src/i18n/request.ts index 271db2057..182fc7b80 100644 --- a/apps/shell/src/i18n/request.ts +++ b/apps/shell/src/i18n/request.ts @@ -1,10 +1,17 @@ import { getRequestConfig } from 'next-intl/server'; +import { routing } from './routing'; +import { Locale } from '../tolgee/shared'; + +export default getRequestConfig(async ({ requestLocale }) => { + // Get locale from request and fallback to default if needed + let locale = await requestLocale; + + if (!locale || !routing.locales.includes(locale as Locale)) { + locale = routing.defaultLocale; + } -// The i18n/request.ts is required by next-intl package, we don't actually need it, -// so we are only doing necessary actions to stop next-intl from complaining. -export default getRequestConfig(async ({ locale }) => { return { - // do this to make next-intl not emmit any warnings + locale, messages: { locale }, }; }); diff --git a/apps/shell/src/i18n/routing.ts b/apps/shell/src/i18n/routing.ts new file mode 100644 index 000000000..41a72778b --- /dev/null +++ b/apps/shell/src/i18n/routing.ts @@ -0,0 +1,17 @@ +import { createNavigation } from 'next-intl/navigation'; +import { defineRouting } from 'next-intl/routing'; +import { AVAILABLE_LOCALES, DEFAULT_LOCALE } from '../tolgee/shared'; + +export const routing = defineRouting({ + locales: AVAILABLE_LOCALES, + defaultLocale: DEFAULT_LOCALE, + localeCookie: { + // Custom cookie name + name: 'USER_LOCALE', + // Expire in one day + maxAge: 60 * 60 * 24, + }, +}); + +export const { Link, redirect, usePathname, useRouter, permanentRedirect } = + createNavigation(routing); diff --git a/apps/shell/src/middleware.ts b/apps/shell/src/middleware.ts index 55c57f2c1..5463e5594 100644 --- a/apps/shell/src/middleware.ts +++ b/apps/shell/src/middleware.ts @@ -1,10 +1,10 @@ import createMiddleware from 'next-intl/middleware'; -import { ALL_LOCALES, DEFAULT_LOCALE } from './tolgee/shared'; +import { AVAILABLE_LOCALES, DEFAULT_LOCALE } from './tolgee/shared'; export default createMiddleware({ - locales: ALL_LOCALES, + locales: AVAILABLE_LOCALES, defaultLocale: DEFAULT_LOCALE, - localePrefix: 'as-needed', + localePrefix: 'never', }); export const config = { diff --git a/apps/shell/src/navigation.ts b/apps/shell/src/navigation.ts deleted file mode 100644 index 7ac72acef..000000000 --- a/apps/shell/src/navigation.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { createSharedPathnamesNavigation } from 'next-intl/navigation'; -import { ALL_LOCALES } from './tolgee/shared'; - -export const { Link, redirect, usePathname, useRouter } = - createSharedPathnamesNavigation({ locales: ALL_LOCALES }); diff --git a/apps/shell/src/tolgee/client.tsx b/apps/shell/src/tolgee/client.tsx index e223b39c0..0e2c00f9e 100644 --- a/apps/shell/src/tolgee/client.tsx +++ b/apps/shell/src/tolgee/client.tsx @@ -3,7 +3,7 @@ import { ReactNode, useEffect } from 'react'; import { TolgeeProvider, TolgeeStaticData, useTolgeeSSR } from '@tolgee/react'; import { useRouter } from 'next/navigation'; -import { ALL_LOCALES, ALL_NAMESPACES, TolgeeBase } from './shared'; +import { AVAILABLE_LOCALES, ALL_NAMESPACES, TolgeeBase } from './shared'; type Props = { locales: TolgeeStaticData; @@ -13,7 +13,7 @@ type Props = { const staticData: Record Promise> = {}; -ALL_LOCALES.forEach((loc) => { +AVAILABLE_LOCALES.forEach((loc) => { ALL_NAMESPACES.forEach((ns) => { staticData[`${loc}:${ns}`] = async () => { const data = await import(`../i18n/${loc}.json`); diff --git a/apps/shell/src/tolgee/server.tsx b/apps/shell/src/tolgee/server.tsx index 7a7b7cc49..696622511 100644 --- a/apps/shell/src/tolgee/server.tsx +++ b/apps/shell/src/tolgee/server.tsx @@ -1,13 +1,13 @@ import { createServerInstance } from '@tolgee/react/server'; import { getLocale } from 'next-intl/server'; -import { TolgeeBase, ALL_LOCALES, getStaticData } from './shared'; +import { TolgeeBase, AVAILABLE_LOCALES, getStaticData } from './shared'; export const { getTolgee, getTranslate, T } = createServerInstance({ getLocale, createTolgee: async (locale) => { return TolgeeBase().init({ // load all languages on the server - staticData: await getStaticData(ALL_LOCALES), + staticData: await getStaticData(AVAILABLE_LOCALES as unknown as string[]), observerOptions: { fullKeyEncode: true, }, diff --git a/apps/shell/src/tolgee/shared.ts b/apps/shell/src/tolgee/shared.ts index ff916ab39..6d1b9354e 100644 --- a/apps/shell/src/tolgee/shared.ts +++ b/apps/shell/src/tolgee/shared.ts @@ -1,8 +1,15 @@ import { FormatIcu } from '@tolgee/format-icu'; import { DevTools, Tolgee, FormatSimple, TolgeeStaticData } from '@tolgee/web'; -export type Locale = 'en' | 'ar' | 'id' | 'tr'; -export const ALL_LOCALES: Locale[] = ['en', 'ar', 'id', 'tr']; +export const AVAILABLE_LOCALES = ['en', 'ar', 'id', 'tr'] as const; +export type Locale = (typeof AVAILABLE_LOCALES)[number]; + +export const LOCALE_LABELS: Record = { + en: { label: 'English', emoji: '🇬🇧' }, + ar: { label: 'العربية', emoji: '🇸🇦' }, + id: { label: 'Bahasa Indonesia', emoji: '🇮🇩' }, + tr: { label: 'Türkçe', emoji: '🇹🇷' }, +}; export type Namespace = | 'common' @@ -35,7 +42,7 @@ export async function getStaticData( for (const lang of languages) { for (const ns of ALL_NAMESPACES) { try { - const data = (await import(`../i18n/${lang}.json`)).default; + const data = (await import(`../../messages/${lang}.json`)).default; result[`${lang}:${ns}`] = data[ns]; } catch (error) { console.error( @@ -56,9 +63,6 @@ export function TolgeeBase() { .use(DevTools()) .use(FormatIcu()) // Preset shared settings - .updateDefaults({ - apiKey, - apiUrl, - }) + .updateDefaults({ apiKey, apiUrl }) ); } diff --git a/libs/ui-kit/src/index.ts b/libs/ui-kit/src/index.ts index 9f994eb9b..6d22af9df 100644 --- a/libs/ui-kit/src/index.ts +++ b/libs/ui-kit/src/index.ts @@ -19,5 +19,6 @@ export * from './lib/header-mobile'; export * from './lib/select-chain-modal'; export * from './lib/low-balance-alert'; export * from './lib/expandable-block'; +export * from './lib/locale-dropdown'; export * from './hooks/use-scroll-track'; diff --git a/libs/ui-kit/src/lib/header-mobile.tsx b/libs/ui-kit/src/lib/header-mobile.tsx index 47ed76ccd..5941043b1 100644 --- a/libs/ui-kit/src/lib/header-mobile.tsx +++ b/libs/ui-kit/src/lib/header-mobile.tsx @@ -14,6 +14,7 @@ import { useScrollLock } from 'usehooks-ts'; import { useLayout } from '@haqq/shell-shared'; import { BurgerButton } from './burger-button'; import { Container } from './container'; +import { HeaderLink, HeaderLinkWithHref } from './header'; import { HeaderNavLink } from './header-nav-link'; import { TestedgeBanner } from './testedge-banner'; import { useScrollTrack } from '../hooks/use-scroll-track'; @@ -33,7 +34,7 @@ export function HeaderMobile({ isHaqqWallet?: boolean; isTestedge?: boolean; renderPageTitle?: () => ReactNode; - links: { href: string; label: string }[]; + links: HeaderLink[]; className?: string; }) { const { lock, unlock } = useScrollLock(); @@ -51,7 +52,7 @@ export function HeaderMobile({ }; }, [isMobileMenuOpen, lock, unlock]); - const baseHeaderStyles = clsx( + const baseHeaderClassNames = clsx( 'border-haqq-border w-full transform-gpu border-b-[1px]', 'transform-gpu overflow-clip transition-[height,background,border] duration-150 ease-in-out will-change-[height,background,border]', isMobileMenuOpen ? 'h-[calc(100vh)]' : 'h-[62px]', @@ -64,7 +65,7 @@ export function HeaderMobile({
{isTestedge && } - +
{links.length > 0 && (
+ {/* Spacer */}
{(web3ButtonsSlot || links.length > 0) && ( -
+
{links.length > 0 && ( )} - {utilsSlot} - - {web3ButtonsSlot} + {(web3ButtonsSlot || locales?.length) && ( +
+ {locales?.length && ( + + )} + {web3ButtonsSlot} +
+ )}
)}
@@ -129,3 +170,74 @@ export function Header({ ); } + +function HeaderDropdown({ + label, + links, +}: { + label: string; + links: HeaderLinkWithHref[]; +}) { + const hoverRef = useRef(null); + const isHover = useHover(hoverRef); + + return ( +
+
+
+ {label} +
+ + + +
+
+
+
+ {links.map(({ href, label }) => { + return ( + + {label} + + ); + })} +
+
+
+
+ ); +} diff --git a/libs/ui-kit/src/lib/icons.tsx b/libs/ui-kit/src/lib/icons.tsx index 2ae6eead3..9377ca4fd 100644 --- a/libs/ui-kit/src/lib/icons.tsx +++ b/libs/ui-kit/src/lib/icons.tsx @@ -328,3 +328,43 @@ export function ArrowDownIcon({ className }: { className?: string }) { ); } + +export function GlobeIcon({ className }: { className?: string }) { + return ( + + + + ); +} + +export function CheckIcon({ className }: { className?: string }) { + return ( + + + + ); +} diff --git a/libs/ui-kit/src/lib/locale-dropdown.tsx b/libs/ui-kit/src/lib/locale-dropdown.tsx new file mode 100644 index 000000000..082be0880 --- /dev/null +++ b/libs/ui-kit/src/lib/locale-dropdown.tsx @@ -0,0 +1,79 @@ +'use client'; +import { useRef } from 'react'; +import clsx from 'clsx'; +import { useHover } from 'usehooks-ts'; +import { GlobeIcon, CheckIcon } from './icons'; + +export type LocaleOption = { + id: string; + label: string; + emoji: string; +}; + +type LocaleDropdownProps = { + locales: LocaleOption[]; + switchLocale?: (locale: string) => void; + currentLocale: string; +}; + +export function LocaleDropdown({ + locales, + switchLocale, + currentLocale, +}: LocaleDropdownProps) { + const hoverRef = useRef(null); + const isHover = useHover(hoverRef); + + return ( +
+ + +
+
+
+ {locales.map(({ id, label, emoji }) => { + const isActive = id === currentLocale; + return ( + + ); + })} +
+
+
+
+ ); +} From 04b99d4846c0ede31cdf38688bef14b25ed1108a Mon Sep 17 00:00:00 2001 From: Viktoryia Date: Tue, 5 Nov 2024 11:00:57 +0100 Subject: [PATCH 12/22] feat(governance): use tolgee for translation (#984) * feat(tolgee-keys): governance Signed-off-by: viktoriabakun * feat(tolgee-keys): governance Signed-off-by: viktoriabakun * fix(governance): simplify your-balance params Signed-off-by: viktoriabakun * feat(governance): extract tolgee keys Signed-off-by: viktoriabakun * chore: fix build Signed-off-by: viktoriabakun --------- Signed-off-by: viktoriabakun --- apps/shell/messages/en.json | 46 +++++- apps/shell/src/components/locale-dropdown.tsx | 2 +- libs/governance/src/index.ts | 1 + .../components/parameter-change-proposal.tsx | 4 +- .../lib/components/proposal-deposit-modal.tsx | 22 ++- .../src/lib/components/proposal-list-card.tsx | 4 +- .../components/software-upgrade-proposal.tsx | 4 +- .../src/lib/hooks/useGetProposalTypeText.tsx | 44 +++++ .../src/lib/proposal-details-page.tsx | 153 +++++++++--------- .../governance/src/lib/proposal-list-page.tsx | 8 +- package.json | 1 + 11 files changed, 198 insertions(+), 91 deletions(-) create mode 100644 libs/governance/src/lib/hooks/useGetProposalTypeText.tsx diff --git a/apps/shell/messages/en.json b/apps/shell/messages/en.json index 5cbfcdab8..718a23c92 100644 --- a/apps/shell/messages/en.json +++ b/apps/shell/messages/en.json @@ -45,7 +45,51 @@ "confirm-button": "Confirm", "send-button": "Send" }, - "governance": {}, + "governance": { + "add-memo": "Add memo", + "add-your-memo": "Add your memo", + "amount-error-min": "Bellow minimal value", + "amount-error-more-than-have": "More than you have", + "cast-vote": "Cast your vote", + "change-vote-message": "You can change your vote while the voting is in progress", + "confirm-delegation": "Confirm delegation", + "created-at": "Created at (gmt)", + "dates": "Dates", + "deposit": "Deposit", + "deposit-end": "Deposit end", + "description": "Description", + "enter-amount": "Enter Amount", + "enter-deposit-message": "Enter the amount you want to deposit", + "fetching-proposal-details": "Fetching proposal details", + "fetching-proposals": "Fetching proposals", + "info": "Info", + "my-balance": "My balance", + "parameter-changes": "Parameter changes", + "proposal-deposit-alert": "If the proposal does not collect the required number of deposits in a certain time, it will reject", + "proposal-types": { + "cancel-software-upgrade": "Cancel software upgrade", + "client-update": "Client update", + "parameter-change": "Parameter change", + "register-coin": "Register coin", + "register-erc20": "Register ERC20", + "software-upgrade": "Software upgrade", + "text": "Text" + }, + "show-all-dates": "Show all dates", + "total-deposit": "Total deposit", + "upgrade-plan": "Upgrade plan", + "vote-end": "Vote end (gmt)", + "vote-fail-error": "For some reason your vote failed.", + "vote-in-progress": "Vote in progress", + "vote-option-abstain": "Abstain", + "vote-option-no": "No", + "vote-option-veto": "Veto", + "vote-option-yes": "Yes", + "vote-start": "Vote start (gmt)", + "vote-will-count": "Your vote will be counted!!!", + "voting-end": "Voting end", + "your-balance": "Your balance: {{balance}} {{symbol}}" + }, "main": {}, "staking": { "attention-withdrawal-warning": "Attention! If in the future you want to withdraw the staked funds, it will take {{count}} day{count, plural, one {} other {s}}", diff --git a/apps/shell/src/components/locale-dropdown.tsx b/apps/shell/src/components/locale-dropdown.tsx index 7c1cff9b7..5f4d64bf0 100644 --- a/apps/shell/src/components/locale-dropdown.tsx +++ b/apps/shell/src/components/locale-dropdown.tsx @@ -1,5 +1,5 @@ -import { useLocaleSwitcher } from '../hooks/use-locale-switcher'; import { LocaleDropdown } from '@haqq/shell-ui-kit'; +import { useLocaleSwitcher } from '../hooks/use-locale-switcher'; export function AppLocaleDropdown() { const { switchLocale, locales, currentLocale } = useLocaleSwitcher(); diff --git a/libs/governance/src/index.ts b/libs/governance/src/index.ts index 5873e7a12..dfc96009f 100644 --- a/libs/governance/src/index.ts +++ b/libs/governance/src/index.ts @@ -1,3 +1,4 @@ export * from './lib/proposal-list-page'; export * from './lib/proposal-details-page'; export * from './lib/components/proposal-list-card'; +export * from './lib/hooks/useGetProposalTypeText'; diff --git a/libs/governance/src/lib/components/parameter-change-proposal.tsx b/libs/governance/src/lib/components/parameter-change-proposal.tsx index cceb252a7..193872130 100644 --- a/libs/governance/src/lib/components/parameter-change-proposal.tsx +++ b/libs/governance/src/lib/components/parameter-change-proposal.tsx @@ -1,4 +1,5 @@ import { ParameterChangeProposalContent } from '@evmos/provider'; +import { useTranslate } from '@tolgee/react'; import { Heading } from '@haqq/shell-ui-kit/server'; import { Metadata } from './metadata'; @@ -7,6 +8,7 @@ export function ParameterChangeProposalDetails({ }: { content: ParameterChangeProposalContent; }) { + const { t } = useTranslate('governance'); return (
@@ -26,7 +28,7 @@ export function ParameterChangeProposalDetails({ - Parameter changes + {t('parameter-changes', 'Parameter changes')}
{JSON.stringify(content.changes, null, 2)} diff --git a/libs/governance/src/lib/components/proposal-deposit-modal.tsx b/libs/governance/src/lib/components/proposal-deposit-modal.tsx index c262a88f2..ad6de4164 100644 --- a/libs/governance/src/lib/components/proposal-deposit-modal.tsx +++ b/libs/governance/src/lib/components/proposal-deposit-modal.tsx @@ -1,5 +1,6 @@ 'use client'; import { useCallback, useEffect, useMemo, useState } from 'react'; +import { useTranslate } from '@tolgee/react'; import clsx from 'clsx'; import { Button, @@ -65,6 +66,7 @@ export function ProposalDepositModal({ onSubmit: (amount: number) => void; isPending?: boolean; }) { + const { t } = useTranslate('governance'); const [depositAmount, setDepositAmount] = useState( undefined, ); @@ -101,13 +103,21 @@ export function ProposalDepositModal({ const amountHint = useMemo(() => { if (amountError === 'min') { - return Bellow minimal value; + return ( + + {t('amount-error-min', 'Bellow minimal value')} + + ); } else if (amountError === 'max') { - return More than you have; + return ( + + {t('amount-error-more-than-have', 'More than you have')} + + ); } return undefined; - }, [amountError]); + }, [amountError, t]); const handleMaxButtonClick = useCallback(() => { setDepositAmount(balance); @@ -129,12 +139,12 @@ export function ProposalDepositModal({
- Deposit + {t('deposit', 'Deposit')}
@@ -157,7 +167,7 @@ export function ProposalDepositModal({ disabled={!isDepositEnabled || !depositAmount} isLoading={isPending} > - Confirm delegation + {t('confirm-delegation', 'Confirm delegation')}
diff --git a/libs/governance/src/lib/components/proposal-list-card.tsx b/libs/governance/src/lib/components/proposal-list-card.tsx index 5a3e09936..137da153c 100644 --- a/libs/governance/src/lib/components/proposal-list-card.tsx +++ b/libs/governance/src/lib/components/proposal-list-card.tsx @@ -4,7 +4,7 @@ import { formatUnits } from 'viem/utils'; import { GetGovernanceParamsResponse } from '@haqq/data-access-cosmos'; import { VoteResultsWithPercentages } from '@haqq/shell-shared'; import { ProposalCard, ProposalStatusEnum } from '@haqq/shell-ui-kit/server'; -import { getProposalTypeText } from '../proposal-details-page'; +import { useGetProposalTypeText } from '../hooks/useGetProposalTypeText'; export function ProposalListCard({ proposal, @@ -52,7 +52,7 @@ export function ProposalListCard({ minDeposit={minDeposit} voteResults={voteResults} symbol={symbol} - type={getProposalTypeText(proposal.content['@type'])} + type={useGetProposalTypeText(proposal.content['@type'])} userVote={userVote} className={className} /> diff --git a/libs/governance/src/lib/components/software-upgrade-proposal.tsx b/libs/governance/src/lib/components/software-upgrade-proposal.tsx index 2ca1cb0ca..93579308f 100644 --- a/libs/governance/src/lib/components/software-upgrade-proposal.tsx +++ b/libs/governance/src/lib/components/software-upgrade-proposal.tsx @@ -1,4 +1,5 @@ import { useMemo } from 'react'; +import { useTranslate } from '@tolgee/react'; import { Heading } from '@haqq/shell-ui-kit/server'; import { Metadata } from './metadata'; @@ -15,6 +16,7 @@ export function SoftwareUpgradeProposalDetails({ }: { plan: SoftwareUpgradeProposalPlan; }) { + const { t } = useTranslate('governance'); const formattedPlan = useMemo(() => { return { name: plan.name, @@ -44,7 +46,7 @@ export function SoftwareUpgradeProposalDetails({ - Upgrade plan + {t('upgrade-plan', 'Upgrade plan')}
diff --git a/libs/governance/src/lib/hooks/useGetProposalTypeText.tsx b/libs/governance/src/lib/hooks/useGetProposalTypeText.tsx new file mode 100644 index 000000000..2306d0f0a --- /dev/null +++ b/libs/governance/src/lib/hooks/useGetProposalTypeText.tsx @@ -0,0 +1,44 @@ +import { useTranslate } from '@tolgee/react'; + +export const enum ProposalTypes { + Text = '/cosmos.gov.v1beta1.TextProposal', + SoftwareUpgrade = '/cosmos.upgrade.v1beta1.SoftwareUpgradeProposal', + CancelSoftwareUpgrade = '/cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal', + ParameterChange = '/cosmos.params.v1beta1.ParameterChangeProposal', + ClientUpdate = '/ibc.core.client.v1.ClientUpdateProposal', + RegisterCoin = '/evmos.erc20.v1.RegisterCoinProposal', + RegisterERC20 = '/evmos.erc20.v1.RegisterERC20Proposal', +} + +export function useGetProposalTypeText(type: string) { + const { t } = useTranslate('governance'); + + switch (type) { + case ProposalTypes.Text: + return t('proposal-types.text', 'Text'); + + case ProposalTypes.SoftwareUpgrade: + return t('proposal-types.software-upgrade', 'Software upgrade'); + + case ProposalTypes.CancelSoftwareUpgrade: + return t( + 'proposal-types.cancel-software-upgrade', + 'Cancel software upgrade', + ); + + case ProposalTypes.ClientUpdate: + return t('proposal-types.client-update', 'Client update'); + + case ProposalTypes.ParameterChange: + return t('proposal-types.parameter-change', 'Parameter change'); + + case ProposalTypes.RegisterCoin: + return t('proposal-types.register-coin', 'Register coin'); + + case ProposalTypes.RegisterERC20: + return t('proposal-types.register-erc20', 'Register ERC20'); + + default: + return type; + } +} diff --git a/libs/governance/src/lib/proposal-details-page.tsx b/libs/governance/src/lib/proposal-details-page.tsx index 1b91b9eb4..cab187fad 100644 --- a/libs/governance/src/lib/proposal-details-page.tsx +++ b/libs/governance/src/lib/proposal-details-page.tsx @@ -12,6 +12,7 @@ import { Proposal, SoftwareUpgradeProposalContent, } from '@evmos/provider'; +import { useTranslate } from '@tolgee/react'; import clsx from 'clsx'; import Markdown from 'marked-react'; import Link from 'next/link'; @@ -68,52 +69,19 @@ import { } from '@haqq/shell-ui-kit/server'; import { ParameterChangeProposalDetails } from './components/parameter-change-proposal'; import { SoftwareUpgradeProposalDetails } from './components/software-upgrade-proposal'; - -const enum ProposalTypes { - Text = '/cosmos.gov.v1beta1.TextProposal', - SoftwareUpgrade = '/cosmos.upgrade.v1beta1.SoftwareUpgradeProposal', - CancelSoftwareUpgrade = '/cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal', - ParameterChange = '/cosmos.params.v1beta1.ParameterChangeProposal', - ClientUpdate = '/ibc.core.client.v1.ClientUpdateProposal', - RegisterCoin = '/evmos.erc20.v1.RegisterCoinProposal', - RegisterERC20 = '/evmos.erc20.v1.RegisterERC20Proposal', -} - -export function getProposalTypeText(type: string) { - switch (type) { - case ProposalTypes.Text: - return 'Text'; - - case ProposalTypes.SoftwareUpgrade: - return 'Software upgrade'; - - case ProposalTypes.CancelSoftwareUpgrade: - return 'Cancel software upgrade'; - - case ProposalTypes.ClientUpdate: - return 'Client update'; - - case ProposalTypes.ParameterChange: - return 'Parameter change'; - - case ProposalTypes.RegisterCoin: - return 'Register coin'; - - case ProposalTypes.RegisterERC20: - return 'Register ERC20'; - - default: - return type; - } -} +import { + ProposalTypes, + useGetProposalTypeText, +} from './hooks/useGetProposalTypeText'; function ShowDateToggleButton({ onClick }: { onClick: () => void }) { + const { t } = useTranslate('governance'); return (
- {getProposalTypeText(proposalDetails.content['@type'])} + {useGetProposalTypeText(proposalDetails.content['@type'])}
@@ -431,7 +402,7 @@ export function ProposalDetailsComponent({
- Info + {t('info', 'Info')}
@@ -444,7 +415,7 @@ export function ProposalDetailsComponent({
*/}
- + {formatNumber(totalDeposit)}{' '} {symbol.toLocaleUpperCase()} @@ -452,7 +423,7 @@ export function ProposalDetailsComponent({
- Description + {t('description', 'Description')}
- Dates + {t('dates', 'Dates')}
- + {formatDate(new Date(proposalDetails.submit_time))} - + {formatDate(new Date(proposalDetails.deposit_end_time))} {proposalDetails.status !== ProposalStatusEnum.Deposit && ( - + {formatDate( new Date(proposalDetails.voting_start_time), )} - + {formatDate( new Date(proposalDetails.voting_end_time), )} @@ -574,7 +545,7 @@ export function ProposalDetailsComponent({ - Created at (gmt) + {t('created-at', 'Created at (gmt)')} @@ -595,7 +566,7 @@ export function ProposalDetailsComponent({ - Deposit end (gmt) + {t('deposit-end', 'Deposit end (gmt)')} @@ -618,7 +589,7 @@ export function ProposalDetailsComponent({ - Vote start (gmt) + {t('vote-start', 'Vote start (gmt)')} @@ -641,7 +612,7 @@ export function ProposalDetailsComponent({ - Vote end (gmt) + {t('vote-end', 'Vote end (gmt)')} @@ -695,7 +666,7 @@ export function ProposalDetailsComponent({ )} {proposalDetails.status === ProposalStatusEnum.Voting && @@ -703,7 +674,7 @@ export function ProposalDetailsComponent({ )}
@@ -839,19 +810,20 @@ function ProposalActionsMobile({ isCanVote?: boolean; userVote?: string | null; }) { + const { t } = useTranslate('common'); if (!isConnected) { return (
- You should connect wallet first + {t('connect-wallet-message', 'You should connect wallet first')}
@@ -892,6 +864,7 @@ function ProposalActionsMobile({ } function ProposalInfo({ proposalId }: { proposalId: string }) { + const { t } = useTranslate('governance'); const { data: proposalDetails, isFetched } = useProposalDetailsQuery(proposalId); const { data: proposalTally } = useProposalTallyQuery(proposalId); @@ -911,7 +884,7 @@ function ProposalInfo({ proposalId }: { proposalId: string }) {
- Fetching proposal details + {t('fetching-proposal-details', 'Fetching proposal details')}
) : ( @@ -926,12 +899,13 @@ function ProposalInfo({ proposalId }: { proposalId: string }) { } export function ProposalDetailsPage({ proposalId }: { proposalId: string }) { + const { t } = useTranslate('common'); return (
- Governance + {t('governance', 'Governance')}
@@ -948,6 +922,7 @@ export function VoteActions({ proposalId: number; userVote?: string | null; }) { + const { t } = useTranslate('governance'); const { vote, getVoteEstimatedFee } = useProposalActions(); const toast = useToast(); const { executeIfNetworkSupported } = useNetworkAwareAction(); @@ -973,7 +948,11 @@ export function VoteActions({ ); await toast.promise(votePromise, { - loading: Vote in progress, + loading: ( + + {t('vote-in-progress', 'Vote in progress')} + + ), success: (tx) => { console.log('Vote successful', { tx }); const txHash = tx?.txhash; @@ -981,7 +960,9 @@ export function VoteActions({ return (
-
Your vote will be counted!!!
+
+ {t('vote-will-count', 'Your vote will be counted!!!')} +
{ console.error(error); - return For some reason your vote failed.; + return ( + + {t('vote-fail-error', 'For some reason your vote failed.')} + + ); }, }); posthog.capture('vote success', { chainId }); @@ -1016,6 +1001,7 @@ export function VoteActions({ memo, posthog, proposalId, + t, toast, vote, ], @@ -1028,9 +1014,14 @@ export function VoteActions({ return (
- Cast your vote + + {t('cast-vote', 'Cast your vote')} +
- You can change your vote while the voting is in progress + {t( + 'change-vote-message', + 'You can change your vote while the voting is in progress', + )}
@@ -1042,7 +1033,7 @@ export function VoteActions({ setMemoVisible(true); }} > - Add memo + {t('add-memo', 'Add memo')}
) : ( @@ -1059,7 +1050,7 @@ export function VoteActions({ 'rounded-[6px] bg-[#252528]', 'disabled:cursor-not-allowed', )} - placeholder="Add your memo" + placeholder={t('add-your-memo', 'Add your memo')} autoFocus />
@@ -1079,7 +1070,7 @@ export function VoteActions({ voteOptionFromJSON(userVote) === VoteOption.VOTE_OPTION_YES } > - Yes + {t('vote-option-yes', 'Yes')}
@@ -1095,7 +1086,7 @@ export function VoteActions({ voteOptionFromJSON(userVote) === VoteOption.VOTE_OPTION_NO } > - No + {t('vote-option-no', 'No')}
@@ -1111,7 +1102,7 @@ export function VoteActions({ voteOptionFromJSON(userVote) === VoteOption.VOTE_OPTION_ABSTAIN } > - Abstain + {t('vote-option-abstain', 'Abstain')}
@@ -1128,7 +1119,7 @@ export function VoteActions({ VoteOption.VOTE_OPTION_NO_WITH_VETO } > - Veto + {t('vote-option-veto', 'Veto')}
@@ -1145,6 +1136,7 @@ export function DepositActionsDesktop({ onDepositSubmit: (depositAmount: number) => void; isConnected: boolean; }) { + const { t } = useTranslate('governance'); const [depositAmount, setDepositAmount] = useState( undefined, ); @@ -1160,10 +1152,13 @@ export function DepositActionsDesktop({
- Enter the amount you want to deposit + {t('enter-deposit-message', 'Enter the amount you want to deposit')}
- You balance: {balance.toLocaleString()} {symbol.toLocaleUpperCase()} + {t('your-balance', 'Your balance: {balance} {symbol}', { + balance: balance.toLocaleString(), + symbol: symbol.toLocaleUpperCase(), + })}
@@ -1183,7 +1178,7 @@ export function DepositActionsDesktop({ !isConnected || (depositAmount && depositAmount === 0), )} > - Deposit + {t('deposit', 'Deposit')}
@@ -1201,11 +1196,12 @@ export function DepositInput({ value: number | undefined; disabled?: boolean; }) { + const { t } = useTranslate('governance'); return (
- If the proposal does not collect the required number of deposits in a - certain time, it will reject + {t( + 'proposal-deposit-alert', + 'If the proposal does not collect the required number of deposits in a certain time, it will reject', + )} ); } diff --git a/libs/governance/src/lib/proposal-list-page.tsx b/libs/governance/src/lib/proposal-list-page.tsx index 290c13d37..c0d7530c5 100644 --- a/libs/governance/src/lib/proposal-list-page.tsx +++ b/libs/governance/src/lib/proposal-list-page.tsx @@ -1,6 +1,7 @@ 'use client'; import { useMemo } from 'react'; import { ProposalStatus } from '@evmos/provider'; +import { useTranslate } from '@tolgee/react'; import Link from 'next/link'; import { formatVoteResults, @@ -15,6 +16,7 @@ import { Container, SpinnerLoader } from '@haqq/shell-ui-kit/server'; import { ProposalListCard } from './components/proposal-list-card'; export function ProposalListPage() { + const { t } = useTranslate(); const { data: govParams } = useGovernanceParamsQuery(); const { data: proposalsData } = useProposalListQuery(); const symbol = 'ISLM'; @@ -100,7 +102,7 @@ export function ProposalListPage() {
- Governance + {t('governance-title', 'Governance', { ns: 'common' })}
@@ -113,7 +115,9 @@ export function ProposalListPage() {
- Fetching proposals + {t('fetching-proposals', 'Fetching proposals', { + ns: 'governance', + })}
diff --git a/package.json b/package.json index 4b65cbb0f..02ac36ff7 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,7 @@ "format": "pnpm exec prettier --write '**/*.{ts,js,tsx,jsx,cjs,mjs,css,json,md,mdx,html,yaml,yml}'", "prepare": "pnpm exec husky", "tolgee": "pnpm exec tolgee --config ./apps/shell/.tolgeerc.js", + "tolgee:sync": "pnpm exec tolgee sync --config ./apps/shell/.tolgeerc.js", "tolgee:pull": "pnpm exec tolgee pull --config ./apps/shell/.tolgeerc.js", "tolgee:push": "pnpm exec tolgee push --config ./apps/shell/.tolgeerc.js", "tolgee:extract:check": "pnpm exec tolgee extract check --config ./apps/shell/.tolgeerc.js", From 47e67b71582b245de8d37a9f880b4a21f3c095e8 Mon Sep 17 00:00:00 2001 From: Viktoryia Date: Wed, 6 Nov 2024 07:58:36 +0100 Subject: [PATCH 13/22] refactor(i18n): improve translation strings formatting and consistency (#988) * fix: auth to authz Signed-off-by: viktoriabakun * refactor: join translation strings Signed-off-by: viktoriabakun * feat: sync translation keys Signed-off-by: viktoriabakun * fix: lowercase 'show inactive' checkbox Signed-off-by: viktoriabakun --------- Signed-off-by: viktoriabakun --- apps/shell/messages/en.json | 138 +++++++++++++++++- libs/authz/src/lib/authz-grants-actions.tsx | 14 +- .../src/lib/components/statistics-block.tsx | 16 +- .../src/lib/components/staking-stats.tsx | 6 +- .../src/lib/components/validator-info.tsx | 6 +- .../src/lib/components/validator-list.tsx | 2 +- 6 files changed, 160 insertions(+), 22 deletions(-) diff --git a/apps/shell/messages/en.json b/apps/shell/messages/en.json index 718a23c92..cc9c9d7de 100644 --- a/apps/shell/messages/en.json +++ b/apps/shell/messages/en.json @@ -28,7 +28,8 @@ "six-months": "6 months", "one-year": "1 year", "five-years": "5 years", - "hundred-years": "100 years" + "hundred-years": "100 years", + "granter": "Granter" }, "common": { "address-label": "Address", @@ -37,13 +38,28 @@ "connect-wallet-message": "You should connect wallet first", "connect-wallet-button": "Connect wallet", "governance": "Governance", - "staking": "Staking", "delegate": "Delegate", - "undelegate": "Undelegate", - "redelegate": "Redelegate", "cancel-button": "Cancel", "confirm-button": "Confirm", - "send-button": "Send" + "address": "Address", + "add-your-memo": "Add your memo", + "balance": "Balance", + "connect-wallet-btn": "Connect wallet", + "governance-title": "Governance", + "grant-access": "Grant access", + "grantee-address": "Grantee address", + "grant-loading": "Grant in progress", + "grant-period": "Grant period", + "grant-success": "Grant successful", + "grant-type": "Grant type", + "invalid-grantee-wallet-message": "You should enter valid grantee wallet to see info", + "memo": "Memo", + "nothing-found": "Nothing found", + "redelegate": "Redelegate", + "selected-grantee": "Selected grantee", + "send-button": "Send", + "staking": "Staking", + "undelegate": "Undelegate" }, "governance": { "add-memo": "Add memo", @@ -90,10 +106,118 @@ "voting-end": "Voting end", "your-balance": "Your balance: {{balance}} {{symbol}}" }, - "main": {}, + "main": { + "available-for-stake": "Available: {{amount}}", + "locked": "Locked: {{amount}}", + "active-out-of-total": "{{active}} out of {{total}}", + "accounts": "Accounts", + "active-validators": "Active validators", + "available-staking": "Available for staking", + "fee": "Fee", + "fetching-proposals": "Fetching proposals", + "fetching-validators": "Fetching validators list", + "latest-proposals": "Latest proposals", + "link-to-governance": "Go to Governance", + "link-to-staking": "Go to Staking", + "liquid-stacked": "Liquid STAKED", + "my-account": "My account", + "my-delegations": "My delegations", + "name": "Name", + "no-delegations": "You don't have any active delegations", + "regular-stacked": "Regular STAKED", + "rewards": "Rewards", + "shell-title": "Shell", + "staked": "Staked", + "staking-balance-popup-message": "In regular staking you can use coins in liquid staking", + "status": "Status", + "total-stacked": "Total staked", + "total-supply": "Total supply", + "voting-power": "Voting power" + }, "staking": { "attention-withdrawal-warning": "Attention! If in the future you want to withdraw the staked funds, it will take {{count}} day{count, plural, one {} other {s}}", - "funds-undelegated-in-days": "The funds will be undelegated within {count, plural, one {# day} other {# days}}" + "funds-undelegated-in-days": "The funds will be undelegated within {count, plural, one {# day} other {# days}}", + "min-amount-to-claim-rewards": "Minimum amount to claim rewards is {{amount}} ISLM", + "active-status": "Active", + "add-memo": "Add memo", + "address": "Address", + "amount-error-min": "Bellow minimal value", + "amount-error-more-than-delegation": "More than your delegation", + "amount-error-more-than-have": "More than you have", + "annualized-yield": "Annual percentage yield", + "apy": "APY", + "available": "Available", + "claim-all-rewards": "Claim all rewards", + "comission": "Commission", + "commission": "Commission", + "confirm-delegation": "Confirm delegation", + "confirm-redelegation": "Confirm redelegation", + "confirm-undelegation": "Confirm undelegation", + "current": "Current", + "delegate": "Delegate", + "delegate-title": "Delegate", + "delegation-declined": "Delegation declined", + "delegation-progress": "Delegation in progress", + "delegation-success": "Delegation successful", + "description": "Description", + "email": "E-mail", + "estimated-fee": "Estimated fee", + "explorer-link": "Explorer link", + "fee": "Fee", + "fee-asc": "By fee (a-z)", + "fee-desc": "By fee (z-a)", + "fetching-validators-message": "Fetching validators list", + "get-my-rewards": "Get my rewards", + "get-rewards": "Get rewards", + "inactive-status": "Inactive", + "info": "Info", + "jailed-status": "Jailed", + "liquid-staking": "Liquid staking", + "max": "Max", + "max-change": "Max Change", + "memo-placeholder": "Add your memo", + "my-balance": "My balance", + "my-delegation": "My delegation", + "my-delegations": "My delegations", + "my-rewards": "My rewards", + "my-stake": "My stake", + "name": "Name", + "name-asc": "By name (a-z)", + "name-desc": "By name (z-a)", + "power-asc": "By power (a-z)", + "power-desc": "By power (z-a)", + "random": "Random", + "redelegate": "Redelegate", + "redelegate-amount": "Redelegation amount", + "redelegate-progress": "Redelegate in progress", + "redelegate-success": "Redelegation successful", + "regular-staking": "Regular staking", + "reward": "Reward", + "rewards": "Rewards", + "rewards-claimed": "Rewards claimed", + "rewards-claim-in-progress": "Rewards claim in progress", + "rewards-progress": "Rewards claim in progress", + "select-new-validator": "Select new validator", + "show-inactive": "Show inactive", + "sort-by": "Sorting by", + "stacked": "Staked", + "staked": "Staked", + "status": "Status", + "stISLM-in-ISLM": "stISLM in ISLM", + "stride-address-required": "Stride address is required to delegate", + "unbonding": "Unbonding", + "undelegate": "Undelegate", + "undelegate-process": "Undelegate in process", + "undelegation-declined": "Undelegation declined", + "undelegation-progress": "Undelegation in progress", + "undelegation-success": "Undelegation successful", + "validator": "Validator", + "validator-inactive-warning": "While the validator is inactive, you will not be able to receive a reward.", + "validator-info-loading": "Fetching validator information", + "validators": "Validators", + "voting-power": "Voting power", + "website": "Website", + "you-will-get": "What you'll get:" }, "uc-dao": { "dao-page-title": "UnitedContributors DAO", diff --git a/libs/authz/src/lib/authz-grants-actions.tsx b/libs/authz/src/lib/authz-grants-actions.tsx index bb3042385..4a7ab2355 100644 --- a/libs/authz/src/lib/authz-grants-actions.tsx +++ b/libs/authz/src/lib/authz-grants-actions.tsx @@ -76,31 +76,31 @@ export function AuthzGrantsActions() { const GRANT_PERIOD_OPTIONS = [ { - label: t('one-week', '1 Week', { ns: 'auth' }), + label: t('one-week', '1 Week', { ns: 'authz' }), value: '1w', }, { - label: t('one-month', '1 Month', { ns: 'auth' }), + label: t('one-month', '1 Month', { ns: 'authz' }), value: '1m', }, { - label: t('three-months', '3 Months', { ns: 'auth' }), + label: t('three-months', '3 Months', { ns: 'authz' }), value: '3m', }, { - label: t('six-months', '6 Months', { ns: 'auth' }), + label: t('six-months', '6 Months', { ns: 'authz' }), value: '6m', }, { - label: t('one-year', '1 Year', { ns: 'auth' }), + label: t('one-year', '1 Year', { ns: 'authz' }), value: '1y', }, { - label: t('five-years', '5 Years', { ns: 'auth' }), + label: t('five-years', '5 Years', { ns: 'authz' }), value: '5y', }, { - label: t('hundred-years', '100 Years', { ns: 'auth' }), + label: t('hundred-years', '100 Years', { ns: 'authz' }), value: '100y', }, ]; diff --git a/libs/main/src/lib/components/statistics-block.tsx b/libs/main/src/lib/components/statistics-block.tsx index 3145aa53a..72673bfc7 100644 --- a/libs/main/src/lib/components/statistics-block.tsx +++ b/libs/main/src/lib/components/statistics-block.tsx @@ -1,5 +1,5 @@ import { useMemo } from 'react'; -import { useTranslate } from '@tolgee/react'; +import { T, useTranslate } from '@tolgee/react'; import { useChainStatsQuery } from '@haqq/shell-shared'; import { formatNumber, formatPercents } from '@haqq/shell-ui-kit/server'; @@ -79,10 +79,16 @@ export function StatisticsBlock() {
{!isFetching && (
- {valsActive} - -  {t('out of', 'out of')} {valsTotal} - + , + }} + />
)}
diff --git a/libs/staking/src/lib/components/staking-stats.tsx b/libs/staking/src/lib/components/staking-stats.tsx index 53283db4e..a6a7bb9e3 100644 --- a/libs/staking/src/lib/components/staking-stats.tsx +++ b/libs/staking/src/lib/components/staking-stats.tsx @@ -123,7 +123,11 @@ export function StakingStatsDesktop({ diff --git a/libs/staking/src/lib/components/validator-info.tsx b/libs/staking/src/lib/components/validator-info.tsx index 6542635bc..6076f6b4d 100644 --- a/libs/staking/src/lib/components/validator-info.tsx +++ b/libs/staking/src/lib/components/validator-info.tsx @@ -908,7 +908,11 @@ export function ValidatorBlockDesktop({ diff --git a/libs/staking/src/lib/components/validator-list.tsx b/libs/staking/src/lib/components/validator-list.tsx index ec5b89c3f..a3ba87e81 100644 --- a/libs/staking/src/lib/components/validator-list.tsx +++ b/libs/staking/src/lib/components/validator-list.tsx @@ -171,8 +171,8 @@ export function ValidatorList({
)} - {/* TODO: how to translate such errors if they come from BE?*/} {status === 'error' && ( + // eslint-disable-next-line i18next/no-literal-string

Error: {error?.message ?? 'unknown error'}

)} From dbc713142f54c5b77c0d2f00b0b9acabf9d240d0 Mon Sep 17 00:00:00 2001 From: Viktoryia Date: Wed, 6 Nov 2024 10:26:09 +0100 Subject: [PATCH 14/22] feat(faucet): use tolgee for translation (#991) * feat: add faucet namespace Signed-off-by: viktoriabakun * feat(faucet): use tolgee keys Signed-off-by: viktoriabakun * feat(faucet): extract tolgee keys Signed-off-by: viktoriabakun --------- Signed-off-by: viktoriabakun --- apps/shell/messages/ar.json | 1 + apps/shell/messages/en.json | 12 +++++++++ apps/shell/messages/id.json | 1 + apps/shell/messages/tr.json | 1 + apps/shell/src/tolgee/shared.ts | 4 ++- .../src/lib/components/account-info.tsx | 18 +++++++++---- libs/faucet/src/lib/faucet-page.tsx | 25 ++++++++++++------- 7 files changed, 47 insertions(+), 15 deletions(-) diff --git a/apps/shell/messages/ar.json b/apps/shell/messages/ar.json index 2e8ab6b9f..fa3d96e9c 100644 --- a/apps/shell/messages/ar.json +++ b/apps/shell/messages/ar.json @@ -1,6 +1,7 @@ { "authz": {}, "common": {}, + "faucet": {}, "governance": {}, "main": {}, "staking": {}, diff --git a/apps/shell/messages/en.json b/apps/shell/messages/en.json index cc9c9d7de..0615f6759 100644 --- a/apps/shell/messages/en.json +++ b/apps/shell/messages/en.json @@ -35,6 +35,7 @@ "address-label": "Address", "copied": "Copied!", "click-to-copy": "Click to copy", + "click-to-copy-address": "Click to copy {{address}}", "connect-wallet-message": "You should connect wallet first", "connect-wallet-button": "Connect wallet", "governance": "Governance", @@ -61,6 +62,17 @@ "staking": "Staking", "undelegate": "Undelegate" }, + "faucet": { + "switch-chain": "Switch to {{chain}}", + "claim-tokens": "Claim tokens", + "faucet": "Faucet", + "github": "Github", + "login-github": "Login with github", + "next-token-request-available": "Next request tokens available after", + "request-tokens": "Request tokens", + "tokens-claimed": "Tokens claimed", + "wallet": "Wallet" + }, "governance": { "add-memo": "Add memo", "add-your-memo": "Add your memo", diff --git a/apps/shell/messages/id.json b/apps/shell/messages/id.json index 2e8ab6b9f..fa3d96e9c 100644 --- a/apps/shell/messages/id.json +++ b/apps/shell/messages/id.json @@ -1,6 +1,7 @@ { "authz": {}, "common": {}, + "faucet": {}, "governance": {}, "main": {}, "staking": {}, diff --git a/apps/shell/messages/tr.json b/apps/shell/messages/tr.json index 2e8ab6b9f..fa3d96e9c 100644 --- a/apps/shell/messages/tr.json +++ b/apps/shell/messages/tr.json @@ -1,6 +1,7 @@ { "authz": {}, "common": {}, + "faucet": {}, "governance": {}, "main": {}, "staking": {}, diff --git a/apps/shell/src/tolgee/shared.ts b/apps/shell/src/tolgee/shared.ts index 6d1b9354e..a540d7897 100644 --- a/apps/shell/src/tolgee/shared.ts +++ b/apps/shell/src/tolgee/shared.ts @@ -18,7 +18,8 @@ export type Namespace = | 'main' | 'staking' | 'governance' - | 'authz'; + | 'authz' + | 'faucet'; export const ALL_NAMESPACES: Namespace[] = [ 'common', 'utils', @@ -27,6 +28,7 @@ export const ALL_NAMESPACES: Namespace[] = [ 'staking', 'governance', 'authz', + 'faucet', ]; export const DEFAULT_LOCALE = 'en'; diff --git a/libs/faucet/src/lib/components/account-info.tsx b/libs/faucet/src/lib/components/account-info.tsx index 3c244d297..b7cc33783 100644 --- a/libs/faucet/src/lib/components/account-info.tsx +++ b/libs/faucet/src/lib/components/account-info.tsx @@ -1,5 +1,6 @@ 'use client'; import { PropsWithChildren, useCallback, useState } from 'react'; +import { useTranslate } from '@tolgee/react'; import { getFormattedAddress, useAddress, @@ -26,6 +27,7 @@ export function MyAccountCardBlock({ } export function AccountInfo() { + const { t } = useTranslate('common'); const { ethAddress, haqqAddress } = useAddress(); const { copyText } = useClipboard(); const { data: balance } = useIndexerBalanceQuery(haqqAddress); @@ -58,12 +60,16 @@ export function AccountInfo() {
{ethAddress && (
- +
+
{formatNumber(balance.balance)} ISLM
diff --git a/libs/faucet/src/lib/faucet-page.tsx b/libs/faucet/src/lib/faucet-page.tsx index b43cb1fb1..375289822 100644 --- a/libs/faucet/src/lib/faucet-page.tsx +++ b/libs/faucet/src/lib/faucet-page.tsx @@ -8,6 +8,7 @@ import { useState, } from 'react'; import { useAuth0 } from '@auth0/auth0-react'; +import { useTranslate } from '@tolgee/react'; import clsx from 'clsx'; import { notFound } from 'next/navigation'; import SuccessIndicator from 'react-success-indicator'; @@ -38,6 +39,7 @@ export function FaucetPage({ serviceEndpoint: string; reCaptchaSiteKey: string; }): ReactElement { + const { t } = useTranslate('faucet'); const chains = useChains(); const { chain = chains[0] } = useAccount(); const { switchChainAsync } = useSwitchChain(); @@ -182,7 +184,7 @@ export function FaucetPage({
- Faucet + {t('faucet', 'Faucet')}
@@ -202,7 +204,7 @@ export function FaucetPage({
- Wallet + {t('wallet', 'Wallet')}
@@ -211,7 +213,9 @@ export function FaucetPage({ className="font-clash mb-[-2px] text-end !text-[12px] uppercase" onClick={handleNetworkSwitch} > - Switch to {chain.name} + {t('switch-chain', 'Switch to {chain}', { + chain: chain.name, + })} )}
@@ -256,7 +260,7 @@ export function FaucetPage({ - Github + {t('github', 'Github')}
@@ -284,7 +288,7 @@ export function FaucetPage({ disabled={isAuth0Loading} variant={2} > - Login with github + {t('login-github', 'Login with github')} )}
@@ -295,7 +299,7 @@ export function FaucetPage({
- Claim tokens + {t('claim-tokens', 'Claim tokens')}
@@ -314,7 +318,7 @@ export function FaucetPage({ className="w-full" onClick={handleRequestTokens} > - Request tokens + {t('request-tokens', 'Request tokens')}
) : ( @@ -333,7 +337,7 @@ export function FaucetPage({

- Tokens claimed! + {t('tokens-claimed', 'Tokens claimed')}

)} @@ -344,7 +348,10 @@ export function FaucetPage({ date={ new Date(Date.now() + claimInfo.next_claim_sec * 1000) } - title="Next request tokens available after" + title={t( + 'next-token-request-available', + 'Next request tokens available after', + )} /> )} From 61d323c90769a2f44c0b446d5057fabe12cdd151 Mon Sep 17 00:00:00 2001 From: Viktoryia Date: Wed, 6 Nov 2024 18:26:45 +0100 Subject: [PATCH 15/22] feat(i18n): extract common ns strings (#990) * feat(common): use tolgee for translation Signed-off-by: viktoriabakun * feat: remove sth-went-wrong key reduction Signed-off-by: viktoriabakun * refactor(i18n): use single braces for vars in translation files Signed-off-by: viktoriabakun * refactor(i18n): click-to-copy join translation string Signed-off-by: viktoriabakun * feat(i18n): sync all keys Signed-off-by: viktoriabakun * refactor(i18n): remove 'staked' duplicates Signed-off-by: viktoriabakun * refactor(i18n): remove 'rewards' duplicates Signed-off-by: viktoriabakun * refactor(i18n): remove 'unbonding' duplicates Signed-off-by: viktoriabakun * refactor(i18n): remove 'undelegate' duplicates Signed-off-by: viktoriabakun * refactor(i18n): remove 'memo' duplicates Signed-off-by: viktoriabakun * refactor(i18n): remove 'add-your-memo' duplicates Signed-off-by: viktoriabakun * refactor(i18n): remove 'available' duplicates Signed-off-by: viktoriabakun * refactor(i18n): remove 'balance' duplicates Signed-off-by: viktoriabakun * refactor(i18n): remove 'claim-all-rewards' duplicates Signed-off-by: viktoriabakun * refactor(i18n): remove 'click-to-copy-value' duplicates Signed-off-by: viktoriabakun * refactor(i18n): remove 'copied' duplicates Signed-off-by: viktoriabakun * refactor(i18n): remove 'delegate' duplicates Signed-off-by: viktoriabakun * refactor(i18n): remove 'grant-access' duplicates Signed-off-by: viktoriabakun * refactor(i18n): remove 'min-amount-to-claim-rewards' duplicates Signed-off-by: viktoriabakun * refactor(i18n): remove 'my-account' duplicates Signed-off-by: viktoriabakun * refactor(i18n): remove 'redelegate' duplicates Signed-off-by: viktoriabakun * refactor(i18n): remove 'add-memo' duplicates Signed-off-by: viktoriabakun * refactor(i18n): remove 'amount-error-min' duplicates Signed-off-by: viktoriabakun * refactor(i18n): remove 'confirm-delegation' duplicates Signed-off-by: viktoriabakun * refactor(i18n): remove 'amount-error-more-than-have' duplicates Signed-off-by: viktoriabakun * refactor(i18n): remove 'deposit' duplicates Signed-off-by: viktoriabakun * refactor(i18n): remove 'description' duplicates Signed-off-by: viktoriabakun * refactor(i18n): remove 'fetching-proposals' duplicates Signed-off-by: viktoriabakun * refactor(i18n): remove 'info' duplicates Signed-off-by: viktoriabakun * refactor(i18n): remove 'my-balance' duplicates Signed-off-by: viktoriabakun * refactor(i18n): remove 'fee' duplicates Signed-off-by: viktoriabakun * refactor(i18n): remove 'my-delegations' duplicates Signed-off-by: viktoriabakun * refactor(i18n): remove 'name' duplicates Signed-off-by: viktoriabakun * refactor(i18n): remove 'status' duplicates Signed-off-by: viktoriabakun * refactor(i18n): remove 'voting-power' duplicates Signed-off-by: viktoriabakun * refactor(i18n): remove 'address' duplicates Signed-off-by: viktoriabakun --------- Signed-off-by: viktoriabakun --- apps/shell/messages/en.json | 149 +++++++----------- apps/shell/src/app/[locale]/error.tsx | 8 +- apps/shell/src/app/[locale]/not-found.tsx | 6 +- apps/shell/src/app/global-error.tsx | 8 +- .../src/components/web3-connect-button.tsx | 13 +- .../src/lib/address-conversion-page.tsx | 9 +- libs/authz/src/lib/authz-grants-actions.tsx | 32 ++-- libs/authz/src/lib/grantee-card.tsx | 18 ++- .../src/lib/components/account-info.tsx | 20 +-- .../lib/components/proposal-deposit-modal.tsx | 18 ++- .../src/lib/proposal-details-page.tsx | 98 ++++++++---- .../governance/src/lib/proposal-list-page.tsx | 4 +- .../src/lib/components/delegation-list.tsx | 12 +- .../src/lib/components/delegations-block.tsx | 14 +- .../src/lib/components/my-account-block.tsx | 18 ++- .../lib/components/proposal-list-block.tsx | 8 +- .../src/lib/components/statistics-block.tsx | 2 +- .../src/lib/components/delegate-modal.tsx | 27 ++-- .../src/lib/components/redelegate-modal.tsx | 24 ++- .../src/lib/components/staking-info.tsx | 2 +- .../src/lib/components/staking-stats.tsx | 36 +++-- .../stride/liquid-staking-delegate-modal.tsx | 27 ++-- .../liquid-staking-undelegate-modal.tsx | 6 +- .../stride/statistics/stride-stats.tsx | 8 +- .../src/lib/components/undelegate-modal.tsx | 39 +++-- .../lib/components/validator-block-mobile.tsx | 29 ++-- .../src/lib/components/validator-info.tsx | 47 +++--- .../lib/components/validator-list-desktop.tsx | 16 +- .../components/validator-list-item-mobile.tsx | 22 +-- .../src/lib/components/validator-list.tsx | 49 ++++-- libs/ucdao/src/lib/ucdao-fund-modal.tsx | 22 ++- libs/ucdao/src/lib/ucdao-page-balance.tsx | 2 +- libs/ucdao/src/lib/ucdao-transfer-form.tsx | 2 +- libs/ui-kit/src/lib/account-button.tsx | 4 +- .../src/lib/my-account-block-desktop.tsx | 33 ++-- .../src/lib/my-account-block-mobile.tsx | 20 ++- 36 files changed, 512 insertions(+), 340 deletions(-) diff --git a/apps/shell/messages/en.json b/apps/shell/messages/en.json index 0615f6759..1eb38b2b7 100644 --- a/apps/shell/messages/en.json +++ b/apps/shell/messages/en.json @@ -9,17 +9,6 @@ "message": "Message", "valid-thru": "Valid thru", "selected-grantee": "Selected grantee", - "staked": "Staked", - "rewards": "Rewards", - "unbonding": "Unbonding", - "grant-access": "Grant access", - "grantee-address": "Grantee address", - "grant-type": "Grant type", - "grant-period": "Grant period", - "memo": "Memo", - "add-your-memo": "Add your memo", - "grant-access-button": "Grant Access", - "invalid-grantee-wallet-message": "You should enter valid grantee wallet to see info", "submit-proposal": "Submit proposal", "vote": "Vote", "one-week": "1 week", @@ -32,66 +21,76 @@ "granter": "Granter" }, "common": { - "address-label": "Address", - "copied": "Copied!", - "click-to-copy": "Click to copy", - "click-to-copy-address": "Click to copy {{address}}", - "connect-wallet-message": "You should connect wallet first", - "connect-wallet-button": "Connect wallet", - "governance": "Governance", - "delegate": "Delegate", - "cancel-button": "Cancel", - "confirm-button": "Confirm", "address": "Address", + "add-memo": "Add memo", "add-your-memo": "Add your memo", + "amount-error-min": "Bellow minimal value", + "amount-error-more-than-have": "More than you have", + "available": "Available", "balance": "Balance", - "connect-wallet-btn": "Connect wallet", - "governance-title": "Governance", + "cancel-button": "Cancel", + "claim-all-rewards": "Claim all rewards", + "click-to-copy-value": "Click to copy {value}", + "confirm-button": "Confirm", + "confirm-delegation": "Confirm delegation", + "connect-wallet-button": "Connect wallet", + "connect-wallet-message": "You should connect wallet first", + "copied": "Copied!", + "delegate": "Delegate", + "deposit": "Deposit", + "description": "Description", + "disconnect": "Disconnect", + "fee": "Fee", + "fetching-proposals": "Fetching proposals", + "governance": "Governance", "grant-access": "Grant access", "grantee-address": "Grantee address", "grant-loading": "Grant in progress", "grant-period": "Grant period", "grant-success": "Grant successful", "grant-type": "Grant type", + "hide-info": "Hide Info", + "info": "Info", "invalid-grantee-wallet-message": "You should enter valid grantee wallet to see info", "memo": "Memo", + "min-amount-to-claim-rewards": "Minimum amount to claim rewards is {amount} ISLM", + "my-account": "My account", + "my-balance": "My balance", + "my-delegations": "My delegations", + "name": "Name", "nothing-found": "Nothing found", "redelegate": "Redelegate", + "rewards": "Rewards", "selected-grantee": "Selected grantee", "send-button": "Send", + "show-info": "Show Info", + "staked": "Staked", "staking": "Staking", - "undelegate": "Undelegate" + "status": "Status", + "unbonding": "Unbonding", + "undelegate": "Undelegate", + "voting-power": "Voting power" }, "faucet": { - "switch-chain": "Switch to {{chain}}", "claim-tokens": "Claim tokens", "faucet": "Faucet", "github": "Github", "login-github": "Login with github", "next-token-request-available": "Next request tokens available after", "request-tokens": "Request tokens", + "switch-chain": "Switch to {chain}", "tokens-claimed": "Tokens claimed", "wallet": "Wallet" }, "governance": { - "add-memo": "Add memo", - "add-your-memo": "Add your memo", - "amount-error-min": "Bellow minimal value", - "amount-error-more-than-have": "More than you have", "cast-vote": "Cast your vote", "change-vote-message": "You can change your vote while the voting is in progress", - "confirm-delegation": "Confirm delegation", "created-at": "Created at (gmt)", "dates": "Dates", - "deposit": "Deposit", "deposit-end": "Deposit end", - "description": "Description", "enter-amount": "Enter Amount", "enter-deposit-message": "Enter the amount you want to deposit", "fetching-proposal-details": "Fetching proposal details", - "fetching-proposals": "Fetching proposals", - "info": "Info", - "my-balance": "My balance", "parameter-changes": "Parameter changes", "proposal-deposit-alert": "If the proposal does not collect the required number of deposits in a certain time, it will reject", "proposal-types": { @@ -116,109 +115,76 @@ "vote-start": "Vote start (gmt)", "vote-will-count": "Your vote will be counted!!!", "voting-end": "Voting end", - "your-balance": "Your balance: {{balance}} {{symbol}}" + "your-balance": "Your balance: {balance} {symbol}" }, "main": { - "available-for-stake": "Available: {{amount}}", - "locked": "Locked: {{amount}}", - "active-out-of-total": "{{active}} out of {{total}}", "accounts": "Accounts", + "active-out-of-total": "{active} out of {total}", "active-validators": "Active validators", + "available-for-stake": "Available: {amount}", "available-staking": "Available for staking", - "fee": "Fee", - "fetching-proposals": "Fetching proposals", "fetching-validators": "Fetching validators list", "latest-proposals": "Latest proposals", "link-to-governance": "Go to Governance", "link-to-staking": "Go to Staking", - "liquid-stacked": "Liquid STAKED", - "my-account": "My account", - "my-delegations": "My delegations", - "name": "Name", + "liquid-staked": "Liquid STAKED", + "locked": "Locked: {amount}", "no-delegations": "You don't have any active delegations", - "regular-stacked": "Regular STAKED", - "rewards": "Rewards", + "regular-staked": "Regular STAKED", "shell-title": "Shell", - "staked": "Staked", "staking-balance-popup-message": "In regular staking you can use coins in liquid staking", - "status": "Status", - "total-stacked": "Total staked", - "total-supply": "Total supply", - "voting-power": "Voting power" + "total-staked": "Total staked", + "total-supply": "Total supply" }, "staking": { - "attention-withdrawal-warning": "Attention! If in the future you want to withdraw the staked funds, it will take {{count}} day{count, plural, one {} other {s}}", - "funds-undelegated-in-days": "The funds will be undelegated within {count, plural, one {# day} other {# days}}", - "min-amount-to-claim-rewards": "Minimum amount to claim rewards is {{amount}} ISLM", + "attention-withdrawal-warning": "Attention! If in the future you want to withdraw the staked funds, it will take {count} day{count, plural, one {} other {s}}", "active-status": "Active", - "add-memo": "Add memo", - "address": "Address", - "amount-error-min": "Bellow minimal value", "amount-error-more-than-delegation": "More than your delegation", - "amount-error-more-than-have": "More than you have", "annualized-yield": "Annual percentage yield", "apy": "APY", - "available": "Available", - "claim-all-rewards": "Claim all rewards", - "comission": "Commission", "commission": "Commission", - "confirm-delegation": "Confirm delegation", "confirm-redelegation": "Confirm redelegation", "confirm-undelegation": "Confirm undelegation", "current": "Current", - "delegate": "Delegate", - "delegate-title": "Delegate", "delegation-declined": "Delegation declined", "delegation-progress": "Delegation in progress", "delegation-success": "Delegation successful", - "description": "Description", "email": "E-mail", "estimated-fee": "Estimated fee", "explorer-link": "Explorer link", - "fee": "Fee", "fee-asc": "By fee (a-z)", "fee-desc": "By fee (z-a)", "fetching-validators-message": "Fetching validators list", + "funds-undelegated-in-days": "The funds will be undelegated within {count, plural, one {# day} other {# days}}", "get-my-rewards": "Get my rewards", "get-rewards": "Get rewards", "inactive-status": "Inactive", - "info": "Info", "jailed-status": "Jailed", "liquid-staking": "Liquid staking", "max": "Max", "max-change": "Max Change", "memo-placeholder": "Add your memo", - "my-balance": "My balance", "my-delegation": "My delegation", - "my-delegations": "My delegations", "my-rewards": "My rewards", "my-stake": "My stake", - "name": "Name", "name-asc": "By name (a-z)", "name-desc": "By name (z-a)", "power-asc": "By power (a-z)", "power-desc": "By power (z-a)", "random": "Random", - "redelegate": "Redelegate", "redelegate-amount": "Redelegation amount", "redelegate-progress": "Redelegate in progress", "redelegate-success": "Redelegation successful", "regular-staking": "Regular staking", "reward": "Reward", - "rewards": "Rewards", "rewards-claimed": "Rewards claimed", "rewards-claim-in-progress": "Rewards claim in progress", "rewards-progress": "Rewards claim in progress", "select-new-validator": "Select new validator", "show-inactive": "Show inactive", "sort-by": "Sorting by", - "stacked": "Staked", - "staked": "Staked", - "status": "Status", "stISLM-in-ISLM": "stISLM in ISLM", "stride-address-required": "Stride address is required to delegate", - "unbonding": "Unbonding", - "undelegate": "Undelegate", "undelegate-process": "Undelegate in process", "undelegation-declined": "Undelegation declined", "undelegation-progress": "Undelegation in progress", @@ -227,34 +193,29 @@ "validator-inactive-warning": "While the validator is inactive, you will not be able to receive a reward.", "validator-info-loading": "Fetching validator information", "validators": "Validators", - "voting-power": "Voting power", "website": "Website", "you-will-get": "What you'll get:" }, "uc-dao": { + "address-placeholder": "Address in EVM/Bech32 format", + "amount": "Amount", + "confirm-ownership-transfer": "You confirm you want to transfer coins ownership in DAO", + "currency": "Currency", + "dao-balance-label": "DAO Balance", "dao-page-title": "UnitedContributors DAO", + "deposit-dao": "Deposit to DAO", + "islm-and-liquid-balance": "{balanceNum} ISLM and {tokensNum} LIQUID", "select-wallet-heading": "Select wallet", - "confirm-ownership-transfer": "You confirm you want to transfer coins ownership in DAO", + "token-count": "{count, plural, other {{count} LIQUID tokens}}", "to-the-address": " - to the address {address} ?", - "islm-and-liquid-balance": "{balanceNum} ISLM and {tokensNum} LIQUID", - "token-count": "{{count}} LIQUID token{count, plural, one {} other {s}}", - "deposit-dao": "Deposit to DAO", - "currency": "Currency", - "amount": "Amount", - "deposit": "Deposit", + "transfer-heading": "Transfer coins ownership", "transfer-progress": "Transfer in progress", "transfer-success": "Transfer successful", - "account-heading": "My account", - "wallet-balance-label": "Wallet Balance", - "dao-balance-label": "DAO Balance", - "deposit-to-dao": "Deposit to DAO", - "transfer-heading": "Transfer coins ownership", - "address-placeholder": "Address in EVM/Bech32 format" + "wallet-balance-label": "Wallet Balance" }, "utils": { - "invalid-address": "Please enter a valid address", "address-conversion-title": "Address Conversion", "converted-address-label": "Converted address", - "balance-label": "Balance" + "invalid-address": "Please enter a valid address" } } diff --git a/apps/shell/src/app/[locale]/error.tsx b/apps/shell/src/app/[locale]/error.tsx index 4d63815bb..16279202c 100644 --- a/apps/shell/src/app/[locale]/error.tsx +++ b/apps/shell/src/app/[locale]/error.tsx @@ -1,6 +1,7 @@ 'use client'; import { useEffect } from 'react'; import * as Sentry from '@sentry/nextjs'; +import { useTranslate } from '@tolgee/react'; import { Button } from '@haqq/shell-ui-kit'; import { Container, Heading } from '@haqq/shell-ui-kit/server'; @@ -11,6 +12,7 @@ export default function ErrorPage({ error: Error & { digest?: string }; reset: () => void; }) { + const { t } = useTranslate('common'); useEffect(() => { // Log the error to Sentry Sentry.captureException(error); @@ -19,7 +21,9 @@ export default function ErrorPage({ return (
- Something went wrong! + + {t('something-went-wrong', 'Something went wrong!')} +
diff --git a/apps/shell/src/app/[locale]/not-found.tsx b/apps/shell/src/app/[locale]/not-found.tsx index 079f6ef02..d92f1f10c 100644 --- a/apps/shell/src/app/[locale]/not-found.tsx +++ b/apps/shell/src/app/[locale]/not-found.tsx @@ -1,12 +1,14 @@ 'use client'; +import { useTranslate } from '@tolgee/react'; import { Button } from '@haqq/shell-ui-kit'; import { Heading } from '@haqq/shell-ui-kit/server'; export default function NotFound() { + const { t } = useTranslate('common'); return (
404 - Page not found + {t('page-not-found', 'Page not found')}
diff --git a/apps/shell/src/app/global-error.tsx b/apps/shell/src/app/global-error.tsx index 4e06b06a2..217d81140 100644 --- a/apps/shell/src/app/global-error.tsx +++ b/apps/shell/src/app/global-error.tsx @@ -1,6 +1,7 @@ 'use client'; import { useEffect } from 'react'; import * as Sentry from '@sentry/nextjs'; +import { useTranslate } from '@tolgee/react'; import NextError from 'next/error'; import { Button } from '@haqq/shell-ui-kit'; import { Container, Heading } from '@haqq/shell-ui-kit/server'; @@ -12,6 +13,7 @@ export default function GlobalError({ error: Error & { digest?: string }; reset: () => void; }) { + const { t } = useTranslate('common'); useEffect(() => { Sentry.captureException(error); }, [error]); @@ -21,14 +23,16 @@ export default function GlobalError({
- Something went wrong! + + {t('something-went-wrong', 'Something went wrong!')} +
{/* This is the default Next.js error component but it doesn't allow omitting the statusCode property yet. */} diff --git a/apps/shell/src/components/web3-connect-button.tsx b/apps/shell/src/components/web3-connect-button.tsx index 2844b546f..e2d6b0c6d 100644 --- a/apps/shell/src/components/web3-connect-button.tsx +++ b/apps/shell/src/components/web3-connect-button.tsx @@ -1,4 +1,5 @@ 'use client'; +import { useTranslate } from '@tolgee/react'; import { useAccount, useChains } from 'wagmi'; import { getFormattedAddress, @@ -10,6 +11,7 @@ import { Button, AccountButton, SelectChainButton } from '@haqq/shell-ui-kit'; import { formatNumber } from '@haqq/shell-ui-kit/server'; export function Web3ConnectButtons() { + const { t } = useTranslate('common'); const { isConnected, chain } = useAccount(); const { haqqAddress, ethAddress } = useAddress(); const chains = useChains(); @@ -19,7 +21,9 @@ export function Web3ConnectButtons() { if (!isConnected || !ethAddress) { return (
- +
); } @@ -63,6 +67,7 @@ export function Web3ConnectButtons() { } export function Web3ConnectButtonsMobile() { + const { t } = useTranslate('common'); const { isConnected, chain } = useAccount(); const { haqqAddress, ethAddress } = useAddress(); const chains = useChains(); @@ -72,7 +77,9 @@ export function Web3ConnectButtonsMobile() { if (!isConnected || !ethAddress) { return (
- +
); } @@ -113,7 +120,7 @@ export function Web3ConnectButtonsMobile() { />
- +
); diff --git a/libs/address-conversion/src/lib/address-conversion-page.tsx b/libs/address-conversion/src/lib/address-conversion-page.tsx index 03edda355..df06311a9 100644 --- a/libs/address-conversion/src/lib/address-conversion-page.tsx +++ b/libs/address-conversion/src/lib/address-conversion-page.tsx @@ -113,7 +113,7 @@ export function AddressConversionPage() {
{t('grant-loading', 'Grant in progress')} + + {t('grant-loading', 'Grant in progress', { ns: 'common' })} + ), success: (tx) => { console.log('Grant successful', { tx }); @@ -207,7 +209,9 @@ export function AuthzGrantsActions() { return (
-
{t('grant-success', 'Grant successful')}
+
+ {t('grant-success', 'Grant successful', { ns: 'common' })} +
- {t('grant-access', 'Grant access')} + {t('grant-access', 'Grant access', { ns: 'common' })}
@@ -323,7 +327,9 @@ export function AuthzGrantsActions() { htmlFor="grantee" className="cursor-pointer text-[12px] font-[500] uppercase leading-[24px] text-white/50" > - {t('grantee-address', 'Grantee address')} + {t('grantee-address', 'Grantee address', { + ns: 'common', + })}
@@ -350,7 +356,7 @@ export function AuthzGrantsActions() {
{ if (period) { @@ -382,7 +390,7 @@ export function AuthzGrantsActions() { htmlFor="memo" className="cursor-pointer text-[12px] font-[500] uppercase leading-[24px] text-white/50" > - {t('memo', 'Memo')} + {t('memo', 'Memo', { ns: 'common' })}
@@ -395,7 +403,9 @@ export function AuthzGrantsActions() { 'max-w-xl', )} type="text" - placeholder={t('add-your-memo', 'Add your memo')} + placeholder={t('add-your-memo', 'Add your memo', { + ns: 'common', + })} id="memo" name="memo" value={memo} @@ -414,7 +424,7 @@ export function AuthzGrantsActions() { variant={2} disabled={!isGranteeValid} > - {t('grant-access', 'Grant access')} + {t('grant-access', 'Grant access', { ns: 'common' })}
@@ -434,7 +444,9 @@ export function AuthzGrantsActions() {
- {t('selected-grantee', 'Selected grantee')} + {t('selected-grantee', 'Selected grantee', { + ns: 'common', + })}
diff --git a/libs/authz/src/lib/grantee-card.tsx b/libs/authz/src/lib/grantee-card.tsx index d3d819919..275e52155 100644 --- a/libs/authz/src/lib/grantee-card.tsx +++ b/libs/authz/src/lib/grantee-card.tsx @@ -161,7 +161,7 @@ export function GranteeCard({
@@ -169,7 +169,10 @@ export function GranteeCard({ text={ isEthAddressCopy ? t('copied', 'Copied!', { ns: 'common' }) - : `${t('click-to-copy', 'Click to copy', { ns: 'common' })} ${granteeAddresses.eth}` + : t('click-to-copy-value', 'Click to copy {value}', { + ns: 'common', + value: granteeAddresses.eth, + }) } >
@@ -226,7 +232,7 @@ export function GranteeCard({
diff --git a/libs/faucet/src/lib/components/account-info.tsx b/libs/faucet/src/lib/components/account-info.tsx index b7cc33783..e52b8e442 100644 --- a/libs/faucet/src/lib/components/account-info.tsx +++ b/libs/faucet/src/lib/components/account-info.tsx @@ -27,7 +27,7 @@ export function MyAccountCardBlock({ } export function AccountInfo() { - const { t } = useTranslate('common'); + const { t } = useTranslate(); const { ethAddress, haqqAddress } = useAddress(); const { copyText } = useClipboard(); const { data: balance } = useIndexerBalanceQuery(haqqAddress); @@ -60,15 +60,16 @@ export function AccountInfo() {
{ethAddress && (
- +
@@ -85,9 +86,10 @@ export function AccountInfo() { @@ -106,7 +108,7 @@ export function AccountInfo() { )} {balance?.balance !== undefined && ( - +
{formatNumber(balance.balance)} ISLM
diff --git a/libs/governance/src/lib/components/proposal-deposit-modal.tsx b/libs/governance/src/lib/components/proposal-deposit-modal.tsx index ad6de4164..4f8e7952b 100644 --- a/libs/governance/src/lib/components/proposal-deposit-modal.tsx +++ b/libs/governance/src/lib/components/proposal-deposit-modal.tsx @@ -66,7 +66,7 @@ export function ProposalDepositModal({ onSubmit: (amount: number) => void; isPending?: boolean; }) { - const { t } = useTranslate('governance'); + const { t } = useTranslate(); const [depositAmount, setDepositAmount] = useState( undefined, ); @@ -105,13 +105,15 @@ export function ProposalDepositModal({ if (amountError === 'min') { return ( - {t('amount-error-min', 'Bellow minimal value')} + {t('amount-error-min', 'Bellow minimal value', { ns: 'common' })} ); } else if (amountError === 'max') { return ( - {t('amount-error-more-than-have', 'More than you have')} + {t('amount-error-more-than-have', 'More than you have', { + ns: 'common', + })} ); } @@ -139,12 +141,14 @@ export function ProposalDepositModal({
- {t('deposit', 'Deposit')} + + {t('deposit', 'Deposit', { ns: 'common' })} +
@@ -167,7 +171,9 @@ export function ProposalDepositModal({ disabled={!isDepositEnabled || !depositAmount} isLoading={isPending} > - {t('confirm-delegation', 'Confirm delegation')} + {t('confirm-delegation', 'Confirm delegation', { + ns: 'common', + })}
diff --git a/libs/governance/src/lib/proposal-details-page.tsx b/libs/governance/src/lib/proposal-details-page.tsx index cab187fad..b8c718bb6 100644 --- a/libs/governance/src/lib/proposal-details-page.tsx +++ b/libs/governance/src/lib/proposal-details-page.tsx @@ -215,7 +215,7 @@ export function ProposalDetailsComponent({ govParams: GetGovernanceParamsResponse; voteResults: VoteResultsWithPercentages; }) { - const { t } = useTranslate('governance'); + const { t } = useTranslate(); const { isConnected } = useAccount(); const { haqqAddress } = useAddress(); const { data: delegationInfo } = useStakingDelegationQuery(haqqAddress); @@ -402,7 +402,7 @@ export function ProposalDetailsComponent({
- {t('info', 'Info')} + {t('info', 'Info', { ns: 'common' })}
@@ -415,7 +415,11 @@ export function ProposalDetailsComponent({
*/}
- + {formatNumber(totalDeposit)}{' '} {symbol.toLocaleUpperCase()} @@ -423,7 +427,7 @@ export function ProposalDetailsComponent({
- {t('description', 'Description')} + {t('description', 'Description', { ns: 'common' })}
- {t('dates', 'Dates')} + {t('dates', 'Dates', { ns: 'governance' })}
- + {formatDate(new Date(proposalDetails.submit_time))} - + {formatDate(new Date(proposalDetails.deposit_end_time))} {proposalDetails.status !== ProposalStatusEnum.Deposit && ( - + {formatDate( new Date(proposalDetails.voting_start_time), )} - + {formatDate( new Date(proposalDetails.voting_end_time), )} @@ -545,7 +565,9 @@ export function ProposalDetailsComponent({ - {t('created-at', 'Created at (gmt)')} + {t('created-at', 'Created at (gmt)', { + ns: 'governance', + })} @@ -566,7 +588,9 @@ export function ProposalDetailsComponent({ - {t('deposit-end', 'Deposit end (gmt)')} + {t('deposit-end', 'Deposit end (gmt)', { + ns: 'governance', + })} @@ -589,7 +613,9 @@ export function ProposalDetailsComponent({ - {t('vote-start', 'Vote start (gmt)')} + {t('vote-start', 'Vote start (gmt)', { + ns: 'governance', + })} @@ -612,7 +638,9 @@ export function ProposalDetailsComponent({ - {t('vote-end', 'Vote end (gmt)')} + {t('vote-end', 'Vote end (gmt)', { + ns: 'governance', + })} @@ -666,7 +694,9 @@ export function ProposalDetailsComponent({ )} {proposalDetails.status === ProposalStatusEnum.Voting && @@ -674,7 +704,9 @@ export function ProposalDetailsComponent({ )}
@@ -922,7 +954,7 @@ export function VoteActions({ proposalId: number; userVote?: string | null; }) { - const { t } = useTranslate('governance'); + const { t } = useTranslate(); const { vote, getVoteEstimatedFee } = useProposalActions(); const toast = useToast(); const { executeIfNetworkSupported } = useNetworkAwareAction(); @@ -950,7 +982,7 @@ export function VoteActions({ await toast.promise(votePromise, { loading: ( - {t('vote-in-progress', 'Vote in progress')} + {t('vote-in-progress', 'Vote in progress', { ns: 'governance' })} ), success: (tx) => { @@ -961,7 +993,9 @@ export function VoteActions({
- {t('vote-will-count', 'Your vote will be counted!!!')} + {t('vote-will-count', 'Your vote will be counted!!!', { + ns: 'governance', + })}
- {t('vote-fail-error', 'For some reason your vote failed.')} + {t('vote-fail-error', 'For some reason your vote failed.', { + ns: 'governance', + })} ); }, @@ -1015,12 +1051,13 @@ export function VoteActions({
- {t('cast-vote', 'Cast your vote')} + {t('cast-vote', 'Cast your vote', { ns: 'governance' })}
{t( 'change-vote-message', 'You can change your vote while the voting is in progress', + { ns: 'governance' }, )}
@@ -1033,7 +1070,7 @@ export function VoteActions({ setMemoVisible(true); }} > - {t('add-memo', 'Add memo')} + {t('add-memo', 'Add memo', { ns: 'common' })}
) : ( @@ -1050,7 +1087,7 @@ export function VoteActions({ 'rounded-[6px] bg-[#252528]', 'disabled:cursor-not-allowed', )} - placeholder={t('add-your-memo', 'Add your memo')} + placeholder={t('add-your-memo', 'Add your memo', { ns: 'common' })} autoFocus />
@@ -1070,7 +1107,7 @@ export function VoteActions({ voteOptionFromJSON(userVote) === VoteOption.VOTE_OPTION_YES } > - {t('vote-option-yes', 'Yes')} + {t('vote-option-yes', 'Yes', { ns: 'governance' })}
@@ -1086,7 +1123,7 @@ export function VoteActions({ voteOptionFromJSON(userVote) === VoteOption.VOTE_OPTION_NO } > - {t('vote-option-no', 'No')} + {t('vote-option-no', 'No', { ns: 'governance' })}
@@ -1102,7 +1139,7 @@ export function VoteActions({ voteOptionFromJSON(userVote) === VoteOption.VOTE_OPTION_ABSTAIN } > - {t('vote-option-abstain', 'Abstain')} + {t('vote-option-abstain', 'Abstain', { ns: 'governance' })}
@@ -1119,7 +1156,7 @@ export function VoteActions({ VoteOption.VOTE_OPTION_NO_WITH_VETO } > - {t('vote-option-veto', 'Veto')} + {t('vote-option-veto', 'Veto', { ns: 'governance' })}
@@ -1136,7 +1173,7 @@ export function DepositActionsDesktop({ onDepositSubmit: (depositAmount: number) => void; isConnected: boolean; }) { - const { t } = useTranslate('governance'); + const { t } = useTranslate(); const [depositAmount, setDepositAmount] = useState( undefined, ); @@ -1152,10 +1189,13 @@ export function DepositActionsDesktop({
- {t('enter-deposit-message', 'Enter the amount you want to deposit')} + {t('enter-deposit-message', 'Enter the amount you want to deposit', { + ns: 'governance', + })}
{t('your-balance', 'Your balance: {balance} {symbol}', { + ns: 'governance', balance: balance.toLocaleString(), symbol: symbol.toLocaleUpperCase(), })} @@ -1178,7 +1218,7 @@ export function DepositActionsDesktop({ !isConnected || (depositAmount && depositAmount === 0), )} > - {t('deposit', 'Deposit')} + {t('deposit', 'Deposit', { ns: 'common' })}
diff --git a/libs/governance/src/lib/proposal-list-page.tsx b/libs/governance/src/lib/proposal-list-page.tsx index c0d7530c5..62e1a1800 100644 --- a/libs/governance/src/lib/proposal-list-page.tsx +++ b/libs/governance/src/lib/proposal-list-page.tsx @@ -102,7 +102,7 @@ export function ProposalListPage() {
- {t('governance-title', 'Governance', { ns: 'common' })} + {t('governance', 'Governance', { ns: 'common' })}
@@ -116,7 +116,7 @@ export function ProposalListPage() {
{t('fetching-proposals', 'Fetching proposals', { - ns: 'governance', + ns: 'common', })}
diff --git a/libs/main/src/lib/components/delegation-list.tsx b/libs/main/src/lib/components/delegation-list.tsx index 298c65276..55c52967c 100644 --- a/libs/main/src/lib/components/delegation-list.tsx +++ b/libs/main/src/lib/components/delegation-list.tsx @@ -174,23 +174,23 @@ export function ShellIndexPageDelegationList() {
- {t('name', 'Name', { ns: 'main' })} + {t('name', 'Name', { ns: 'common' })}
- {t('status', 'Status', { ns: 'main' })} + {t('status', 'Status', { ns: 'common' })}
- {t('fee', 'Fee', { ns: 'main' })} + {t('fee', 'Fee', { ns: 'common' })}
- {t('voting-power', 'Voting power', { ns: 'main' })} + {t('voting-power', 'Voting power', { ns: 'common' })}
- {t('staked', 'Staked', { ns: 'main' })} + {t('staked', 'Staked', { ns: 'common' })}
- {t('rewards', 'Rewards', { ns: 'main' })} + {t('rewards', 'Rewards', { ns: 'common' })}
diff --git a/libs/main/src/lib/components/delegations-block.tsx b/libs/main/src/lib/components/delegations-block.tsx index 08c66e94f..54a7732cb 100644 --- a/libs/main/src/lib/components/delegations-block.tsx +++ b/libs/main/src/lib/components/delegations-block.tsx @@ -24,7 +24,7 @@ export function DelegationsBlock({ isMobileUserAgent: boolean; seedPhrase: string; }) { - const { t } = useTranslate('main'); + const { t } = useTranslate(); const { totalStaked, status, @@ -59,7 +59,7 @@ export function DelegationsBlock({
- {t('my-delegations', 'My delegations')} + {t('my-delegations', 'My delegations', { ns: 'common' })}
@@ -124,10 +124,16 @@ export function DelegationsBlock({ ) : (
- {t('no-delegations', "You don't have any active delegations")} + {t('no-delegations', "You don't have any active delegations", { + ns: 'main', + })}
- {t('link-to-staking', 'Go to Staking')} + + {t('link-to-staking', 'Go to Staking', { + ns: 'main', + })} +
)} diff --git a/libs/main/src/lib/components/my-account-block.tsx b/libs/main/src/lib/components/my-account-block.tsx index 715c2322f..6dc617c12 100644 --- a/libs/main/src/lib/components/my-account-block.tsx +++ b/libs/main/src/lib/components/my-account-block.tsx @@ -175,7 +175,7 @@ function MyAccountConnected({
- {t('my-account', 'My account', { ns: 'main' })} + {t('my-account', 'My account', { ns: 'common' })} @@ -298,15 +298,15 @@ function MyAccountConnected({
@@ -319,7 +319,10 @@ function MyAccountConnected({ text={ isEthAddressCopy ? t('copied', 'Copied!', { ns: 'common' }) - : `${t('click-to-copy', 'Click to copy', { ns: 'common' })} ${ethAddress}` + : t('click-to-copy-value', 'Click to copy {value}', { + ns: 'common', + value: ethAddress, + }) } >
- {t('latest-proposals', 'Latest proposals')} + {t('latest-proposals', 'Latest proposals', { ns: 'main' })} - {t('link-to-governance', 'Go to Governance')} + {t('link-to-governance', 'Go to Governance', { ns: 'main' })}
@@ -91,7 +91,7 @@ export function ProposalListBlock() {
- {t('fetching-proposals', 'Fetching proposals')} + {t('fetching-proposals', 'Fetching proposals', { ns: 'common' })}
) : ( diff --git a/libs/main/src/lib/components/statistics-block.tsx b/libs/main/src/lib/components/statistics-block.tsx index 72673bfc7..5aca52591 100644 --- a/libs/main/src/lib/components/statistics-block.tsx +++ b/libs/main/src/lib/components/statistics-block.tsx @@ -53,7 +53,7 @@ export function StatisticsBlock() {
- {t('total-stacked', 'Total staked')} ({formatPercents(stakeRatio)}%) + {t('total-staked', 'Total staked')} ({formatPercents(stakeRatio)}%)
{!isFetching && ( diff --git a/libs/staking/src/lib/components/delegate-modal.tsx b/libs/staking/src/lib/components/delegate-modal.tsx index 82eba5838..a7f21de3c 100644 --- a/libs/staking/src/lib/components/delegate-modal.tsx +++ b/libs/staking/src/lib/components/delegate-modal.tsx @@ -140,7 +140,7 @@ export function DelegateModal({ onMemoChange, onApprove, }: DelegateModalProps) { - const { t } = useTranslate('staking'); + const { t } = useTranslate(); const [isMemoVisible, setMemoVisible] = useState(false); const { isSafe } = useConnectorType(); @@ -173,13 +173,15 @@ export function DelegateModal({ if (amountError === 'min') { return ( - {t('amount-error-min', 'Bellow minimal value')} + {t('amount-error-min', 'Bellow minimal value', { ns: 'common' })} ); } else if (amountError === 'max') { return ( - {t('amount-error-more-than-have', 'More than you have')} + {t('amount-error-more-than-have', 'More than you have', { + ns: 'common', + })} ); } @@ -207,13 +209,14 @@ export function DelegateModal({
- {t('delegate', 'Delegate')} + {t('delegate', 'Delegate', { ns: 'common' })} {t( 'attention-withdrawal-warning', 'Attention! If in the future you want to withdraw the staked funds, it will take {count} day{count, plural, one {} other {s}}', { + ns: 'staking', count: unboundingTime, }, )} @@ -223,15 +226,15 @@ export function DelegateModal({
@@ -257,7 +260,7 @@ export function DelegateModal({ setMemoVisible(true); }} > - {t('add-memo', 'Add memo')} + {t('add-memo', 'Add memo', { ns: 'common' })}
) : ( @@ -275,14 +278,18 @@ export function DelegateModal({ 'px-[16px] py-[12px] text-[14px] font-[500] leading-[22px]', 'bg-[#E7E7E7]', )} - placeholder={t('memo-placeholder', 'Add your memo')} + placeholder={t('memo-placeholder', 'Add your memo', { + ns: 'staking', + })} />
)}
diff --git a/libs/staking/src/lib/components/redelegate-modal.tsx b/libs/staking/src/lib/components/redelegate-modal.tsx index a5cc26415..e2456c060 100644 --- a/libs/staking/src/lib/components/redelegate-modal.tsx +++ b/libs/staking/src/lib/components/redelegate-modal.tsx @@ -91,7 +91,7 @@ export function RedelegateModal({ onApprove, amountError, }: RedelegateModalProps) { - const { t } = useTranslate('staking'); + const { t } = useTranslate(); const [isMemoVisible, setMemoVisible] = useState(false); const { isSafe } = useConnectorType(); @@ -160,14 +160,14 @@ export function RedelegateModal({
- {t('redelegate', 'Redelegate')} + {t('redelegate', 'Redelegate', { ns: 'common' })}
@@ -177,7 +177,9 @@ export function RedelegateModal({
@@ -211,7 +213,7 @@ export function RedelegateModal({ setMemoVisible(true); }} > - {t('add-memo', 'Add memo')} + {t('add-memo', 'Add memo', { ns: 'common' })}
) : ( @@ -229,14 +231,18 @@ export function RedelegateModal({ 'px-[16px] py-[12px] text-[14px] font-[500] leading-[22px]', 'bg-[#E7E7E7]', )} - placeholder={t('memo-placeholder', 'Add your memo')} + placeholder={t('memo-placeholder', 'Add your memo', { + ns: 'staking', + })} />
)}
@@ -266,7 +272,9 @@ export function RedelegateModal({ className="w-full" disabled={isDisabled} > - {t('confirm-redelegation', 'Confirm redelegation')} + {t('confirm-redelegation', 'Confirm redelegation', { + ns: 'staking', + })}
diff --git a/libs/staking/src/lib/components/staking-info.tsx b/libs/staking/src/lib/components/staking-info.tsx index cec7abb85..f5bfa473e 100644 --- a/libs/staking/src/lib/components/staking-info.tsx +++ b/libs/staking/src/lib/components/staking-info.tsx @@ -53,7 +53,7 @@ export function StakingInfo() { variant={2} className="text-black hover:bg-transparent hover:text-white" > - {t('connect-wallet-btn', 'Connect wallet')} + {t('connect-wallet-button', 'Connect wallet')}
diff --git a/libs/staking/src/lib/components/staking-stats.tsx b/libs/staking/src/lib/components/staking-stats.tsx index a6a7bb9e3..7501fc3c2 100644 --- a/libs/staking/src/lib/components/staking-stats.tsx +++ b/libs/staking/src/lib/components/staking-stats.tsx @@ -72,13 +72,13 @@ export function StakingStatsDesktop({ onRewardsClaim, isRewardsPending = false, }: StakingStatsProps) { - const { t } = useTranslate('staking'); + const { t } = useTranslate(); return (
- {t('regular-staking', 'Regular staking')} + {t('regular-staking', 'Regular staking', { ns: 'staking' })}
@@ -87,7 +87,7 @@ export function StakingStatsDesktop({
@@ -95,7 +95,7 @@ export function StakingStatsDesktop({
@@ -103,7 +103,7 @@ export function StakingStatsDesktop({
@@ -111,7 +111,7 @@ export function StakingStatsDesktop({
- {t('claim-all-rewards', 'Claim all rewards')} + {t('claim-all-rewards', 'Claim all rewards', { ns: 'common' })}
@@ -189,34 +189,34 @@ export function StakingStatsMobile({ unbounded, isRewardsPending = false, }: StakingStatsProps) { - const { t } = useTranslate('staking'); + const { t } = useTranslate(); return (
- Regular staking + {t('regular-staking', 'Regular staking', { ns: 'staking' })}
@@ -239,7 +243,7 @@ export function StakingStatsMobile({ disabled={Number.parseFloat(rewards) < MIN_REWARDS_TO_CLAIM} data-attr="get-rewards" > - {t('get-rewards', 'Get rewards')} + {t('get-rewards', 'Get rewards', { ns: 'staking' })}
diff --git a/libs/staking/src/lib/components/stride/liquid-staking-delegate-modal.tsx b/libs/staking/src/lib/components/stride/liquid-staking-delegate-modal.tsx index a699fca58..32c995604 100644 --- a/libs/staking/src/lib/components/stride/liquid-staking-delegate-modal.tsx +++ b/libs/staking/src/lib/components/stride/liquid-staking-delegate-modal.tsx @@ -182,7 +182,7 @@ export function LiquidStakingDelegateModal({ strideAddress, setStrideAddress, }: LiquidStakingDelegateModalProps) { - const { t } = useTranslate('staking'); + const { t } = useTranslate(); const handleMaxButtonClick = useCallback(() => { onChange(Math.floor(balance)); }, [balance, onChange]); @@ -212,13 +212,15 @@ export function LiquidStakingDelegateModal({ if (amountError === 'min') { return ( - {t('amount-error-min', 'Bellow minimal value')} + {t('amount-error-min', 'Bellow minimal value', { ns: 'common' })} ); } else if (amountError === 'max') { return ( - {t('amount-error-more-than-have', 'More than you have')} + {t('amount-error-more-than-have', 'More than you have', { + ns: 'common', + })} ); } @@ -248,13 +250,14 @@ export function LiquidStakingDelegateModal({
- {t('delegate-title', 'Delegate')} + {t('delegate', 'Delegate', { ns: 'common' })} {t( 'attention-withdrawal-warning', 'Attention! If in the future you want to withdraw the staked funds, it will take {count} day{count, plural, one {} other {s}}', { + ns: 'staking', count: unboundingTime, }, )} @@ -264,16 +267,16 @@ export function LiquidStakingDelegateModal({
@@ -297,7 +300,7 @@ export function LiquidStakingDelegateModal({
- {t('you-will-get', "What you'll get:")} + {t('you-will-get', "What you'll get:", { ns: 'staking' })}
{/* eslint-disable-next-line i18next/no-literal-string */} @@ -308,7 +311,9 @@ export function LiquidStakingDelegateModal({ {annualizedYield ? (
- {t('annualized-yield', 'Annual percentage yield')} + {t('annualized-yield', 'Annual percentage yield', { + ns: 'staking', + })}
{/* eslint-disable-next-line i18next/no-literal-string */} @@ -325,7 +330,9 @@ export function LiquidStakingDelegateModal({ className="w-full" disabled={isDisabled || !isValidStrideAddress} > - {t('confirm-delegation', 'Confirm delegation')} + {t('confirm-delegation', 'Confirm delegation', { + ns: 'common', + })}
diff --git a/libs/staking/src/lib/components/stride/liquid-staking-undelegate-modal.tsx b/libs/staking/src/lib/components/stride/liquid-staking-undelegate-modal.tsx index 8f9d8c4f4..23761130d 100644 --- a/libs/staking/src/lib/components/stride/liquid-staking-undelegate-modal.tsx +++ b/libs/staking/src/lib/components/stride/liquid-staking-undelegate-modal.tsx @@ -79,14 +79,14 @@ export function LiquidStakingUndelegateModal({ if (amountError === 'min') { return ( - {t('amount-error-min', 'Bellow minimal value', { ns: 'stacking' })} + {t('amount-error-min', 'Bellow minimal value', { ns: 'common' })} ); } else if (amountError === 'max') { return ( {t('amount-error-more-than-delegation', 'More than your delegation', { - ns: 'stacking', + ns: 'staking', })} ); @@ -156,7 +156,7 @@ export function LiquidStakingUndelegateModal({ disabled={isDisabled || !isValidStrideAddress} > {t('confirm-undelegation', 'Confirm undelegation', { - ns: 'stacking', + ns: 'staking', })}
diff --git a/libs/staking/src/lib/components/stride/statistics/stride-stats.tsx b/libs/staking/src/lib/components/stride/statistics/stride-stats.tsx index 5fd6566f8..a4899607e 100644 --- a/libs/staking/src/lib/components/stride/statistics/stride-stats.tsx +++ b/libs/staking/src/lib/components/stride/statistics/stride-stats.tsx @@ -152,7 +152,7 @@ function StrideStatsDesktop({
- {t('amount-error-min', 'Bellow minimal value')} + {t('amount-error-min', 'Bellow minimal value', { ns: 'common' })} ); } else if (amountError === 'max') { return ( - {t('amount-error-more-than-delegation', 'More than your delegation')} + {t('amount-error-more-than-delegation', 'More than your delegation', { + ns: 'staking', + })} ); } @@ -123,7 +125,7 @@ export function UndelegateModal({
- {t('undelegate', 'Undelegate')} + {t('undelegate', 'Undelegate', { ns: 'common' })} - {t('funds-undelegated-in-days', { - count: unboundingTime, - })} + {t( + 'funds-undelegated-in-days', + 'The funds will be undelegated within {count, plural, one {# day} other {# days}}', + { + ns: 'staking', + count: unboundingTime, + }, + )}
@@ -168,7 +175,7 @@ export function UndelegateModal({ setMemoVisible(true); }} > - {t('add-memo', 'Add memo')} + {t('add-memo', 'Add memo', { ns: 'common' })}
) : ( @@ -186,14 +193,18 @@ export function UndelegateModal({ 'px-[16px] py-[12px] text-[14px] font-[500] leading-[22px]', 'bg-[#E7E7E7]', )} - placeholder={t('memo-placeholder', 'Add your memo')} + placeholder={t('memo-placeholder', 'Add your memo', { + ns: 'staking', + })} />
)}
@@ -223,7 +234,9 @@ export function UndelegateModal({ className="w-full" disabled={isDisabled} > - {t('confirm-undelegation', 'Confirm undelegation')} + {t('confirm-undelegation', 'Confirm undelegation', { + ns: 'staking', + })}
diff --git a/libs/staking/src/lib/components/validator-block-mobile.tsx b/libs/staking/src/lib/components/validator-block-mobile.tsx index e8cc38837..ac4341fa9 100644 --- a/libs/staking/src/lib/components/validator-block-mobile.tsx +++ b/libs/staking/src/lib/components/validator-block-mobile.tsx @@ -78,14 +78,14 @@ export function ValidatorBlockMobileComponent({ isRewardPending = false, minRewardsToClaim = 1, }: ValidatorBlockMobileProps) { - const { t } = useTranslate('staking'); + const { t } = useTranslate(); return (
- {t('validator', 'Validator')} + {t('validator', 'Validator', { ns: 'staking' })}
@@ -95,6 +95,7 @@ export function ValidatorBlockMobileComponent({ {t( 'validator-inactive-warning', 'While the validator is inactive, you will not be able to receive a reward.', + { ns: 'staking' }, )}
@@ -103,7 +104,7 @@ export function ValidatorBlockMobileComponent({
- {t('my-delegation', 'My delegation')} + {t('my-delegation', 'My delegation', { ns: 'staking' })} {formatNumber(delegation)} {symbol.toLocaleUpperCase()} @@ -112,7 +113,9 @@ export function ValidatorBlockMobileComponent({ {undelegate && undelegate > 0 && (
- {t('undelegate-process', 'Undelegate in process')} + {t('undelegate-process', 'Undelegate in process', { + ns: 'staking', + })} {formatNumber(undelegate)} {symbol.toLocaleUpperCase()} @@ -120,7 +123,9 @@ export function ValidatorBlockMobileComponent({
)}
- {t('my-rewards', 'My rewards')} + + {t('my-rewards', 'My rewards', { ns: 'staking' })} + {formatNumber(rewards)} {symbol.toLocaleUpperCase()} @@ -137,7 +142,7 @@ export function ValidatorBlockMobileComponent({ disabled={isDelegateDisabled} data-attr="delegate" > - {t('delegate', 'Delegate')} + {t('delegate', 'Delegate', { ns: 'common' })}
@@ -148,7 +153,7 @@ export function ValidatorBlockMobileComponent({ disabled={isUndelegateDisabled} data-attr="undelegate" > - {t('undelegate', 'Undelegate')} + {t('undelegate', 'Undelegate', { ns: 'common' })}
@@ -160,14 +165,18 @@ export function ValidatorBlockMobileComponent({ disabled={isRedelegateDisabled} data-attr="redelegate" > - {t('redelegate', 'Redelegate')} + {t('redelegate', 'Redelegate', { ns: 'common' })}
@@ -179,7 +188,7 @@ export function ValidatorBlockMobileComponent({ isLoading={isRewardPending} data-attr="get-my-rewards" > - {t('get-my-rewards', 'Get my rewards')} + {t('get-my-rewards', 'Get my rewards', { ns: 'staking' })}
diff --git a/libs/staking/src/lib/components/validator-info.tsx b/libs/staking/src/lib/components/validator-info.tsx index 6076f6b4d..ec3e15ec5 100644 --- a/libs/staking/src/lib/components/validator-info.tsx +++ b/libs/staking/src/lib/components/validator-info.tsx @@ -144,7 +144,7 @@ function CommissionCard({ commission }: CommissionCardProps) {
- {t('comission', 'Commission')} + {t('commission', 'Commission')}
@@ -184,7 +184,7 @@ export function ValidatorInfoComponent({ isRewardPending, isRewardsPending, }: ValidatorInfoComponentProps) { - const { t } = useTranslate('staking'); + const { t } = useTranslate(); const [isHaqqAddressCopy, setHaqqAddressCopy] = useState(false); const { copyText } = useClipboard(); const isDesktop = useMediaQuery('(min-width: 1024px)', { @@ -253,7 +253,7 @@ export function ValidatorInfoComponent({
- {t('info', 'Info')} + {t('info', 'Info', { ns: 'common' })}
@@ -267,7 +267,9 @@ export function ValidatorInfoComponent({ target="_blank" rel="noreferrer noreferrer" > - {t('website', 'Website')} + + {t('website', 'Website', { ns: 'staking' })} + )} @@ -275,7 +277,9 @@ export function ValidatorInfoComponent({ - {t('email', 'E-mail')} + + {t('email', 'E-mail', { ns: 'staking' })} + )}
@@ -283,13 +287,17 @@ export function ValidatorInfoComponent({
- + {formatNumber(votingPower)} {symbol.toLocaleUpperCase()}
{votingPowerInPercents} @@ -298,7 +306,7 @@ export function ValidatorInfoComponent({ {validatorInfo.description?.details && (
- {t('description', 'Description')} + {t('description', 'Description', { ns: 'common' })}
)} - + - {t('connect-wallet-btn', 'Connect wallet')} + {t('connect-wallet-button', 'Connect wallet')}
@@ -789,7 +797,7 @@ export function ValidatorBlockDesktop({ symbol: string; isRewardPending?: boolean; }) { - const { t } = useTranslate('staking'); + const { t } = useTranslate(); const router = useRouter(); const isWarningShown = validatorInfo.jailed || validatorInfo.status === 'BOND_STATUS_UNBONDED'; @@ -815,7 +823,7 @@ export function ValidatorBlockDesktop({
- {t('validator', 'Validator')} + {t('validator', 'Validator', { ns: 'staking' })}
@@ -825,6 +833,7 @@ export function ValidatorBlockDesktop({ {t( 'validator-inactive-warning', 'While the validator is inactive, you will not be able to receive a reward.', + { ns: 'staking' }, )}
@@ -833,7 +842,7 @@ export function ValidatorBlockDesktop({
- {t('my-delegation', 'My delegation')} + {t('my-delegation', 'My delegation', { ns: 'staking' })} {formatNumber(delegation)} {symbol.toLocaleUpperCase()} @@ -854,7 +863,7 @@ export function ValidatorBlockDesktop({ }} data-attr="delegate" > - {t('delegate', 'Delegate')} + {t('delegate', 'Delegate', { ns: 'common' })}
@@ -872,7 +881,7 @@ export function ValidatorBlockDesktop({ }} data-attr="undelegate" > - {t('undelegate', 'Undelegate')} + {t('undelegate', 'Undelegate', { ns: 'common' })}
@@ -891,14 +900,14 @@ export function ValidatorBlockDesktop({ }} data-attr="redelegate" > - {t('redelegate', 'Redelegate')} + {t('redelegate', 'Redelegate', { ns: 'common' })}
- {t('my-rewards', 'My rewards')} + {t('my-rewards', 'My rewards', { ns: 'staking' })} {formatNumber(rewards)} {symbol.toLocaleUpperCase()} @@ -911,7 +920,7 @@ export function ValidatorBlockDesktop({ ? t( 'min-amount-to-claim-rewards', 'Minimum amount to claim rewards is {amount} ISLM', - { amount: MIN_REWARDS_TO_CLAIM }, + { ns: 'common', amount: MIN_REWARDS_TO_CLAIM }, ) : '' } @@ -924,7 +933,7 @@ export function ValidatorBlockDesktop({ className="w-full" data-attr="get-my-rewards" > - {t('get-my-rewards', 'Get my rewards')} + {t('get-my-rewards', 'Get my rewards', { ns: 'staking' })}
diff --git a/libs/staking/src/lib/components/validator-list-desktop.tsx b/libs/staking/src/lib/components/validator-list-desktop.tsx index 4a9f74816..26a86465d 100644 --- a/libs/staking/src/lib/components/validator-list-desktop.tsx +++ b/libs/staking/src/lib/components/validator-list-desktop.tsx @@ -38,7 +38,7 @@ export function ValidatorsListDesktop({ onDesktopSortClick: (key: string) => void; sortState: SortState; }) { - const { t } = useTranslate('staking'); + const { t } = useTranslate(); const getValidatorRewards = useCallback( (address: string) => { const rewards = rewardsInfo?.rewards?.find((rewardsItem) => { @@ -84,7 +84,7 @@ export function ValidatorsListDesktop({ onDesktopSortClick('name'); }} > - {t('name', 'Name')} + {t('name', 'Name', { ns: 'common' })} {sortState.key !== 'random' && sortState.key === 'name' && ( )} @@ -92,7 +92,7 @@ export function ValidatorsListDesktop({
- {t('status', 'Status')} + {t('status', 'Status', { ns: 'common' })} {sortState.key !== 'random' && sortState.key === 'status' && ( )} @@ -110,7 +110,7 @@ export function ValidatorsListDesktop({ onDesktopSortClick('fee'); }} > - {t('fee', 'Fee')} + {t('fee', 'Fee', { ns: 'common' })} {sortState.key !== 'random' && sortState.key === 'fee' && ( )} @@ -128,7 +128,7 @@ export function ValidatorsListDesktop({ onDesktopSortClick('votingPower'); }} > - {t('voting-power', 'Voting power')} + {t('voting-power', 'Voting power', { ns: 'common' })} {sortState.key !== 'random' && sortState.key === 'votingPower' && ( @@ -147,7 +147,7 @@ export function ValidatorsListDesktop({ onDesktopSortClick('votingPowerPercent'); }} > - {t('voting-power', 'Voting power')} % + {t('voting-power', 'Voting power', { ns: 'common' })} % {sortState.key !== 'random' && sortState.key === 'votingPowerPercent' && ( @@ -166,7 +166,7 @@ export function ValidatorsListDesktop({ onDesktopSortClick('staked'); }} > - {t('my-stake', 'My stake')} + {t('my-stake', 'My stake', { ns: 'staking' })} {sortState.key !== 'random' && sortState.key === 'staked' && ( )} @@ -184,7 +184,7 @@ export function ValidatorsListDesktop({ onDesktopSortClick('reward'); }} > - {t('my-rewards', 'My rewards')} + {t('my-rewards', 'My rewards', { ns: 'staking' })} {sortState.key !== 'random' && sortState.key === 'reward' && ( )} diff --git a/libs/staking/src/lib/components/validator-list-item-mobile.tsx b/libs/staking/src/lib/components/validator-list-item-mobile.tsx index c8ee2f99c..ba82c71e4 100644 --- a/libs/staking/src/lib/components/validator-list-item-mobile.tsx +++ b/libs/staking/src/lib/components/validator-list-item-mobile.tsx @@ -36,7 +36,7 @@ export function ValidatorListItemMobileComponent({ votingPower, votingPowerPercent, }: ValidatorListItemMobileProps) { - const { t } = useTranslate('staking'); + const { t } = useTranslate(); return (
@@ -46,33 +46,37 @@ export function ValidatorListItemMobileComponent({ {status === 'jailed' && ( - {t('jailed-status', 'Jailed')} + {t('jailed-status', 'Jailed', { ns: 'staking' })} )} {status === 'active' && ( - {t('active-status', 'Active')} + {t('active-status', 'Active', { ns: 'staking' })} )} {status === 'inactive' && ( - {t('inactive-status', 'Inactive')} + {t('inactive-status', 'Inactive', { ns: 'staking' })} )} - + {fee} - + {votingPower} - + {votingPowerPercent} - + {staked} - + {reward}
diff --git a/libs/staking/src/lib/components/validator-list.tsx b/libs/staking/src/lib/components/validator-list.tsx index a3ba87e81..40c4d7c99 100644 --- a/libs/staking/src/lib/components/validator-list.tsx +++ b/libs/staking/src/lib/components/validator-list.tsx @@ -24,7 +24,7 @@ export function ValidatorList({ isMobileUserAgent: boolean; seedPhrase: string; }) { - const { t } = useTranslate('staking'); + const { t } = useTranslate(); const { totalStaked, valsTotal, @@ -111,7 +111,7 @@ export function ValidatorList({
- {t('validators', 'Validators')} + {t('validators', 'Validators', { ns: 'staking' })} {status !== 'pending' && (  ({validatorsCounterText}) @@ -123,17 +123,38 @@ export function ValidatorList({
@@ -145,7 +166,7 @@ export function ValidatorList({ disabled={!isWalletConnected} value={isWalletConnected ? isShowMyDelegation : false} > - {t('my-delegations', 'My delegations')} + {t('my-delegations', 'My delegations', { ns: 'common' })}
@@ -153,7 +174,7 @@ export function ValidatorList({ onChange={setInactiveValidatorsVisible} value={isInactiveValidatorsVisible} > - {t('show-inactive', 'Show inactive')} + {t('show-inactive', 'Show inactive', { ns: 'staking' })}
@@ -165,7 +186,9 @@ export function ValidatorList({
- {t('fetching-validators-message', 'Fetching validators list')} + {t('fetching-validators-message', 'Fetching validators list', { + ns: 'staking', + })}
diff --git a/libs/ucdao/src/lib/ucdao-fund-modal.tsx b/libs/ucdao/src/lib/ucdao-fund-modal.tsx index c62f2dfad..591c38b02 100644 --- a/libs/ucdao/src/lib/ucdao-fund-modal.tsx +++ b/libs/ucdao/src/lib/ucdao-fund-modal.tsx @@ -39,7 +39,7 @@ export function FundModal({ onClose: () => void; className?: string; }) { - const { t } = useTranslate('uc-dao'); + const { t } = useTranslate(); const { haqqAddress } = useAddress(); const { data: bankBalance } = useBankBalance(haqqAddress); const [fundAmount, setFundAmount] = useState(undefined); @@ -93,7 +93,9 @@ export function FundModal({ { loading: ( - {t('transfer-progress', 'Transfer in progress')} + {t('transfer-progress', 'Transfer in progress', { + ns: 'uc-dao', + })} ), success: (tx) => { @@ -102,7 +104,11 @@ export function FundModal({ return (
-
{t('transfer-success', 'Transfer successful')}
+
+ {t('transfer-success', 'Transfer successful', { + ns: 'uc-dao', + })} +
{txHash && (
@@ -188,14 +194,16 @@ export function FundModal({
- {t('deposit-dao', 'Deposit to DAO')} + + {t('deposit-dao', 'Deposit to DAO', { ns: 'uc-dao' })} +
{ if (coin) { @@ -212,7 +220,7 @@ export function FundModal({ htmlFor="amount" className="text-haqq-black font-guise cursor-pointer text-[13px] font-[500] leading-[22px]" > - {t('amount', 'Amount')} + {t('amount', 'Amount', { ns: 'uc-dao' })}
@@ -235,7 +243,7 @@ export function FundModal({ className="w-full" disabled={!isFundEnabled || isFundPending} > - {t('deposit', 'Deposit')} + {t('deposit', 'Deposit', { ns: 'common' })}
diff --git a/libs/ucdao/src/lib/ucdao-page-balance.tsx b/libs/ucdao/src/lib/ucdao-page-balance.tsx index 23c04eef0..6f673d404 100644 --- a/libs/ucdao/src/lib/ucdao-page-balance.tsx +++ b/libs/ucdao/src/lib/ucdao-page-balance.tsx @@ -50,7 +50,7 @@ export function DaoPageBalance() {
- {t('account-heading', 'My account')} + {t('my-account', 'My account')}
diff --git a/libs/ucdao/src/lib/ucdao-transfer-form.tsx b/libs/ucdao/src/lib/ucdao-transfer-form.tsx index fadf93cac..0cc6691be 100644 --- a/libs/ucdao/src/lib/ucdao-transfer-form.tsx +++ b/libs/ucdao/src/lib/ucdao-transfer-form.tsx @@ -177,7 +177,7 @@ export function DaoTransferForm() { htmlFor="targetAddress" className="cursor-pointer text-[13px] font-[500] leading-[22px] text-white" > - {t('address-label', 'Address', { ns: 'common' })} + {t('address', 'Address', { ns: 'common' })}
diff --git a/libs/ui-kit/src/lib/account-button.tsx b/libs/ui-kit/src/lib/account-button.tsx index 7fe27644e..f8a8795f9 100644 --- a/libs/ui-kit/src/lib/account-button.tsx +++ b/libs/ui-kit/src/lib/account-button.tsx @@ -1,5 +1,6 @@ 'use client'; import { Menu, MenuButton, MenuItems, MenuItem } from '@headlessui/react'; +import { useTranslate } from '@tolgee/react'; import clsx from 'clsx'; import { ArrowDownIcon } from './icons'; @@ -16,6 +17,7 @@ export function AccountButton({ className?: string; withoutDropdown?: boolean; }) { + const { t } = useTranslate('common'); return (
- Disconnect + {t('disconnect', 'Disconnect')} diff --git a/libs/ui-kit/src/lib/my-account-block-desktop.tsx b/libs/ui-kit/src/lib/my-account-block-desktop.tsx index 37cd1f98a..6133d0dc7 100644 --- a/libs/ui-kit/src/lib/my-account-block-desktop.tsx +++ b/libs/ui-kit/src/lib/my-account-block-desktop.tsx @@ -1,4 +1,5 @@ import { useState } from 'react'; +import { useTranslate } from '@tolgee/react'; import clsx from 'clsx'; import { Button } from './button'; import { Heading } from './heading'; @@ -30,6 +31,7 @@ export function MyAccountBlockDesktop({ isRewardsPending?: boolean; minRewardsToClaim?: number; }) { + const { t } = useTranslate('common'); const [isInfoShown, setInfoShown] = useState(false); return ( @@ -38,7 +40,7 @@ export function MyAccountBlockDesktop({
- My account + {t('my-account', 'My account')}
@@ -91,22 +100,22 @@ export function MyAccountBlockDesktop({
- + {formatNumber(balance)} {symbol.toLocaleUpperCase()}
- + {formatNumber(unbounded)} {symbol.toLocaleUpperCase()}
- + {formatNumber(delegated)} {symbol.toLocaleUpperCase()}
- + {formatNumber(totalRewards)} {symbol.toLocaleUpperCase()}
@@ -115,7 +124,11 @@ export function MyAccountBlockDesktop({ @@ -130,7 +143,7 @@ export function MyAccountBlockDesktop({ totalRewards < minRewardsToClaim || isRewardsPending } > - Claim all rewards + {t('claim-all-rewards', 'Claim all rewards')}
diff --git a/libs/ui-kit/src/lib/my-account-block-mobile.tsx b/libs/ui-kit/src/lib/my-account-block-mobile.tsx index 0a408f082..0cf855fbd 100644 --- a/libs/ui-kit/src/lib/my-account-block-mobile.tsx +++ b/libs/ui-kit/src/lib/my-account-block-mobile.tsx @@ -1,3 +1,4 @@ +import { useTranslate } from '@tolgee/react'; import clsx from 'clsx'; import { Container } from './container'; import { Heading } from './heading'; @@ -27,29 +28,30 @@ export function MyAccountBlockMobile({ isRewardsPending = false, minRewardsToClaim = 1, }: MyAccountBlockProps) { + const { t } = useTranslate('common'); return (
- My account + {t('my-account', 'My account')}
- + {formatNumber(balance)} {symbol.toLocaleUpperCase()} - + {formatNumber(unbounded)} {symbol.toLocaleUpperCase()} - + {formatNumber(delegated)} {symbol.toLocaleUpperCase()} - + {formatNumber(totalRewards)} {symbol.toLocaleUpperCase()}
@@ -58,7 +60,11 @@ export function MyAccountBlockMobile({ @@ -73,7 +79,7 @@ export function MyAccountBlockMobile({ onClick={onRewardsClaim} disabled={totalRewards < minRewardsToClaim || isRewardsPending} > - Claim all rewards + {t('claim-all-rewards', 'Claim all rewards')}
From 382031344df3bd7e4bc8b4d3ae912ca36de6a890 Mon Sep 17 00:00:00 2001 From: Oleg Shilov Date: Thu, 7 Nov 2024 01:07:28 +0700 Subject: [PATCH 16/22] refactor(i18n): change json structure and fix some types --- apps/shell/.tolgeerc.js | 53 +++--- apps/shell/messages/ar.json | 10 -- apps/shell/messages/authz/en.json | 21 +++ apps/shell/messages/authz/ru.json | 10 ++ apps/shell/messages/common/en.json | 55 ++++++ apps/shell/messages/common/ru.json | 5 + apps/shell/messages/en.json | 221 ------------------------ apps/shell/messages/faucet/en.json | 11 ++ apps/shell/messages/governance/en.json | 35 ++++ apps/shell/messages/id.json | 10 -- apps/shell/messages/main/en.json | 19 ++ apps/shell/messages/staking/en.json | 60 +++++++ apps/shell/messages/tr.json | 10 -- apps/shell/messages/uc-dao/en.json | 18 ++ apps/shell/messages/utils/en.json | 5 + apps/shell/src/env/client.ts | 4 + apps/shell/src/tolgee/client.tsx | 2 +- apps/shell/src/tolgee/shared.ts | 28 ++- libs/ui-kit/src/lib/locale-dropdown.tsx | 11 +- package.json | 2 +- 20 files changed, 293 insertions(+), 297 deletions(-) delete mode 100644 apps/shell/messages/ar.json create mode 100644 apps/shell/messages/authz/en.json create mode 100644 apps/shell/messages/authz/ru.json create mode 100644 apps/shell/messages/common/en.json create mode 100644 apps/shell/messages/common/ru.json delete mode 100644 apps/shell/messages/en.json create mode 100644 apps/shell/messages/faucet/en.json create mode 100644 apps/shell/messages/governance/en.json delete mode 100644 apps/shell/messages/id.json create mode 100644 apps/shell/messages/main/en.json create mode 100644 apps/shell/messages/staking/en.json delete mode 100644 apps/shell/messages/tr.json create mode 100644 apps/shell/messages/uc-dao/en.json create mode 100644 apps/shell/messages/utils/en.json diff --git a/apps/shell/.tolgeerc.js b/apps/shell/.tolgeerc.js index f9ef0ff08..ddb766a38 100644 --- a/apps/shell/.tolgeerc.js +++ b/apps/shell/.tolgeerc.js @@ -1,32 +1,41 @@ +const AVAILABLE_LOCALES = ['en', 'ar', 'id', 'ru', 'tr']; +const ALL_NAMESPACES = [ + 'authz', + 'common', + 'faucet', + 'governance', + 'main', + 'staking', + 'uc-dao', + 'utils', +]; + module.exports = { $schema: 'https://tolgee.io/cli-schema.json', - projectId: 10781, + projectId: 3, + apiKey: process.env.TOLGEE_API_KEY, + apiUrl: process.env.TOLGEE_API_URL, format: 'JSON_TOLGEE', - patterns: ['../../libs/**/*.ts?(x)'], + patterns: ['../../libs/**/*.ts?(x)', '../../apps/shell/src/**/*.ts?(x)'], defaultNamespace: 'common', + parser: 'react', push: { - files: [ - { - path: './src/i18n/en.json', - language: 'en', - }, - { - path: './src/i18n/ar.json', - language: 'ar', - }, - { - path: './src/i18n/id.json', - language: 'id', - }, - { - path: './src/i18n/tr.json', - language: 'tr', - }, - ], + files: AVAILABLE_LOCALES.flatMap((locale) => { + return ALL_NAMESPACES.map((namespace) => { + return { + path: `./messages/${namespace}/${locale}.json`, + language: locale, + namespace, + }; + }); + }), forceMode: 'OVERRIDE', + tagNewKeys: ['development'], }, pull: { - path: './src/i18n', + path: './messages', + languages: AVAILABLE_LOCALES, + namespaces: ALL_NAMESPACES, + fileStructureTemplate: '{namespace}/{languageTag}.{extension}', }, - apiKey: process.env.NEXT_PUBLIC_TOLGEE_API_KEY, }; diff --git a/apps/shell/messages/ar.json b/apps/shell/messages/ar.json deleted file mode 100644 index fa3d96e9c..000000000 --- a/apps/shell/messages/ar.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "authz": {}, - "common": {}, - "faucet": {}, - "governance": {}, - "main": {}, - "staking": {}, - "uc-dao": {}, - "utils": {} -} diff --git a/apps/shell/messages/authz/en.json b/apps/shell/messages/authz/en.json new file mode 100644 index 000000000..4dc24a247 --- /dev/null +++ b/apps/shell/messages/authz/en.json @@ -0,0 +1,21 @@ +{ + "access-granted-to-you" : "Access you have been granted", + "access-you-granted" : "Access you have granted", + "five-years" : "5 Years", + "grantee" : "Grantee", + "granter" : "Granter", + "hundred-years" : "100 Years", + "message" : "Message", + "one-month" : "1 Month", + "one-week" : "1 Week", + "one-year" : "1 Year", + "revoke-button" : "Revoke", + "revoke-loading" : "Revoke in progress", + "revoke-success" : "Revoke successful", + "selected-grantee" : "Selected grantee", + "six-months" : "6 Months", + "submit-proposal" : "Submit Proposal", + "three-months" : "3 Months", + "valid-thru" : "Valid thru", + "vote" : "Vote" +} \ No newline at end of file diff --git a/apps/shell/messages/authz/ru.json b/apps/shell/messages/authz/ru.json new file mode 100644 index 000000000..4e2613386 --- /dev/null +++ b/apps/shell/messages/authz/ru.json @@ -0,0 +1,10 @@ +{ + "access-you-granted" : "Доступ, который вы предоставили", + "hundred-years" : "100 лет", + "one-week" : "1 неделя", + "one-year" : "1 год", + "revoke-button" : "Отозвать", + "revoke-loading" : "Отзыв в процессе", + "six-months" : "6 месяцев", + "three-months" : "3 месяца" +} \ No newline at end of file diff --git a/apps/shell/messages/common/en.json b/apps/shell/messages/common/en.json new file mode 100644 index 000000000..496b6b757 --- /dev/null +++ b/apps/shell/messages/common/en.json @@ -0,0 +1,55 @@ +{ + "add-memo" : "Add memo", + "add-your-memo" : "Add your memo", + "address" : "Address", + "amount-error-min" : "Bellow minimal value", + "amount-error-more-than-have" : "More than you have", + "available" : "Available", + "balance" : "Balance", + "cancel-button" : "Cancel", + "claim-all-rewards" : "Claim all rewards", + "click-to-copy-value" : "Click to copy {value}", + "confirm-button" : "Confirm", + "confirm-delegation" : "Confirm delegation", + "connect-wallet-button" : "Connect wallet", + "connect-wallet-message" : "You should connect wallet first", + "copied" : "Copied!", + "delegate" : "Delegate", + "deposit" : "Deposit", + "description" : "Description", + "disconnect" : "Disconnect", + "fee" : "Fee", + "fetching-proposals" : "Fetching proposals", + "go-back" : "Go back", + "governance" : "Governance", + "grant-access" : "Grant access", + "grant-loading" : "Grant in progress", + "grant-period" : "Grant period", + "grant-success" : "Grant successful", + "grant-type" : "Grant type", + "grantee-address" : "Grantee address", + "hide-info" : "Hide Info", + "info" : "Info", + "invalid-grantee-wallet-message" : "You should enter valid grantee wallet to see info", + "memo" : "Memo", + "min-amount-to-claim-rewards" : "Minimum amount to claim rewards is {amount} ISLM", + "my-account" : "My account", + "my-balance" : "My balance", + "my-delegations" : "My delegations", + "name" : "Name", + "nothing-found" : "Nothing found", + "page-not-found" : "Page not found", + "redelegate" : "Redelegate", + "rewards" : "Rewards", + "selected-grantee" : "Selected grantee", + "send-button" : "Send", + "show-info" : "Show Info", + "something-went-wrong" : "Something went wrong!", + "staked" : "Staked", + "staking" : "Staking", + "status" : "Status", + "try-again" : "Try again", + "unbonding" : "Unbonding", + "undelegate" : "Undelegate", + "voting-power" : "Voting power" +} \ No newline at end of file diff --git a/apps/shell/messages/common/ru.json b/apps/shell/messages/common/ru.json new file mode 100644 index 000000000..4988e60f0 --- /dev/null +++ b/apps/shell/messages/common/ru.json @@ -0,0 +1,5 @@ +{ + "address" : "Адрес", + "click-to-copy-value" : "Нажмите, чтобы скопировать {value}", + "connect-wallet-button" : "Подключить кошелек" +} \ No newline at end of file diff --git a/apps/shell/messages/en.json b/apps/shell/messages/en.json deleted file mode 100644 index 1eb38b2b7..000000000 --- a/apps/shell/messages/en.json +++ /dev/null @@ -1,221 +0,0 @@ -{ - "authz": { - "revoke-button": "Revoke", - "revoke-loading": "Revoke in progress", - "revoke-success": "Revoke successful", - "access-you-granted": "Access you have granted", - "access-granted-to-you": "Access you have been granted", - "grantee": "Grantee", - "message": "Message", - "valid-thru": "Valid thru", - "selected-grantee": "Selected grantee", - "submit-proposal": "Submit proposal", - "vote": "Vote", - "one-week": "1 week", - "one-month": "1 month", - "three-months": "3 months", - "six-months": "6 months", - "one-year": "1 year", - "five-years": "5 years", - "hundred-years": "100 years", - "granter": "Granter" - }, - "common": { - "address": "Address", - "add-memo": "Add memo", - "add-your-memo": "Add your memo", - "amount-error-min": "Bellow minimal value", - "amount-error-more-than-have": "More than you have", - "available": "Available", - "balance": "Balance", - "cancel-button": "Cancel", - "claim-all-rewards": "Claim all rewards", - "click-to-copy-value": "Click to copy {value}", - "confirm-button": "Confirm", - "confirm-delegation": "Confirm delegation", - "connect-wallet-button": "Connect wallet", - "connect-wallet-message": "You should connect wallet first", - "copied": "Copied!", - "delegate": "Delegate", - "deposit": "Deposit", - "description": "Description", - "disconnect": "Disconnect", - "fee": "Fee", - "fetching-proposals": "Fetching proposals", - "governance": "Governance", - "grant-access": "Grant access", - "grantee-address": "Grantee address", - "grant-loading": "Grant in progress", - "grant-period": "Grant period", - "grant-success": "Grant successful", - "grant-type": "Grant type", - "hide-info": "Hide Info", - "info": "Info", - "invalid-grantee-wallet-message": "You should enter valid grantee wallet to see info", - "memo": "Memo", - "min-amount-to-claim-rewards": "Minimum amount to claim rewards is {amount} ISLM", - "my-account": "My account", - "my-balance": "My balance", - "my-delegations": "My delegations", - "name": "Name", - "nothing-found": "Nothing found", - "redelegate": "Redelegate", - "rewards": "Rewards", - "selected-grantee": "Selected grantee", - "send-button": "Send", - "show-info": "Show Info", - "staked": "Staked", - "staking": "Staking", - "status": "Status", - "unbonding": "Unbonding", - "undelegate": "Undelegate", - "voting-power": "Voting power" - }, - "faucet": { - "claim-tokens": "Claim tokens", - "faucet": "Faucet", - "github": "Github", - "login-github": "Login with github", - "next-token-request-available": "Next request tokens available after", - "request-tokens": "Request tokens", - "switch-chain": "Switch to {chain}", - "tokens-claimed": "Tokens claimed", - "wallet": "Wallet" - }, - "governance": { - "cast-vote": "Cast your vote", - "change-vote-message": "You can change your vote while the voting is in progress", - "created-at": "Created at (gmt)", - "dates": "Dates", - "deposit-end": "Deposit end", - "enter-amount": "Enter Amount", - "enter-deposit-message": "Enter the amount you want to deposit", - "fetching-proposal-details": "Fetching proposal details", - "parameter-changes": "Parameter changes", - "proposal-deposit-alert": "If the proposal does not collect the required number of deposits in a certain time, it will reject", - "proposal-types": { - "cancel-software-upgrade": "Cancel software upgrade", - "client-update": "Client update", - "parameter-change": "Parameter change", - "register-coin": "Register coin", - "register-erc20": "Register ERC20", - "software-upgrade": "Software upgrade", - "text": "Text" - }, - "show-all-dates": "Show all dates", - "total-deposit": "Total deposit", - "upgrade-plan": "Upgrade plan", - "vote-end": "Vote end (gmt)", - "vote-fail-error": "For some reason your vote failed.", - "vote-in-progress": "Vote in progress", - "vote-option-abstain": "Abstain", - "vote-option-no": "No", - "vote-option-veto": "Veto", - "vote-option-yes": "Yes", - "vote-start": "Vote start (gmt)", - "vote-will-count": "Your vote will be counted!!!", - "voting-end": "Voting end", - "your-balance": "Your balance: {balance} {symbol}" - }, - "main": { - "accounts": "Accounts", - "active-out-of-total": "{active} out of {total}", - "active-validators": "Active validators", - "available-for-stake": "Available: {amount}", - "available-staking": "Available for staking", - "fetching-validators": "Fetching validators list", - "latest-proposals": "Latest proposals", - "link-to-governance": "Go to Governance", - "link-to-staking": "Go to Staking", - "liquid-staked": "Liquid STAKED", - "locked": "Locked: {amount}", - "no-delegations": "You don't have any active delegations", - "regular-staked": "Regular STAKED", - "shell-title": "Shell", - "staking-balance-popup-message": "In regular staking you can use coins in liquid staking", - "total-staked": "Total staked", - "total-supply": "Total supply" - }, - "staking": { - "attention-withdrawal-warning": "Attention! If in the future you want to withdraw the staked funds, it will take {count} day{count, plural, one {} other {s}}", - "active-status": "Active", - "amount-error-more-than-delegation": "More than your delegation", - "annualized-yield": "Annual percentage yield", - "apy": "APY", - "commission": "Commission", - "confirm-redelegation": "Confirm redelegation", - "confirm-undelegation": "Confirm undelegation", - "current": "Current", - "delegation-declined": "Delegation declined", - "delegation-progress": "Delegation in progress", - "delegation-success": "Delegation successful", - "email": "E-mail", - "estimated-fee": "Estimated fee", - "explorer-link": "Explorer link", - "fee-asc": "By fee (a-z)", - "fee-desc": "By fee (z-a)", - "fetching-validators-message": "Fetching validators list", - "funds-undelegated-in-days": "The funds will be undelegated within {count, plural, one {# day} other {# days}}", - "get-my-rewards": "Get my rewards", - "get-rewards": "Get rewards", - "inactive-status": "Inactive", - "jailed-status": "Jailed", - "liquid-staking": "Liquid staking", - "max": "Max", - "max-change": "Max Change", - "memo-placeholder": "Add your memo", - "my-delegation": "My delegation", - "my-rewards": "My rewards", - "my-stake": "My stake", - "name-asc": "By name (a-z)", - "name-desc": "By name (z-a)", - "power-asc": "By power (a-z)", - "power-desc": "By power (z-a)", - "random": "Random", - "redelegate-amount": "Redelegation amount", - "redelegate-progress": "Redelegate in progress", - "redelegate-success": "Redelegation successful", - "regular-staking": "Regular staking", - "reward": "Reward", - "rewards-claimed": "Rewards claimed", - "rewards-claim-in-progress": "Rewards claim in progress", - "rewards-progress": "Rewards claim in progress", - "select-new-validator": "Select new validator", - "show-inactive": "Show inactive", - "sort-by": "Sorting by", - "stISLM-in-ISLM": "stISLM in ISLM", - "stride-address-required": "Stride address is required to delegate", - "undelegate-process": "Undelegate in process", - "undelegation-declined": "Undelegation declined", - "undelegation-progress": "Undelegation in progress", - "undelegation-success": "Undelegation successful", - "validator": "Validator", - "validator-inactive-warning": "While the validator is inactive, you will not be able to receive a reward.", - "validator-info-loading": "Fetching validator information", - "validators": "Validators", - "website": "Website", - "you-will-get": "What you'll get:" - }, - "uc-dao": { - "address-placeholder": "Address in EVM/Bech32 format", - "amount": "Amount", - "confirm-ownership-transfer": "You confirm you want to transfer coins ownership in DAO", - "currency": "Currency", - "dao-balance-label": "DAO Balance", - "dao-page-title": "UnitedContributors DAO", - "deposit-dao": "Deposit to DAO", - "islm-and-liquid-balance": "{balanceNum} ISLM and {tokensNum} LIQUID", - "select-wallet-heading": "Select wallet", - "token-count": "{count, plural, other {{count} LIQUID tokens}}", - "to-the-address": " - to the address {address} ?", - "transfer-heading": "Transfer coins ownership", - "transfer-progress": "Transfer in progress", - "transfer-success": "Transfer successful", - "wallet-balance-label": "Wallet Balance" - }, - "utils": { - "address-conversion-title": "Address Conversion", - "converted-address-label": "Converted address", - "invalid-address": "Please enter a valid address" - } -} diff --git a/apps/shell/messages/faucet/en.json b/apps/shell/messages/faucet/en.json new file mode 100644 index 000000000..2e34a33de --- /dev/null +++ b/apps/shell/messages/faucet/en.json @@ -0,0 +1,11 @@ +{ + "claim-tokens" : "Claim tokens", + "faucet" : "Faucet", + "github" : "Github", + "login-github" : "Login with github", + "next-token-request-available" : "Next request tokens available after", + "request-tokens" : "Request tokens", + "switch-chain" : "Switch to {chain}", + "tokens-claimed" : "Tokens claimed", + "wallet" : "Wallet" +} \ No newline at end of file diff --git a/apps/shell/messages/governance/en.json b/apps/shell/messages/governance/en.json new file mode 100644 index 000000000..c0d62c167 --- /dev/null +++ b/apps/shell/messages/governance/en.json @@ -0,0 +1,35 @@ +{ + "cast-vote" : "Cast your vote", + "change-vote-message" : "You can change your vote while the voting is in progress", + "created-at" : "Created at (gmt)", + "dates" : "Dates", + "deposit-end" : "Deposit end", + "enter-amount" : "Enter Amount", + "enter-deposit-message" : "Enter the amount you want to deposit", + "fetching-proposal-details" : "Fetching proposal details", + "parameter-changes" : "Parameter changes", + "proposal-deposit-alert" : "If the proposal does not collect the required number of deposits in a certain time, it will reject", + "proposal-types" : { + "cancel-software-upgrade" : "Cancel software upgrade", + "client-update" : "Client update", + "parameter-change" : "Parameter change", + "register-coin" : "Register coin", + "register-erc20" : "Register ERC20", + "software-upgrade" : "Software upgrade", + "text" : "Text" + }, + "show-all-dates" : "Show all dates", + "total-deposit" : "Total deposit", + "upgrade-plan" : "Upgrade plan", + "vote-end" : "Vote end (gmt)", + "vote-fail-error" : "For some reason your vote failed.", + "vote-in-progress" : "Vote in progress", + "vote-option-abstain" : "Abstain", + "vote-option-no" : "No", + "vote-option-veto" : "Veto", + "vote-option-yes" : "Yes", + "vote-start" : "Vote start (gmt)", + "vote-will-count" : "Your vote will be counted!!!", + "voting-end" : "Voting end", + "your-balance" : "Your balance: {balance} {symbol}" +} \ No newline at end of file diff --git a/apps/shell/messages/id.json b/apps/shell/messages/id.json deleted file mode 100644 index fa3d96e9c..000000000 --- a/apps/shell/messages/id.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "authz": {}, - "common": {}, - "faucet": {}, - "governance": {}, - "main": {}, - "staking": {}, - "uc-dao": {}, - "utils": {} -} diff --git a/apps/shell/messages/main/en.json b/apps/shell/messages/main/en.json new file mode 100644 index 000000000..0aecdf5f4 --- /dev/null +++ b/apps/shell/messages/main/en.json @@ -0,0 +1,19 @@ +{ + "accounts" : "Accounts", + "active-out-of-total" : "{active} out of {total}", + "active-validators" : "Active validators", + "available-for-stake" : "Available: {amount}", + "available-staking" : "Available for staking", + "fetching-validators" : "Fetching validators list", + "latest-proposals" : "Latest proposals", + "link-to-governance" : "Go to Governance", + "link-to-staking" : "Go to Staking", + "liquid-staked" : "Liquid STAKED", + "locked" : "Locked: {amount}", + "no-delegations" : "You don't have any active delegations", + "regular-staked" : "Regular STAKED", + "shell-title" : "Shell", + "staking-balance-popup-message" : "In regular staking you can use coins in liquid staking", + "total-staked" : "Total staked", + "total-supply" : "Total supply" +} \ No newline at end of file diff --git a/apps/shell/messages/staking/en.json b/apps/shell/messages/staking/en.json new file mode 100644 index 000000000..16b8445d6 --- /dev/null +++ b/apps/shell/messages/staking/en.json @@ -0,0 +1,60 @@ +{ + "active-status" : "Active", + "amount-error-more-than-delegation" : "More than your delegation", + "annualized-yield" : "Annual percentage yield", + "apy" : "APY", + "attention-withdrawal-warning" : "{count, plural, other {Attention! If in the future you want to withdraw the staked funds, it will take {count} days}}", + "commission" : "Commission", + "confirm-redelegation" : "Confirm redelegation", + "confirm-undelegation" : "Confirm undelegation", + "current" : "Current", + "delegation-declined" : "Delegation declined", + "delegation-progress" : "Delegation in progress", + "delegation-success" : "Delegation successful", + "email" : "E-mail", + "estimated-fee" : "Estimated fee", + "explorer-link" : "Explorer link", + "fee-asc" : "By fee (a-z)", + "fee-desc" : "By fee (z-a)", + "fetching-validators-message" : "Fetching validators list", + "funds-undelegated-in-days" : "{count, plural, one {The funds will be undelegated within # day} other {The funds will be undelegated within # days}}", + "get-my-rewards" : "Get my rewards", + "get-rewards" : "Get rewards", + "inactive-status" : "Inactive", + "jailed-status" : "Jailed", + "liquid-staking" : "Liquid staking", + "max" : "Max", + "max-change" : "Max Change", + "memo-placeholder" : "Add your memo", + "my-delegation" : "My delegation", + "my-rewards" : "My rewards", + "my-stake" : "My stake", + "name-asc" : "By name (a-z)", + "name-desc" : "By name (z-a)", + "power-asc" : "By power (a-z)", + "power-desc" : "By power (z-a)", + "random" : "Random", + "redelegate-amount" : "Redelegation amount", + "redelegate-progress" : "Redelegate in progress", + "redelegate-success" : "Redelegation successful", + "regular-staking" : "Regular staking", + "reward" : "Reward", + "rewards-claim-in-progress" : "Rewards claim in progress", + "rewards-claimed" : "Rewards claimed", + "rewards-progress" : "Rewards claim in progress", + "select-new-validator" : "Select new validator", + "show-inactive" : "Show inactive", + "sort-by" : "Sorting by", + "stISLM-in-ISLM" : "stISLM in ISLM", + "stride-address-required" : "Stride address is required to delegate", + "undelegate-process" : "Undelegate in process", + "undelegation-declined" : "Undelegation declined", + "undelegation-progress" : "Undelegation in progress", + "undelegation-success" : "Undelegation successful", + "validator" : "Validator", + "validator-inactive-warning" : "While the validator is inactive, you will not be able to receive a reward.", + "validator-info-loading" : "Fetching validator information", + "validators" : "Validators", + "website" : "Website", + "you-will-get" : "What you'll get:" +} \ No newline at end of file diff --git a/apps/shell/messages/tr.json b/apps/shell/messages/tr.json deleted file mode 100644 index fa3d96e9c..000000000 --- a/apps/shell/messages/tr.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "authz": {}, - "common": {}, - "faucet": {}, - "governance": {}, - "main": {}, - "staking": {}, - "uc-dao": {}, - "utils": {} -} diff --git a/apps/shell/messages/uc-dao/en.json b/apps/shell/messages/uc-dao/en.json new file mode 100644 index 000000000..9be8b5ef6 --- /dev/null +++ b/apps/shell/messages/uc-dao/en.json @@ -0,0 +1,18 @@ +{ + "address-placeholder" : "Address in EVM/Bech32 format", + "amount" : "Amount", + "confirm-ownership-transfer" : "You confirm you want to transfer coins ownership in DAO", + "currency" : "Currency", + "dao-balance-label" : "DAO Balance", + "dao-page-title" : "UnitedContributors DAO", + "deposit-dao" : "Deposit to DAO", + "islm-and-liquid-balance" : "{balanceNum} ISLM and {tokensNum} LIQUID", + "my-account" : "My account", + "select-wallet-heading" : "Select wallet", + "to-the-address" : " - to the address {address} ?", + "token-count" : "{count, plural, other {{count} LIQUID tokens}}", + "transfer-heading" : "Transfer coins ownership", + "transfer-progress" : "Transfer in progress", + "transfer-success" : "Transfer successful", + "wallet-balance-label" : "Wallet Balance" +} \ No newline at end of file diff --git a/apps/shell/messages/utils/en.json b/apps/shell/messages/utils/en.json new file mode 100644 index 000000000..f034fd9bc --- /dev/null +++ b/apps/shell/messages/utils/en.json @@ -0,0 +1,5 @@ +{ + "address-conversion-title" : "Address Conversion", + "converted-address-label" : "Converted address", + "invalid-address" : "Please enter a valid address" +} \ No newline at end of file diff --git a/apps/shell/src/env/client.ts b/apps/shell/src/env/client.ts index 1d019979b..d37abf5f0 100644 --- a/apps/shell/src/env/client.ts +++ b/apps/shell/src/env/client.ts @@ -11,6 +11,8 @@ export const env = createEnv({ NEXT_PUBLIC_POSTHOG_HOST: z.string().min(3).optional(), NEXT_PUBLIC_POSTHOG_KEY: z.string().min(3).optional(), NEXT_PUBLIC_GIT_COMMIT_SHA: z.string().min(3).optional(), + NEXT_PUBLIC_TOLGEE_API_KEY: z.string().min(1), + NEXT_PUBLIC_TOLGEE_API_URL: z.string().min(1), // Feature flags NEXT_PUBLIC_FEATURE_LIQUID_STAKING_ENABLED: z .string() @@ -40,5 +42,7 @@ export const env = createEnv({ 'dev', NEXT_PUBLIC_FEATURE_LIQUID_STAKING_ENABLED: process.env['NEXT_PUBLIC_FEATURE_LIQUID_STAKING_ENABLED'], + NEXT_PUBLIC_TOLGEE_API_KEY: process.env['NEXT_PUBLIC_TOLGEE_API_KEY'], + NEXT_PUBLIC_TOLGEE_API_URL: process.env['NEXT_PUBLIC_TOLGEE_API_URL'], }, }); diff --git a/apps/shell/src/tolgee/client.tsx b/apps/shell/src/tolgee/client.tsx index 0e2c00f9e..c44be8679 100644 --- a/apps/shell/src/tolgee/client.tsx +++ b/apps/shell/src/tolgee/client.tsx @@ -11,7 +11,7 @@ type Props = { children: ReactNode; }; -const staticData: Record Promise> = {}; +const staticData: TolgeeStaticData = {}; AVAILABLE_LOCALES.forEach((loc) => { ALL_NAMESPACES.forEach((ns) => { diff --git a/apps/shell/src/tolgee/shared.ts b/apps/shell/src/tolgee/shared.ts index a540d7897..005fb406e 100644 --- a/apps/shell/src/tolgee/shared.ts +++ b/apps/shell/src/tolgee/shared.ts @@ -1,7 +1,8 @@ import { FormatIcu } from '@tolgee/format-icu'; import { DevTools, Tolgee, FormatSimple, TolgeeStaticData } from '@tolgee/web'; +import { env } from '../env/client'; -export const AVAILABLE_LOCALES = ['en', 'ar', 'id', 'tr'] as const; +export const AVAILABLE_LOCALES = ['en', 'ar', 'id', 'tr', 'ru'] as const; export type Locale = (typeof AVAILABLE_LOCALES)[number]; export const LOCALE_LABELS: Record = { @@ -9,18 +10,12 @@ export const LOCALE_LABELS: Record = { ar: { label: 'العربية', emoji: '🇸🇦' }, id: { label: 'Bahasa Indonesia', emoji: '🇮🇩' }, tr: { label: 'Türkçe', emoji: '🇹🇷' }, + ru: { label: 'Русский', emoji: '🇷🇺' }, }; -export type Namespace = - | 'common' - | 'utils' - | 'uc-dao' - | 'main' - | 'staking' - | 'governance' - | 'authz' - | 'faucet'; -export const ALL_NAMESPACES: Namespace[] = [ +export type AllNamespaces = (typeof ALL_NAMESPACES)[number]; + +export const ALL_NAMESPACES = [ 'common', 'utils', 'uc-dao', @@ -29,12 +24,12 @@ export const ALL_NAMESPACES: Namespace[] = [ 'governance', 'authz', 'faucet', -]; +] as const; export const DEFAULT_LOCALE = 'en'; -const apiKey = process.env.NEXT_PUBLIC_TOLGEE_API_KEY; -const apiUrl = process.env.NEXT_PUBLIC_TOLGEE_API_URL; +const apiKey = env.NEXT_PUBLIC_TOLGEE_API_KEY; +const apiUrl = env.NEXT_PUBLIC_TOLGEE_API_URL; export async function getStaticData( languages: string[], @@ -44,8 +39,9 @@ export async function getStaticData( for (const lang of languages) { for (const ns of ALL_NAMESPACES) { try { - const data = (await import(`../../messages/${lang}.json`)).default; - result[`${lang}:${ns}`] = data[ns]; + const data = (await import(`../../messages/${lang}/${ns}.json`)) + .default; + result[`${lang}:${ns}`] = data; } catch (error) { console.error( `Error loading namespace "${ns}" for language "${lang}":`, diff --git a/libs/ui-kit/src/lib/locale-dropdown.tsx b/libs/ui-kit/src/lib/locale-dropdown.tsx index 082be0880..deca1fcbc 100644 --- a/libs/ui-kit/src/lib/locale-dropdown.tsx +++ b/libs/ui-kit/src/lib/locale-dropdown.tsx @@ -62,12 +62,11 @@ export function LocaleDropdown({ {label} - + {isActive ? ( + + ) : ( +
+ )} ); })} diff --git a/package.json b/package.json index 02ac36ff7..3443daef3 100644 --- a/package.json +++ b/package.json @@ -17,11 +17,11 @@ "test": "pnpm exec nx run-many --target test --verbose", "format": "pnpm exec prettier --write '**/*.{ts,js,tsx,jsx,cjs,mjs,css,json,md,mdx,html,yaml,yml}'", "prepare": "pnpm exec husky", - "tolgee": "pnpm exec tolgee --config ./apps/shell/.tolgeerc.js", "tolgee:sync": "pnpm exec tolgee sync --config ./apps/shell/.tolgeerc.js", "tolgee:pull": "pnpm exec tolgee pull --config ./apps/shell/.tolgeerc.js", "tolgee:push": "pnpm exec tolgee push --config ./apps/shell/.tolgeerc.js", "tolgee:extract:check": "pnpm exec tolgee extract check --config ./apps/shell/.tolgeerc.js", + "tolgee:extract:print": "pnpm exec tolgee extract print --config ./apps/shell/.tolgeerc.js", "tolgee:compare": "pnpm exec tolgee compare --config ./apps/shell/.tolgeerc.js" }, "dependencies": { From 0682315bb78d02a32f88736ec19e7dcec3ba3cb8 Mon Sep 17 00:00:00 2001 From: Oleg Shilov Date: Thu, 7 Nov 2024 01:29:21 +0700 Subject: [PATCH 17/22] chore: check tolge pull translations was updated in tolgee webapp --- apps/shell/messages/authz/ru.json | 2 ++ apps/shell/messages/common/ru.json | 10 +++++++++- apps/shell/messages/faucet/ru.json | 4 ++++ apps/shell/messages/governance/en.json | 2 +- apps/shell/messages/governance/ru.json | 5 +++++ apps/shell/messages/main/en.json | 4 ++-- apps/shell/messages/staking/ru.json | 5 +++++ 7 files changed, 28 insertions(+), 4 deletions(-) create mode 100644 apps/shell/messages/faucet/ru.json create mode 100644 apps/shell/messages/governance/ru.json create mode 100644 apps/shell/messages/staking/ru.json diff --git a/apps/shell/messages/authz/ru.json b/apps/shell/messages/authz/ru.json index 4e2613386..59fff290f 100644 --- a/apps/shell/messages/authz/ru.json +++ b/apps/shell/messages/authz/ru.json @@ -1,6 +1,8 @@ { "access-you-granted" : "Доступ, который вы предоставили", + "five-years" : "5 лет", "hundred-years" : "100 лет", + "one-month" : "1 месяц", "one-week" : "1 неделя", "one-year" : "1 год", "revoke-button" : "Отозвать", diff --git a/apps/shell/messages/common/ru.json b/apps/shell/messages/common/ru.json index 4988e60f0..d78c6f12b 100644 --- a/apps/shell/messages/common/ru.json +++ b/apps/shell/messages/common/ru.json @@ -1,5 +1,13 @@ { "address" : "Адрес", "click-to-copy-value" : "Нажмите, чтобы скопировать {value}", - "connect-wallet-button" : "Подключить кошелек" + "connect-wallet-button" : "Подключить кошелек", + "my-balance" : "Мой баланс", + "my-delegations" : "Мои делегации", + "nothing-found" : "Ничего не найдено", + "page-not-found" : "Страница не найдена", + "rewards" : "Награды", + "send-button" : "Отправить", + "status" : "Статус", + "try-again" : "Попробуйте еще раз" } \ No newline at end of file diff --git a/apps/shell/messages/faucet/ru.json b/apps/shell/messages/faucet/ru.json new file mode 100644 index 000000000..20632cd14 --- /dev/null +++ b/apps/shell/messages/faucet/ru.json @@ -0,0 +1,4 @@ +{ + "login-github" : "Войти через github", + "switch-chain" : "Переключиться на {chain}" +} \ No newline at end of file diff --git a/apps/shell/messages/governance/en.json b/apps/shell/messages/governance/en.json index c0d62c167..132a41b70 100644 --- a/apps/shell/messages/governance/en.json +++ b/apps/shell/messages/governance/en.json @@ -28,7 +28,7 @@ "vote-option-no" : "No", "vote-option-veto" : "Veto", "vote-option-yes" : "Yes", - "vote-start" : "Vote start (gmt)", + "vote-start" : "Vote start (GMT)", "vote-will-count" : "Your vote will be counted!!!", "voting-end" : "Voting end", "your-balance" : "Your balance: {balance} {symbol}" diff --git a/apps/shell/messages/governance/ru.json b/apps/shell/messages/governance/ru.json new file mode 100644 index 000000000..13e733517 --- /dev/null +++ b/apps/shell/messages/governance/ru.json @@ -0,0 +1,5 @@ +{ + "vote-option-no" : "Нет", + "vote-option-veto" : "Вето", + "vote-option-yes" : "Да" +} \ No newline at end of file diff --git a/apps/shell/messages/main/en.json b/apps/shell/messages/main/en.json index 0aecdf5f4..2cdf7b237 100644 --- a/apps/shell/messages/main/en.json +++ b/apps/shell/messages/main/en.json @@ -8,10 +8,10 @@ "latest-proposals" : "Latest proposals", "link-to-governance" : "Go to Governance", "link-to-staking" : "Go to Staking", - "liquid-staked" : "Liquid STAKED", + "liquid-staked" : "Liquid staked", "locked" : "Locked: {amount}", "no-delegations" : "You don't have any active delegations", - "regular-staked" : "Regular STAKED", + "regular-staked" : "Regular staked", "shell-title" : "Shell", "staking-balance-popup-message" : "In regular staking you can use coins in liquid staking", "total-staked" : "Total staked", diff --git a/apps/shell/messages/staking/ru.json b/apps/shell/messages/staking/ru.json new file mode 100644 index 000000000..8356932ea --- /dev/null +++ b/apps/shell/messages/staking/ru.json @@ -0,0 +1,5 @@ +{ + "validator" : "Валидатор", + "validator-info-loading" : "Получение информации о валидаторе", + "validators" : "Валидаторы" +} \ No newline at end of file From bccbdc9f64aec532da02e0bda5391e0f2d0e69e4 Mon Sep 17 00:00:00 2001 From: Viktoryia Date: Thu, 7 Nov 2024 23:00:00 +0100 Subject: [PATCH 18/22] feat(i18n): web-699-testing-and-validating-keys (#996) * refactor(i18n): move not common keys to their namespaces Signed-off-by: viktoriabakun * feat(i18n): add more keys p.1 Signed-off-by: viktoriabakun * feat(i18n): add more keys p.2, mostly ui-kit Signed-off-by: viktoriabakun * feat(i18n): sync keys Signed-off-by: viktoriabakun * feat(i18n): add more keys p.3 Signed-off-by: viktoriabakun * feat(i18n): add more keys p.4 Signed-off-by: viktoriabakun * feat(i18n): sync keys Signed-off-by: viktoriabakun --------- Signed-off-by: viktoriabakun --- apps/shell/messages/authz/en.json | 48 ++--- apps/shell/messages/common/en.json | 167 ++++++++++++------ apps/shell/messages/common/ru.json | 30 ++-- apps/shell/messages/faucet/ru.json | 8 +- apps/shell/messages/governance/en.json | 61 +++---- apps/shell/messages/governance/ru.json | 8 +- apps/shell/messages/staking/en.json | 117 ++++++------ apps/shell/messages/staking/ru.json | 14 +- apps/shell/messages/uc-dao/en.json | 36 ++-- apps/shell/src/config/header-links.ts | 53 ------ apps/shell/src/config/use-header-links.tsx | 59 +++++++ .../src/hooks/use-filtered-header-links.ts | 5 +- .../src/lib/address-conversion-page.tsx | 2 +- libs/authz/src/lib/authz-grants-actions.tsx | 21 ++- libs/authz/src/lib/authz-page.tsx | 2 +- libs/faucet/src/lib/faucet-page.tsx | 22 ++- .../src/lib/proposal-details-page.tsx | 41 +++-- .../liquid-staking-undelegate-modal.tsx | 13 +- .../src/lib/components/validator-info.tsx | 11 +- .../components/validator-list-item-mobile.tsx | 10 +- .../lib/components/validator-list-mobile.tsx | 2 +- libs/ucdao/src/lib/ucdao-confirm-modal.tsx | 5 +- libs/ucdao/src/lib/ucdao-page-balance.tsx | 10 +- libs/ucdao/src/lib/ucdao-transfer-form.tsx | 2 +- libs/ui-kit/src/lib/captcha-modal.tsx | 11 +- libs/ui-kit/src/lib/card.stories.tsx | 1 + .../src/lib/connect-wallet-placeholder.tsx | 6 +- libs/ui-kit/src/lib/footer.tsx | 11 +- libs/ui-kit/src/lib/low-balance-alert.tsx | 10 +- libs/ui-kit/src/lib/modal-input.tsx | 11 +- libs/ui-kit/src/lib/modal.stories.tsx | 1 + libs/ui-kit/src/lib/proposal-card.tsx | 10 +- .../src/lib/proposal-deposit-progress.tsx | 25 ++- libs/ui-kit/src/lib/proposal-period-timer.tsx | 11 +- libs/ui-kit/src/lib/proposal-status.tsx | 12 +- .../ui-kit/src/lib/proposal-vote-progress.tsx | 27 +-- libs/ui-kit/src/lib/search-input.tsx | 4 +- libs/ui-kit/src/lib/select-chain-button.tsx | 9 +- libs/ui-kit/src/lib/select-chain-modal.tsx | 11 +- libs/ui-kit/src/lib/select-wallet-modal.tsx | 12 +- libs/ui-kit/src/lib/staked-vested-balance.tsx | 26 ++- libs/ui-kit/src/lib/testedge-banner.tsx | 5 +- libs/ui-kit/src/lib/tooltip.stories.tsx | 1 + .../src/lib/top-validators-warning-modal.tsx | 16 +- libs/ui-kit/src/lib/validator-status.tsx | 15 +- 45 files changed, 590 insertions(+), 392 deletions(-) delete mode 100644 apps/shell/src/config/header-links.ts create mode 100644 apps/shell/src/config/use-header-links.tsx diff --git a/apps/shell/messages/authz/en.json b/apps/shell/messages/authz/en.json index 4dc24a247..dc9c0777b 100644 --- a/apps/shell/messages/authz/en.json +++ b/apps/shell/messages/authz/en.json @@ -1,21 +1,29 @@ { - "access-granted-to-you" : "Access you have been granted", - "access-you-granted" : "Access you have granted", - "five-years" : "5 Years", - "grantee" : "Grantee", - "granter" : "Granter", - "hundred-years" : "100 Years", - "message" : "Message", - "one-month" : "1 Month", - "one-week" : "1 Week", - "one-year" : "1 Year", - "revoke-button" : "Revoke", - "revoke-loading" : "Revoke in progress", - "revoke-success" : "Revoke successful", - "selected-grantee" : "Selected grantee", - "six-months" : "6 Months", - "submit-proposal" : "Submit Proposal", - "three-months" : "3 Months", - "valid-thru" : "Valid thru", - "vote" : "Vote" -} \ No newline at end of file + "access-granted-to-you": "Access you have been granted", + "access-you-granted": "Access you have granted", + "five-years": "5 Years", + "grant-access": "Grant access", + "grant-loading": "Grant in progress", + "grant-period": "Grant period", + "grant-success": "Grant successful", + "grant-type": "Grant type", + "grantee": "Grantee", + "grantee-address": "Grantee address", + "granter": "Granter", + "hundred-years": "100 Years", + "invalid-grantee-wallet-message": "You should enter valid grantee wallet to see info", + "memo": "Memo", + "message": "Message", + "one-month": "1 Month", + "one-week": "1 Week", + "one-year": "1 Year", + "revoke-button": "Revoke", + "revoke-loading": "Revoke in progress", + "revoke-success": "Revoke successful", + "selected-grantee": "Selected grantee", + "six-months": "6 Months", + "submit-proposal": "Submit Proposal", + "three-months": "3 Months", + "valid-thru": "Valid thru", + "vote": "Vote" +} diff --git a/apps/shell/messages/common/en.json b/apps/shell/messages/common/en.json index 496b6b757..e58b14c7f 100644 --- a/apps/shell/messages/common/en.json +++ b/apps/shell/messages/common/en.json @@ -1,55 +1,114 @@ { - "add-memo" : "Add memo", - "add-your-memo" : "Add your memo", - "address" : "Address", - "amount-error-min" : "Bellow minimal value", - "amount-error-more-than-have" : "More than you have", - "available" : "Available", - "balance" : "Balance", - "cancel-button" : "Cancel", - "claim-all-rewards" : "Claim all rewards", - "click-to-copy-value" : "Click to copy {value}", - "confirm-button" : "Confirm", - "confirm-delegation" : "Confirm delegation", - "connect-wallet-button" : "Connect wallet", - "connect-wallet-message" : "You should connect wallet first", - "copied" : "Copied!", - "delegate" : "Delegate", - "deposit" : "Deposit", - "description" : "Description", - "disconnect" : "Disconnect", - "fee" : "Fee", - "fetching-proposals" : "Fetching proposals", - "go-back" : "Go back", - "governance" : "Governance", - "grant-access" : "Grant access", - "grant-loading" : "Grant in progress", - "grant-period" : "Grant period", - "grant-success" : "Grant successful", - "grant-type" : "Grant type", - "grantee-address" : "Grantee address", - "hide-info" : "Hide Info", - "info" : "Info", - "invalid-grantee-wallet-message" : "You should enter valid grantee wallet to see info", - "memo" : "Memo", - "min-amount-to-claim-rewards" : "Minimum amount to claim rewards is {amount} ISLM", - "my-account" : "My account", - "my-balance" : "My balance", - "my-delegations" : "My delegations", - "name" : "Name", - "nothing-found" : "Nothing found", - "page-not-found" : "Page not found", - "redelegate" : "Redelegate", - "rewards" : "Rewards", - "selected-grantee" : "Selected grantee", - "send-button" : "Send", - "show-info" : "Show Info", - "something-went-wrong" : "Something went wrong!", - "staked" : "Staked", - "staking" : "Staking", - "status" : "Status", - "try-again" : "Try again", - "unbonding" : "Unbonding", - "undelegate" : "Undelegate", - "voting-power" : "Voting power" -} \ No newline at end of file + "active-status": "Active", + "add-memo": "Add memo", + "add-your-memo": "Add your memo", + "address": "Address", + "address-conversion-title": "Address Conversion", + "all-rights-reserved": ". All rights reserved", + "amount-error-min": "Bellow minimal value", + "amount-error-more-than-have": "More than you have", + "authz": "Authz", + "available": "Available", + "balance": "Balance", + "cancel-button": "Cancel", + "claim-all-rewards": "Claim all rewards", + "click-to-copy-value": "Click to copy {value}", + "complete-captcha-message": "Please complete the captcha to continue", + "complete-captcha-title": "Complete the captcha", + "confirm-button": "Confirm", + "confirm-delegation": "Confirm delegation", + "connect-wallet-button": "Connect wallet", + "connect-wallet-message": "You should connect wallet first", + "continue-button": "Continue", + "copied": "Copied!", + "dao-amount": "UnitedContributorsDAO: {amount}", + "days": "Days", + "delegate": "Delegate", + "deposit": "Deposit", + "deposit-end": "Deposit end", + "deposit-period": "Deposit Period", + "deposit-total-from-min": "{totalDeposit} {symbol} from {minDeposit} {symbol}", + "description": "Description", + "disconnect": "Disconnect", + "enter-amount": "Enter Amount", + "enter-text": "Enter text", + "failed": "Failed", + "faucet": "Faucet", + "fee": "Fee", + "fetching-proposals": "Fetching proposals", + "go-back": "Go back", + "governance": "Governance", + "grant-access": "Grant access", + "grant-loading": "Grant in progress", + "grant-period": "Grant period", + "grant-success": "Grant successful", + "grant-type": "Grant type", + "grantee-address": "Grantee address", + "haqq-network": "HAQQ Network", + "hide-info": "Hide Info", + "hours": "Hours", + "inactive-status": "Inactive", + "info": "Info", + "invalid-grantee-wallet-message": "You should enter valid grantee wallet to see info", + "jailed-status": "Jailed", + "liquid-staked-amount": "Liquid Staked: {amount}", + "low-balance-message": "Not enough balance for the commission fee. Transfer funds to your account to proceed.", + "low-balance-title": "Low balance", + "max": "Max", + "memo": "Memo", + "min-amount-to-claim-rewards": "Minimum amount to claim rewards is {amount} ISLM", + "minutes-shortened": "Min", + "my-account": "My account", + "my-balance": "My balance", + "my-delegations": "My delegations", + "name": "Name", + "nothing-found": "Nothing found", + "open-in-haqq-wallet": "Open in HAQQ Wallet", + "page-not-found": "Page not found", + "passed": "Passed", + "redelegate": "Redelegate", + "rejected": "Rejected", + "rewards": "Rewards", + "scan-with-haqq-wallet": "Scan with HAQQ Wallet", + "search-by-name": "Search by name", + "seconds-shortened": "Sec", + "select-network": "Select network", + "select-wallet-heading": "Select wallet", + "selected-grantee": "Selected grantee", + "send-button": "Send", + "show-info": "Show Info", + "something-went-wrong": "Something went wrong!", + "staked": "Staked", + "staked-amount": "Staked: {amount}", + "staking": "Staking", + "status": "Status", + "testnet-banner": "You are on test network", + "to-the-address": " - to the address {address} ?", + "tools": "Tools", + "top-validators-warning-message": "You are attempting to delegate to a validator that ranks in the\n top {votingPowerPercent}% by voting power. Delegating to highly\n ranked validators might centralize voting power and potentially\n reduce the network's decentralization. Please ensure you\n understand the implications before proceeding.", + "total-deposit": "Total deposit", + "try-again": "Try again", + "uc-dao": "UC DAO", + "unbonding": "Unbonding", + "unbonding-amount": "Unbonding: {amount}", + "undelegate": "Undelegate", + "unsupported-network-message": "Your current action cannot be performed as the application is connected to an unsupported network. Please select one of the supported networks from the list below to proceed.", + "unsupported-network-title": "Unsupported
Network", + "utils": "Utils", + "version": "version: ", + "vested-amount": "Vested: {amount}", + "vote-option-abstain": "Abstain", + "vote-option-no": "No", + "vote-option-no-with-veto": "No with veto", + "vote-option-yes": "Yes", + "voting": "Voting", + "voting-end": "Voting end", + "voting-power": "Voting power", + "voting-results": "Voting results", + "voting-start": "Voting Start", + "voting-status": "Voting status", + "wallet-connect": "WalletConnect", + "warning": "Warning", + "you-deposited": "You Deposited: {amount}", + "you-voted": "You voted:" +} diff --git a/apps/shell/messages/common/ru.json b/apps/shell/messages/common/ru.json index d78c6f12b..d0eab4aa4 100644 --- a/apps/shell/messages/common/ru.json +++ b/apps/shell/messages/common/ru.json @@ -1,13 +1,19 @@ { - "address" : "Адрес", - "click-to-copy-value" : "Нажмите, чтобы скопировать {value}", - "connect-wallet-button" : "Подключить кошелек", - "my-balance" : "Мой баланс", - "my-delegations" : "Мои делегации", - "nothing-found" : "Ничего не найдено", - "page-not-found" : "Страница не найдена", - "rewards" : "Награды", - "send-button" : "Отправить", - "status" : "Статус", - "try-again" : "Попробуйте еще раз" -} \ No newline at end of file + "address": "Адрес", + "balance": "Баланс", + "cancel-button": "Отмена", + "click-to-copy-value": "Нажмите, чтобы скопировать {value}", + "connect-wallet-button": "Подключить кошелек", + "copied": "Скопировано!", + "description": "Описание", + "disconnect": "Отключить", + "min-amount-to-claim-rewards": "Минимальная сумма для получения вознаграждения составляет {amount} ISLM", + "my-balance": "Мой баланс", + "my-delegations": "Мои делегации", + "nothing-found": "Ничего не найдено", + "page-not-found": "Страница не найдена", + "rewards": "Награды", + "send-button": "Отправить", + "status": "Статус", + "try-again": "Попробуйте еще раз" +} diff --git a/apps/shell/messages/faucet/ru.json b/apps/shell/messages/faucet/ru.json index 20632cd14..058201131 100644 --- a/apps/shell/messages/faucet/ru.json +++ b/apps/shell/messages/faucet/ru.json @@ -1,4 +1,6 @@ { - "login-github" : "Войти через github", - "switch-chain" : "Переключиться на {chain}" -} \ No newline at end of file + "faucet": "Кран", + "login-github": "Войти через github", + "request-tokens": "Запросить токены", + "switch-chain": "Переключиться на {chain}" +} diff --git a/apps/shell/messages/governance/en.json b/apps/shell/messages/governance/en.json index 132a41b70..9c0c88e1d 100644 --- a/apps/shell/messages/governance/en.json +++ b/apps/shell/messages/governance/en.json @@ -1,35 +1,30 @@ { - "cast-vote" : "Cast your vote", - "change-vote-message" : "You can change your vote while the voting is in progress", - "created-at" : "Created at (gmt)", - "dates" : "Dates", - "deposit-end" : "Deposit end", - "enter-amount" : "Enter Amount", - "enter-deposit-message" : "Enter the amount you want to deposit", - "fetching-proposal-details" : "Fetching proposal details", - "parameter-changes" : "Parameter changes", - "proposal-deposit-alert" : "If the proposal does not collect the required number of deposits in a certain time, it will reject", - "proposal-types" : { - "cancel-software-upgrade" : "Cancel software upgrade", - "client-update" : "Client update", - "parameter-change" : "Parameter change", - "register-coin" : "Register coin", - "register-erc20" : "Register ERC20", - "software-upgrade" : "Software upgrade", - "text" : "Text" + "cast-vote": "Cast your vote", + "change-vote-message": "You can change your vote while the voting is in progress", + "created-at": "Created at (GMT)", + "dates": "Dates", + "deposit-end-gmt": "Deposit end (GMT)", + "enter-deposit-message": "Enter the amount you want to deposit", + "fetching-proposal-details": "Fetching proposal details", + "parameter-changes": "Parameter changes", + "proposal-deposit-alert": "If the proposal does not collect the required number of deposits in a certain time, it will reject", + "proposal-types": { + "cancel-software-upgrade": "Cancel software upgrade", + "client-update": "Client update", + "parameter-change": "Parameter change", + "register-coin": "Register coin", + "register-erc20": "Register ERC20", + "software-upgrade": "Software upgrade", + "text": "Text" }, - "show-all-dates" : "Show all dates", - "total-deposit" : "Total deposit", - "upgrade-plan" : "Upgrade plan", - "vote-end" : "Vote end (gmt)", - "vote-fail-error" : "For some reason your vote failed.", - "vote-in-progress" : "Vote in progress", - "vote-option-abstain" : "Abstain", - "vote-option-no" : "No", - "vote-option-veto" : "Veto", - "vote-option-yes" : "Yes", - "vote-start" : "Vote start (GMT)", - "vote-will-count" : "Your vote will be counted!!!", - "voting-end" : "Voting end", - "your-balance" : "Your balance: {balance} {symbol}" -} \ No newline at end of file + "quorum": "Quorum", + "show-all-dates": "Show all dates", + "turnout": "Turnout", + "upgrade-plan": "Upgrade plan", + "vote-end": "Vote end (GMT)", + "vote-fail-error": "For some reason your vote failed.", + "vote-in-progress": "Vote in progress", + "vote-start": "Vote start (GMT)", + "vote-will-count": "Your vote will be counted!!!", + "your-balance": "Your balance: {balance} {symbol}" +} diff --git a/apps/shell/messages/governance/ru.json b/apps/shell/messages/governance/ru.json index 13e733517..91d951a17 100644 --- a/apps/shell/messages/governance/ru.json +++ b/apps/shell/messages/governance/ru.json @@ -1,5 +1,5 @@ { - "vote-option-no" : "Нет", - "vote-option-veto" : "Вето", - "vote-option-yes" : "Да" -} \ No newline at end of file + "vote-in-progress": "Голосование в процессе", + "vote-will-count": "Ваш голос будет учтен!!!", + "your-balance": "Ваш баланс: {balance} {symbol}" +} diff --git a/apps/shell/messages/staking/en.json b/apps/shell/messages/staking/en.json index 16b8445d6..b5aa035a0 100644 --- a/apps/shell/messages/staking/en.json +++ b/apps/shell/messages/staking/en.json @@ -1,60 +1,59 @@ { - "active-status" : "Active", - "amount-error-more-than-delegation" : "More than your delegation", - "annualized-yield" : "Annual percentage yield", - "apy" : "APY", - "attention-withdrawal-warning" : "{count, plural, other {Attention! If in the future you want to withdraw the staked funds, it will take {count} days}}", - "commission" : "Commission", - "confirm-redelegation" : "Confirm redelegation", - "confirm-undelegation" : "Confirm undelegation", - "current" : "Current", - "delegation-declined" : "Delegation declined", - "delegation-progress" : "Delegation in progress", - "delegation-success" : "Delegation successful", - "email" : "E-mail", - "estimated-fee" : "Estimated fee", - "explorer-link" : "Explorer link", - "fee-asc" : "By fee (a-z)", - "fee-desc" : "By fee (z-a)", - "fetching-validators-message" : "Fetching validators list", - "funds-undelegated-in-days" : "{count, plural, one {The funds will be undelegated within # day} other {The funds will be undelegated within # days}}", - "get-my-rewards" : "Get my rewards", - "get-rewards" : "Get rewards", - "inactive-status" : "Inactive", - "jailed-status" : "Jailed", - "liquid-staking" : "Liquid staking", - "max" : "Max", - "max-change" : "Max Change", - "memo-placeholder" : "Add your memo", - "my-delegation" : "My delegation", - "my-rewards" : "My rewards", - "my-stake" : "My stake", - "name-asc" : "By name (a-z)", - "name-desc" : "By name (z-a)", - "power-asc" : "By power (a-z)", - "power-desc" : "By power (z-a)", - "random" : "Random", - "redelegate-amount" : "Redelegation amount", - "redelegate-progress" : "Redelegate in progress", - "redelegate-success" : "Redelegation successful", - "regular-staking" : "Regular staking", - "reward" : "Reward", - "rewards-claim-in-progress" : "Rewards claim in progress", - "rewards-claimed" : "Rewards claimed", - "rewards-progress" : "Rewards claim in progress", - "select-new-validator" : "Select new validator", - "show-inactive" : "Show inactive", - "sort-by" : "Sorting by", - "stISLM-in-ISLM" : "stISLM in ISLM", - "stride-address-required" : "Stride address is required to delegate", - "undelegate-process" : "Undelegate in process", - "undelegation-declined" : "Undelegation declined", - "undelegation-progress" : "Undelegation in progress", - "undelegation-success" : "Undelegation successful", - "validator" : "Validator", - "validator-inactive-warning" : "While the validator is inactive, you will not be able to receive a reward.", - "validator-info-loading" : "Fetching validator information", - "validators" : "Validators", - "website" : "Website", - "you-will-get" : "What you'll get:" -} \ No newline at end of file + "amount-error-more-than-delegation": "More than your delegation", + "annualized-yield": "Annual percentage yield", + "apy": "APY", + "attention-withdrawal-warning": "{count, plural, other {Attention! If in the future you want to withdraw the staked funds, it will take {count} days}}", + "commission": "Commission", + "confirm-redelegation": "Confirm redelegation", + "confirm-undelegation": "Confirm undelegation", + "current": "Current", + "delegation-declined": "Delegation declined", + "delegation-progress": "Delegation in progress", + "delegation-success": "Delegation successful", + "email": "E-mail", + "estimated-fee": "Estimated fee", + "explorer-link": "Explorer link", + "fee-asc": "By fee (a-z)", + "fee-desc": "By fee (z-a)", + "fetching-validators-message": "Fetching validators list", + "funds-undelegated-in-days": "{count, plural, one {The funds will be undelegated within # day} other {The funds will be undelegated within # days}}", + "get-my-rewards": "Get my rewards", + "get-rewards": "Get rewards", + "liquid-staking": "Liquid staking", + "max": "Max", + "max-change": "Max Change", + "memo-placeholder": "Add your memo", + "my-delegation": "My delegation", + "my-rewards": "My rewards", + "my-stake": "My stake", + "name-asc": "By name (a-z)", + "name-desc": "By name (z-a)", + "nothing-found": "Nothing found", + "power-asc": "By power (a-z)", + "power-desc": "By power (z-a)", + "random": "Random", + "redelegate-amount": "Redelegation amount", + "redelegate-progress": "Redelegate in progress", + "redelegate-success": "Redelegation successful", + "regular-staking": "Regular staking", + "reward": "Reward", + "rewards-claim-in-progress": "Rewards claim in progress", + "rewards-claimed": "Rewards claimed", + "rewards-progress": "Rewards claim in progress", + "select-new-validator": "Select new validator", + "show-inactive": "Show inactive", + "sort-by": "Sorting by", + "stISLM-in-ISLM": "stISLM in ISLM", + "stride-address-required": "Stride address is required to delegate", + "undelegate-process": "Undelegate in process", + "undelegation-declined": "Undelegation declined", + "undelegation-progress": "Undelegation in progress", + "undelegation-success": "Undelegation successful", + "use-stride-address-placeholder": "Use your Stride address here", + "validator": "Validator", + "validator-inactive-warning": "While the validator is inactive, you will not be able to receive a reward.", + "validator-info-loading": "Fetching validator information", + "validators": "Validators", + "website": "Website", + "you-will-get": "What you'll get:" +} diff --git a/apps/shell/messages/staking/ru.json b/apps/shell/messages/staking/ru.json index 8356932ea..8fd733be3 100644 --- a/apps/shell/messages/staking/ru.json +++ b/apps/shell/messages/staking/ru.json @@ -1,5 +1,11 @@ { - "validator" : "Валидатор", - "validator-info-loading" : "Получение информации о валидаторе", - "validators" : "Валидаторы" -} \ No newline at end of file + "commission": "Комиссия", + "delegation-success": "Делегация прошла успешно", + "my-rewards": "Мои награды", + "stISLM-in-ISLM": "stISLM в ISLM", + "validator": "Валидатор", + "validator-info-loading": "Получение информации о валидаторе", + "validators": "Валидаторы", + "website": "Веб-сайт", + "you-will-get": "Что вы получите:" +} diff --git a/apps/shell/messages/uc-dao/en.json b/apps/shell/messages/uc-dao/en.json index 9be8b5ef6..653346425 100644 --- a/apps/shell/messages/uc-dao/en.json +++ b/apps/shell/messages/uc-dao/en.json @@ -1,18 +1,20 @@ { - "address-placeholder" : "Address in EVM/Bech32 format", - "amount" : "Amount", - "confirm-ownership-transfer" : "You confirm you want to transfer coins ownership in DAO", - "currency" : "Currency", - "dao-balance-label" : "DAO Balance", - "dao-page-title" : "UnitedContributors DAO", - "deposit-dao" : "Deposit to DAO", - "islm-and-liquid-balance" : "{balanceNum} ISLM and {tokensNum} LIQUID", - "my-account" : "My account", - "select-wallet-heading" : "Select wallet", - "to-the-address" : " - to the address {address} ?", - "token-count" : "{count, plural, other {{count} LIQUID tokens}}", - "transfer-heading" : "Transfer coins ownership", - "transfer-progress" : "Transfer in progress", - "transfer-success" : "Transfer successful", - "wallet-balance-label" : "Wallet Balance" -} \ No newline at end of file + "address-placeholder": "Address in EVM/Bech32 format", + "amount": "Amount", + "cancel-button": "Cancel", + "confirm-button": "Confirm", + "confirm-ownership-transfer": "You confirm you want to transfer coins ownership in DAO", + "currency": "Currency", + "dao-balance-label": "DAO Balance", + "dao-page-title": "UnitedContributors DAO", + "deposit-dao": "Deposit to DAO", + "islm-and-liquid-balance": "{balanceNum} ISLM and {tokensNum} LIQUID", + "my-account": "My account", + "send-button": "Send", + "to-the-address": " - to the address {address} ?", + "token-count": "{count, plural, other {{count} LIQUID tokens}}", + "transfer-heading": "Transfer coins ownership", + "transfer-progress": "Transfer in progress", + "transfer-success": "Transfer successful", + "wallet-balance-label": "Wallet Balance" +} diff --git a/apps/shell/src/config/header-links.ts b/apps/shell/src/config/header-links.ts deleted file mode 100644 index 428110633..000000000 --- a/apps/shell/src/config/header-links.ts +++ /dev/null @@ -1,53 +0,0 @@ -import { haqqMainnet, haqqTestedge2 } from 'wagmi/chains'; -import { HeaderLink } from '@haqq/shell-ui-kit'; - -export const headerLinks: HeaderLink[] = [ - { - type: 'link', - label: 'UC DAO', - href: '/uc-dao', - chains: [haqqMainnet.id, haqqTestedge2.id], - }, - { - type: 'link', - label: 'Staking', - href: '/staking', - chains: [haqqMainnet.id, haqqTestedge2.id], - }, - { - type: 'link', - label: 'Governance', - href: '/governance', - chains: [haqqMainnet.id, haqqTestedge2.id], - }, - { - type: 'dropdown', - label: 'Tools', - children: [ - { - type: 'link', - label: 'Authz', - href: '/authz', - chains: [haqqMainnet.id, haqqTestedge2.id], - }, - { - type: 'link', - label: 'Faucet', - href: '/faucet', - chains: [haqqTestedge2.id], - }, - ], - }, - { - type: 'dropdown', - label: 'Utils', - children: [ - { - type: 'link', - label: 'Address conversion', - href: '/utils/address-conversion', - chains: [haqqMainnet.id, haqqTestedge2.id], - }, - ], - }, -]; diff --git a/apps/shell/src/config/use-header-links.tsx b/apps/shell/src/config/use-header-links.tsx new file mode 100644 index 000000000..48e2c6240 --- /dev/null +++ b/apps/shell/src/config/use-header-links.tsx @@ -0,0 +1,59 @@ +import { useTranslate } from '@tolgee/react'; +import { haqqMainnet, haqqTestedge2 } from 'wagmi/chains'; +import { HeaderLink } from '@haqq/shell-ui-kit'; + +export const useHeaderLinks = (): HeaderLink[] => { + const { t } = useTranslate('common'); + return [ + { + type: 'link', + label: t('uc-dao', 'UC DAO'), + href: '/uc-dao', + chains: [haqqMainnet.id, haqqTestedge2.id], + }, + { + type: 'link', + label: t('staking', 'Staking'), + href: '/staking', + chains: [haqqMainnet.id, haqqTestedge2.id], + }, + { + type: 'link', + label: t('governance', 'Governance'), + href: '/governance', + chains: [haqqMainnet.id, haqqTestedge2.id], + }, + { + type: 'dropdown', + label: t('tools', 'Tools'), + children: [ + { + type: 'link', + label: t('authz', 'Authz'), + href: '/authz', + chains: [haqqMainnet.id, haqqTestedge2.id], + }, + { + type: 'link', + label: t('faucet', 'Faucet'), + href: '/faucet', + chains: [haqqTestedge2.id], + }, + ], + }, + { + type: 'dropdown', + label: t('utils', 'Utils'), + children: [ + { + type: 'link', + label: t('address-conversion-title', 'Address conversion', { + ns: 'common', + }), + href: '/utils/address-conversion', + chains: [haqqMainnet.id, haqqTestedge2.id], + }, + ], + }, + ]; +}; diff --git a/apps/shell/src/hooks/use-filtered-header-links.ts b/apps/shell/src/hooks/use-filtered-header-links.ts index ecb924096..f380d9a1c 100644 --- a/apps/shell/src/hooks/use-filtered-header-links.ts +++ b/apps/shell/src/hooks/use-filtered-header-links.ts @@ -1,9 +1,10 @@ import { useMemo } from 'react'; import { Chain } from 'wagmi/chains'; import { HeaderLink } from '@haqq/shell-ui-kit'; -import { headerLinks } from '../config/header-links'; +import { useHeaderLinks } from '../config/use-header-links'; export function useFilteredLinks(chain: Chain) { + const headerLinks = useHeaderLinks(); const links = useMemo(() => { return headerLinks .map((link) => { @@ -24,7 +25,7 @@ export function useFilteredLinks(chain: Chain) { return null; }) .filter(Boolean) as HeaderLink[]; - }, [chain.id]); + }, [chain.id, headerLinks]); return links; } diff --git a/libs/address-conversion/src/lib/address-conversion-page.tsx b/libs/address-conversion/src/lib/address-conversion-page.tsx index df06311a9..42d7ed702 100644 --- a/libs/address-conversion/src/lib/address-conversion-page.tsx +++ b/libs/address-conversion/src/lib/address-conversion-page.tsx @@ -94,7 +94,7 @@ export function AddressConversionPage() {
{t('address-conversion-title', 'Address Conversion', { - ns: 'utils', + ns: 'common', })}
diff --git a/libs/authz/src/lib/authz-grants-actions.tsx b/libs/authz/src/lib/authz-grants-actions.tsx index 2b88b3737..12fc4c844 100644 --- a/libs/authz/src/lib/authz-grants-actions.tsx +++ b/libs/authz/src/lib/authz-grants-actions.tsx @@ -199,7 +199,7 @@ export function AuthzGrantsActions() { await toast.promise(grantPromise, { loading: ( - {t('grant-loading', 'Grant in progress', { ns: 'common' })} + {t('grant-loading', 'Grant in progress', { ns: 'authz' })} ), success: (tx) => { @@ -210,7 +210,7 @@ export function AuthzGrantsActions() {
- {t('grant-success', 'Grant successful', { ns: 'common' })} + {t('grant-success', 'Grant successful', { ns: 'authz' })}
- {t('grant-access', 'Grant access', { ns: 'common' })} + {t('grant-access', 'Grant access', { ns: 'authz' })}
@@ -328,7 +328,7 @@ export function AuthzGrantsActions() { className="cursor-pointer text-[12px] font-[500] uppercase leading-[24px] text-white/50" > {t('grantee-address', 'Grantee address', { - ns: 'common', + ns: 'authz', })}
@@ -356,7 +356,7 @@ export function AuthzGrantsActions() {
{ @@ -390,7 +390,7 @@ export function AuthzGrantsActions() { htmlFor="memo" className="cursor-pointer text-[12px] font-[500] uppercase leading-[24px] text-white/50" > - {t('memo', 'Memo', { ns: 'common' })} + {t('memo', 'Memo', { ns: 'authz' })}
@@ -424,7 +424,7 @@ export function AuthzGrantsActions() { variant={2} disabled={!isGranteeValid} > - {t('grant-access', 'Grant access', { ns: 'common' })} + {t('grant-access', 'Grant access', { ns: 'authz' })}
@@ -445,7 +445,7 @@ export function AuthzGrantsActions() {
{t('selected-grantee', 'Selected grantee', { - ns: 'common', + ns: 'authz', })}
@@ -456,6 +456,9 @@ export function AuthzGrantsActions() { {t( 'invalid-grantee-wallet-message', 'You should enter valid grantee wallet to see info', + { + ns: 'authz', + }, )}
diff --git a/libs/authz/src/lib/authz-page.tsx b/libs/authz/src/lib/authz-page.tsx index 19fab975b..589d91745 100644 --- a/libs/authz/src/lib/authz-page.tsx +++ b/libs/authz/src/lib/authz-page.tsx @@ -19,7 +19,7 @@ export function AuthzPage() {
- Authz + {t('authz', 'Authz')}
diff --git a/libs/faucet/src/lib/faucet-page.tsx b/libs/faucet/src/lib/faucet-page.tsx index 375289822..ab36fb580 100644 --- a/libs/faucet/src/lib/faucet-page.tsx +++ b/libs/faucet/src/lib/faucet-page.tsx @@ -39,7 +39,7 @@ export function FaucetPage({ serviceEndpoint: string; reCaptchaSiteKey: string; }): ReactElement { - const { t } = useTranslate('faucet'); + const { t } = useTranslate(); const chains = useChains(); const { chain = chains[0] } = useAccount(); const { switchChainAsync } = useSwitchChain(); @@ -184,7 +184,7 @@ export function FaucetPage({
- {t('faucet', 'Faucet')} + {t('faucet', 'Faucet', { ns: 'common' })}
@@ -204,7 +204,7 @@ export function FaucetPage({
- {t('wallet', 'Wallet')} + {t('wallet', 'Wallet', { ns: 'faucet' })}
@@ -214,6 +214,7 @@ export function FaucetPage({ onClick={handleNetworkSwitch} > {t('switch-chain', 'Switch to {chain}', { + ns: 'faucet', chain: chain.name, })} @@ -260,7 +261,7 @@ export function FaucetPage({ - {t('github', 'Github')} + {t('github', 'Github', { ns: 'faucet' })}
@@ -288,7 +289,7 @@ export function FaucetPage({ disabled={isAuth0Loading} variant={2} > - {t('login-github', 'Login with github')} + {t('login-github', 'Login with github', { ns: 'faucet' })} )}
@@ -299,7 +300,7 @@ export function FaucetPage({
- {t('claim-tokens', 'Claim tokens')} + {t('claim-tokens', 'Claim tokens', { ns: 'faucet' })}
@@ -318,7 +319,9 @@ export function FaucetPage({ className="w-full" onClick={handleRequestTokens} > - {t('request-tokens', 'Request tokens')} + {t('request-tokens', 'Request tokens', { + ns: 'faucet', + })}
) : ( @@ -337,7 +340,9 @@ export function FaucetPage({

- {t('tokens-claimed', 'Tokens claimed')} + {t('tokens-claimed', 'Tokens claimed', { + ns: 'faucet', + })}

)} @@ -351,6 +356,7 @@ export function FaucetPage({ title={t( 'next-token-request-available', 'Next request tokens available after', + { ns: 'faucet' }, )} /> )} diff --git a/libs/governance/src/lib/proposal-details-page.tsx b/libs/governance/src/lib/proposal-details-page.tsx index b8c718bb6..7eddb2f66 100644 --- a/libs/governance/src/lib/proposal-details-page.tsx +++ b/libs/governance/src/lib/proposal-details-page.tsx @@ -136,7 +136,7 @@ function ProposalDetailsMobile({ quorum: number; userVote?: string | null; }) { - const { t } = useTranslate('governance'); + const { t } = useTranslate('common'); return (
@@ -417,7 +417,7 @@ export function ProposalDetailsComponent({
{formatNumber(totalDeposit)}{' '} @@ -491,7 +491,7 @@ export function ProposalDetailsComponent({ {formatDate(new Date(proposalDetails.deposit_end_time))} @@ -565,7 +565,7 @@ export function ProposalDetailsComponent({ - {t('created-at', 'Created at (gmt)', { + {t('created-at', 'Created at (GMT)', { ns: 'governance', })} @@ -588,9 +588,13 @@ export function ProposalDetailsComponent({ - {t('deposit-end', 'Deposit end (gmt)', { - ns: 'governance', - })} + {t( + 'deposit-end-gmt', + 'Deposit end (GMT)', + { + ns: 'governance', + }, + )} @@ -613,7 +617,7 @@ export function ProposalDetailsComponent({ - {t('vote-start', 'Vote start (gmt)', { + {t('vote-start', 'Vote start (GMT)', { ns: 'governance', })} @@ -638,7 +642,7 @@ export function ProposalDetailsComponent({ - {t('vote-end', 'Vote end (gmt)', { + {t('vote-end', 'Vote end (GMT)', { ns: 'governance', })} @@ -695,7 +699,7 @@ export function ProposalDetailsComponent({ color="blue" date={new Date(proposalDetails.deposit_end_time)} title={t('deposit-end', 'Deposit end', { - ns: 'governance', + ns: 'common', })} /> )} @@ -705,7 +709,7 @@ export function ProposalDetailsComponent({ color="green" date={new Date(proposalDetails.voting_end_time)} title={t('voting-end', 'Voting end', { - ns: 'governance', + ns: 'common', })} /> )} @@ -805,17 +809,18 @@ function ProposalTurnoutQuorum({ quorum: string; status: ProposalStatusEnum; }) { + const { t } = useTranslate('governance'); return (
- {t('vote-option-yes', 'Yes', { ns: 'governance' })} + {t('vote-option-yes', 'Yes', { ns: 'common' })}
@@ -1123,7 +1128,7 @@ export function VoteActions({ voteOptionFromJSON(userVote) === VoteOption.VOTE_OPTION_NO } > - {t('vote-option-no', 'No', { ns: 'governance' })} + {t('vote-option-no', 'No', { ns: 'common' })}
@@ -1139,7 +1144,7 @@ export function VoteActions({ voteOptionFromJSON(userVote) === VoteOption.VOTE_OPTION_ABSTAIN } > - {t('vote-option-abstain', 'Abstain', { ns: 'governance' })} + {t('vote-option-abstain', 'Abstain', { ns: 'common' })}
@@ -1156,7 +1161,7 @@ export function VoteActions({ VoteOption.VOTE_OPTION_NO_WITH_VETO } > - {t('vote-option-veto', 'Veto', { ns: 'governance' })} + {t('vote-option-no-with-veto', 'No with veto', { ns: 'common' })}
@@ -1236,7 +1241,7 @@ export function DepositInput({ value: number | undefined; disabled?: boolean; }) { - const { t } = useTranslate('governance'); + const { t } = useTranslate('common'); return (
- {`The funds will be undelegated within ${unboundingTime} day`} + {t( + 'funds-undelegated-in-days', + 'The funds will be undelegated within {count, plural, one {# day} other {# days}}', + { + ns: 'staking', + count: unboundingTime, + }, + )}
diff --git a/libs/staking/src/lib/components/validator-info.tsx b/libs/staking/src/lib/components/validator-info.tsx index ec3e15ec5..b455a59d4 100644 --- a/libs/staking/src/lib/components/validator-info.tsx +++ b/libs/staking/src/lib/components/validator-info.tsx @@ -326,15 +326,16 @@ export function ValidatorInfoComponent({
- + {validatorName} - + {status === 'jailed' && ( - {t('jailed-status', 'Jailed', { ns: 'staking' })} + {t('jailed-status', 'Jailed', { ns: 'common' })} )} {status === 'active' && ( - {t('active-status', 'Active', { ns: 'staking' })} + {t('active-status', 'Active', { ns: 'common' })} )} {status === 'inactive' && ( - {t('inactive-status', 'Inactive', { ns: 'staking' })} + {t('inactive-status', 'Inactive', { ns: 'common' })} )} diff --git a/libs/staking/src/lib/components/validator-list-mobile.tsx b/libs/staking/src/lib/components/validator-list-mobile.tsx index 538e203f5..b745487ac 100644 --- a/libs/staking/src/lib/components/validator-list-mobile.tsx +++ b/libs/staking/src/lib/components/validator-list-mobile.tsx @@ -20,7 +20,7 @@ export function ValidatorsListMobile({ onValidatorClick: (validatorAddress: string) => void; totalStaked: number; }) { - const { t } = useTranslate('common'); + const { t } = useTranslate('staking'); const getValidatorRewards = useCallback( (address: string) => { const rewards = rewardsInfo?.rewards?.find((rewardsItem) => { diff --git a/libs/ucdao/src/lib/ucdao-confirm-modal.tsx b/libs/ucdao/src/lib/ucdao-confirm-modal.tsx index 616afcd94..3ea60379f 100644 --- a/libs/ucdao/src/lib/ucdao-confirm-modal.tsx +++ b/libs/ucdao/src/lib/ucdao-confirm-modal.tsx @@ -42,7 +42,7 @@ export function ConfirmModal({
- {t('select-wallet-heading', 'Select wallet', { ns: 'uc-dao' })} + {t('select-wallet-heading', 'Select wallet', { ns: 'common' })}
@@ -59,7 +59,6 @@ export function ConfirmModal({ /> }} /> @@ -81,7 +80,7 @@ export function ConfirmModal({
diff --git a/libs/ucdao/src/lib/ucdao-page-balance.tsx b/libs/ucdao/src/lib/ucdao-page-balance.tsx index 6f673d404..6cc8068d2 100644 --- a/libs/ucdao/src/lib/ucdao-page-balance.tsx +++ b/libs/ucdao/src/lib/ucdao-page-balance.tsx @@ -28,7 +28,7 @@ const useFilterZeroBalances = (balances?: Coin[] | null) => { }; export function DaoPageBalance() { - const { t } = useTranslate('uc-dao'); + const { t } = useTranslate(); const { haqqAddress } = useAddress(); const { data: daoBalances } = useDaoAllBalancesQuery(haqqAddress); const { data: bankBalances } = useBankBalance(haqqAddress); @@ -50,20 +50,20 @@ export function DaoPageBalance() {
- {t('my-account', 'My account')} + {t('my-account', 'My account', { ns: 'common' })}
{filteredBankBalances?.length > 0 && ( )} {filteredDaoBalances?.length > 0 && ( )} @@ -76,7 +76,7 @@ export function DaoPageBalance() { setFundModalOpen(true); }} > - {t('deposit-to-dao', 'Deposit to DAO')} + {t('deposit-to-dao', 'Deposit to DAO', { ns: 'uc-dao' })}
*/} diff --git a/libs/ucdao/src/lib/ucdao-transfer-form.tsx b/libs/ucdao/src/lib/ucdao-transfer-form.tsx index 0cc6691be..38ad4ce2b 100644 --- a/libs/ucdao/src/lib/ucdao-transfer-form.tsx +++ b/libs/ucdao/src/lib/ucdao-transfer-form.tsx @@ -215,7 +215,7 @@ export function DaoTransferForm() { }} className="w-full md:min-w-[120px]" > - {t('send-button', 'Send', { ns: 'common' })} + {t('send-button', 'Send', { ns: 'uc-dao' })}
diff --git a/libs/ui-kit/src/lib/captcha-modal.tsx b/libs/ui-kit/src/lib/captcha-modal.tsx index 6b4a4d314..9f8683a36 100644 --- a/libs/ui-kit/src/lib/captcha-modal.tsx +++ b/libs/ui-kit/src/lib/captcha-modal.tsx @@ -1,4 +1,5 @@ import { useCallback, useEffect, useState } from 'react'; +import { useTranslate } from '@tolgee/react'; import Turnstile from 'react-turnstile'; import { ModalHeading, Modal, ModalCloseButton } from './modal'; @@ -9,6 +10,7 @@ export const CaptchaModal = ({ turnstileSiteKey?: string; isClosable: boolean; }) => { + const { t } = useTranslate('common'); const [token, setToken] = useState(undefined); const [isCaptchaModalOpen, setCaptchaModalOpen] = useState(false); @@ -46,12 +48,17 @@ export const CaptchaModal = ({ />
- Complete the captcha + + {t('complete-captcha-title', 'Complete the captcha')} +
- Please complete the captcha to verify that you are not a robot. + {t( + 'complete-captcha-message', + 'Please complete the captcha to verify that you are not a robot.', + )}
{turnstileSiteKey && ( diff --git a/libs/ui-kit/src/lib/card.stories.tsx b/libs/ui-kit/src/lib/card.stories.tsx index 43649b334..18917ff68 100644 --- a/libs/ui-kit/src/lib/card.stories.tsx +++ b/libs/ui-kit/src/lib/card.stories.tsx @@ -1,3 +1,4 @@ +/* eslint-disable i18next/no-literal-string */ import { Card, CardHeading, CardSubText, CardText, TimerText } from './card'; export default { diff --git a/libs/ui-kit/src/lib/connect-wallet-placeholder.tsx b/libs/ui-kit/src/lib/connect-wallet-placeholder.tsx index fdf6395c6..9b111d32a 100644 --- a/libs/ui-kit/src/lib/connect-wallet-placeholder.tsx +++ b/libs/ui-kit/src/lib/connect-wallet-placeholder.tsx @@ -1,3 +1,4 @@ +import { useTranslate } from '@tolgee/react'; import clsx from 'clsx'; import { Button } from './button'; @@ -8,6 +9,7 @@ export function ConnectWalletPlaceholder({ className?: string; onConnectWalletClick: () => void; }) { + const { t } = useTranslate('common'); return (
- You should connect wallet first + {t('connect-wallet-message', 'You should connect wallet first')}
); diff --git a/libs/ui-kit/src/lib/footer.tsx b/libs/ui-kit/src/lib/footer.tsx index 2f1507ab2..be1b51cf3 100644 --- a/libs/ui-kit/src/lib/footer.tsx +++ b/libs/ui-kit/src/lib/footer.tsx @@ -1,9 +1,11 @@ +import { useTranslate } from '@tolgee/react'; import Link from 'next/link'; import { Container } from './container'; const CURRENT_YEAR = new Date().getFullYear(); export function Footer({ commitSha }: { commitSha?: string }) { + const { t } = useTranslate('common'); return (
@@ -17,14 +19,16 @@ export function Footer({ commitSha }: { commitSha?: string }) { rel="noopener noreferrer" className="transition-colors duration-150 hover:text-white/80" > - HAQQ Network + {t('haqq-network', 'HAQQ Network')} - . All rights reserved + {t('all-rights-reserved', '. All rights reserved')}
- version: + + {t('version', 'version: ')} + dev diff --git a/libs/ui-kit/src/lib/low-balance-alert.tsx b/libs/ui-kit/src/lib/low-balance-alert.tsx index d554591a2..4cb986e3e 100644 --- a/libs/ui-kit/src/lib/low-balance-alert.tsx +++ b/libs/ui-kit/src/lib/low-balance-alert.tsx @@ -1,4 +1,5 @@ 'use client'; +import { useTranslate } from '@tolgee/react'; import clsx from 'clsx'; import { ModalHeading, Modal, ModalCloseButton } from './modal'; @@ -11,6 +12,7 @@ export function LowBalanceAlert({ onClose: () => void; className?: string; }) { + const { t } = useTranslate('common'); return (
- Low balance + {t('low-balance-title', 'Low balance')}
- Not enough balance for the commission fee. Transfer funds to your - account to proceed. + {t( + 'low-balance-message', + 'Not enough balance for the commission fee. Transfer funds to your account to proceed.', + )}
diff --git a/libs/ui-kit/src/lib/modal-input.tsx b/libs/ui-kit/src/lib/modal-input.tsx index 1da6018a0..77518a060 100644 --- a/libs/ui-kit/src/lib/modal-input.tsx +++ b/libs/ui-kit/src/lib/modal-input.tsx @@ -5,6 +5,7 @@ import { useCallback, useMemo, } from 'react'; +import { useTranslate } from '@tolgee/react'; import clsx from 'clsx'; import MaskedInput from 'react-text-mask'; import { createNumberMask } from 'text-mask-addons'; @@ -57,7 +58,7 @@ const CurrencyInput = ({ export function StringInput({ value, onChange, - placeholder = 'Enter text', + placeholder, className, id, hint, @@ -69,6 +70,7 @@ export function StringInput({ id?: string; hint?: ReactNode; }) { + const { t } = useTranslate('common'); const handleInputChange = useCallback( (event: ChangeEvent) => { onChange(event.target.value); @@ -83,7 +85,7 @@ export function StringInput({ type="text" value={value} onChange={handleInputChange} - placeholder={placeholder} + placeholder={placeholder ?? t('enter-text', 'Enter text')} className={clsx( 'w-full rounded-[6px] outline-none', 'transition-colors duration-100 ease-in', @@ -117,6 +119,7 @@ export function ModalInput({ isMaxButtonDisabled?: boolean; id?: string; }) { + const { t } = useTranslate('common'); const handleInputChange = useCallback( (event: ChangeEvent) => { onChange(event.target.value); @@ -128,7 +131,7 @@ export function ModalInput({
- Max + {t('max', 'Max')} )} {symbol && ( diff --git a/libs/ui-kit/src/lib/modal.stories.tsx b/libs/ui-kit/src/lib/modal.stories.tsx index f021caca6..318dfe8fe 100644 --- a/libs/ui-kit/src/lib/modal.stories.tsx +++ b/libs/ui-kit/src/lib/modal.stories.tsx @@ -1,3 +1,4 @@ +/* eslint-disable i18next/no-literal-string */ import { Fragment, useState } from 'react'; import { Meta } from '@storybook/react'; import { Button } from './button'; diff --git a/libs/ui-kit/src/lib/proposal-card.tsx b/libs/ui-kit/src/lib/proposal-card.tsx index fe22d1d42..da0f10288 100644 --- a/libs/ui-kit/src/lib/proposal-card.tsx +++ b/libs/ui-kit/src/lib/proposal-card.tsx @@ -1,4 +1,5 @@ import { useMemo } from 'react'; +import { useTranslate } from '@tolgee/react'; import clsx from 'clsx'; import dynamic from 'next/dynamic'; import { VoteResultsWithPercentages } from '@haqq/shell-shared'; @@ -52,6 +53,7 @@ export function ProposalCard({ userVote?: string | null; className?: string; }) { + const { t } = useTranslate('common'); const proposalColor = useMemo(() => { if (status === 'PROPOSAL_STATUS_DEPOSIT_PERIOD') { return 'blue'; @@ -93,14 +95,14 @@ export function ProposalCard({ )} {status === ProposalStatusEnum.Voting && votingEndDate && ( )} {(status === ProposalStatusEnum.Rejected || @@ -110,7 +112,7 @@ export function ProposalCard({
{votingStartDate && ( { return Math.min((totalDeposit / minDeposit) * 100, 100); }, [minDeposit, totalDeposit]); @@ -22,13 +24,19 @@ export function ProposalDepositProgress({
- Total deposit + {t('total-deposit', 'Total deposit')} {userDeposit !== undefined && userDeposit > 0 && (
- You Deposited:{' '} - {formatNumber(userDeposit)} + , + }} + />
)} @@ -45,8 +53,15 @@ export function ProposalDepositProgress({
- {formatNumber(totalDeposit)} {symbol.toLocaleUpperCase()} from{' '} - {formatNumber(minDeposit)} {symbol.toLocaleUpperCase()} + {t( + 'deposit-total-from-min', + '{totalDeposit} {symbol} from {minDeposit} {symbol}', + { + totalDeposit: formatNumber(totalDeposit), + minDeposit: formatNumber(minDeposit), + symbol: symbol.toLocaleUpperCase(), + }, + )}
); diff --git a/libs/ui-kit/src/lib/proposal-period-timer.tsx b/libs/ui-kit/src/lib/proposal-period-timer.tsx index a7ab9f0e2..2e275e994 100644 --- a/libs/ui-kit/src/lib/proposal-period-timer.tsx +++ b/libs/ui-kit/src/lib/proposal-period-timer.tsx @@ -1,4 +1,5 @@ 'use client'; +import { useTranslate } from '@tolgee/react'; import clsx from 'clsx'; import Countdown from 'react-countdown'; @@ -11,6 +12,7 @@ export function ProposalPeriodTimer({ color: 'green' | 'gray' | 'red' | 'yellow' | 'blue'; title: string; }) { + const { t } = useTranslate('common'); return (
{days > 0 && (
- {days} Days + {days}{' '} + {t('days', 'Days')}
)} {hours > 0 && ( @@ -68,7 +71,7 @@ export function ProposalPeriodTimer({ {hours < 10 ? '0' + hours : hours} {' '} - Hours + {t('hours', 'Hours')}
)} {minutes > 0 && ( @@ -76,14 +79,14 @@ export function ProposalPeriodTimer({ {minutes < 10 ? '0' + minutes : minutes} {' '} - Min + {t('minutes-shortened', 'Min')}
)}
{seconds < 10 ? '0' + seconds : seconds} {' '} - Sec + {t('seconds-shortened', 'Sec')}
); diff --git a/libs/ui-kit/src/lib/proposal-status.tsx b/libs/ui-kit/src/lib/proposal-status.tsx index a1dec2b94..435aa9965 100644 --- a/libs/ui-kit/src/lib/proposal-status.tsx +++ b/libs/ui-kit/src/lib/proposal-status.tsx @@ -1,4 +1,5 @@ import { ReactElement } from 'react'; +import { useTranslate } from '@tolgee/react'; import clsx from 'clsx'; import { ProposalStatusEnum } from './proposal-card'; @@ -7,6 +8,7 @@ export function ProposalStatus({ }: { status: ProposalStatusEnum; }): ReactElement { + const { t } = useTranslate('common'); const baseClassName = 'inline-flex rounded-[8px] p-[8px] items-center uppercase text-[14px] font-[500] tracking-[0.01em] font-clash gap-[4px]'; @@ -23,7 +25,7 @@ export function ProposalStatus({ /> -
Rejected
+
{t('rejected', 'Rejected')}
); case ProposalStatusEnum.Passed: @@ -38,7 +40,7 @@ export function ProposalStatus({ /> -
Passed
+
{t('passed', 'Passed')}
); case ProposalStatusEnum.Voting: @@ -61,7 +63,7 @@ export function ProposalStatus({ fill="currentColor" /> -
Voting
+
{t('voting', 'Voting')}
); case ProposalStatusEnum.Deposit: @@ -75,7 +77,7 @@ export function ProposalStatus({ fill="currentColor" /> -
Deposit Period
+
{t('deposit-period', 'Deposit Period')}
); case ProposalStatusEnum.Failed: @@ -90,7 +92,7 @@ export function ProposalStatus({ /> -
Failed
+
{t('failed', 'Failed')}
); default: diff --git a/libs/ui-kit/src/lib/proposal-vote-progress.tsx b/libs/ui-kit/src/lib/proposal-vote-progress.tsx index 70257a6b8..8e872998f 100644 --- a/libs/ui-kit/src/lib/proposal-vote-progress.tsx +++ b/libs/ui-kit/src/lib/proposal-vote-progress.tsx @@ -1,5 +1,6 @@ import { ReactElement } from 'react'; import { ProposalStatus as ProposalStatusEnum } from '@evmos/provider'; +import { useTranslate } from '@tolgee/react'; import clsx from 'clsx'; import { VoteResultsWithPercentages } from '@haqq/shell-shared'; import { CardSubText, CardText } from './card'; @@ -69,38 +70,42 @@ export function ProposalVoteProgress({ userVote?: string | null; status?: string; }): ReactElement { + const { t } = useTranslate('common'); + return (
{status === ProposalStatusEnum.Voting - ? 'Voting status' - : 'Voting results'} + ? t('voting-status', 'Voting status') + : t('voting-results', 'Voting results')} {userVote && (
- You voted: + + {t('you-voted', 'You voted:')} + {voteOptionFromJSON(userVote) === VoteOption.VOTE_OPTION_YES && ( - Yes + {t('vote-option-yes', 'Yes')} )} {voteOptionFromJSON(userVote) === VoteOption.VOTE_OPTION_NO && ( - No + {t('vote-option-no', 'No')} )} {voteOptionFromJSON(userVote) === VoteOption.VOTE_OPTION_NO_WITH_VETO && ( - No with veto + {t('vote-option-no-with-veto', 'No with veto')} )} {voteOptionFromJSON(userVote) === VoteOption.VOTE_OPTION_ABSTAIN && ( - Abstain + {t('vote-option-abstain', 'Abstain')} )}
@@ -165,7 +170,7 @@ export function ProposalVoteProgress({
- Yes + {t('vote-option-yes', 'Yes')}
@@ -177,7 +182,7 @@ export function ProposalVoteProgress({
- No + {t('vote-option-no', 'No')}
@@ -189,7 +194,7 @@ export function ProposalVoteProgress({
- Abstain + {t('vote-option-abstain', 'Abstain')}
@@ -201,7 +206,7 @@ export function ProposalVoteProgress({
- No with veto + {t('vote-option-no-with-veto', 'No with veto')}
diff --git a/libs/ui-kit/src/lib/search-input.tsx b/libs/ui-kit/src/lib/search-input.tsx index 8204be322..22a1aa7fc 100644 --- a/libs/ui-kit/src/lib/search-input.tsx +++ b/libs/ui-kit/src/lib/search-input.tsx @@ -1,4 +1,5 @@ 'use client'; +import { useTranslate } from '@tolgee/react'; import clsx from 'clsx'; import { MagnifierIcon } from './icons'; @@ -11,6 +12,7 @@ export function SearchInput({ onChange: (value: string) => void; className?: string; }) { + const { t } = useTranslate('common'); return (
@@ -24,7 +26,7 @@ export function SearchInput({ 'bg-[#252528] hover:bg-[#3A3A3A] focus:bg-[#3A3A3A]', className, )} - placeholder="Search by name" + placeholder={t('search-by-name', 'Search by name')} onChange={(event) => { onChange(event.target.value); }} diff --git a/libs/ui-kit/src/lib/select-chain-button.tsx b/libs/ui-kit/src/lib/select-chain-button.tsx index 57781c759..3d4bcd812 100644 --- a/libs/ui-kit/src/lib/select-chain-button.tsx +++ b/libs/ui-kit/src/lib/select-chain-button.tsx @@ -1,5 +1,6 @@ 'use client'; import { Menu, MenuButton, MenuItem, MenuItems } from '@headlessui/react'; +import { T } from '@tolgee/react'; import clsx from 'clsx'; import { ArrowDownIcon } from './icons'; @@ -61,8 +62,12 @@ export function SelectChainButton({ )} >
- Unsupported
- Network + }} + />
void; }) { + const { t } = useTranslate('common'); return (
- Select network + {t('select-network', 'Select network')}
- Your current action cannot be performed as the application is - connected to an unsupported network. Please select one of the - supported networks from the list below to proceed. + {t( + 'unsupported-network-message', + 'Your current action cannot be performed as the application is connected to an unsupported network. Please select one of the supported networks from the list below to proceed.', + )}
diff --git a/libs/ui-kit/src/lib/select-wallet-modal.tsx b/libs/ui-kit/src/lib/select-wallet-modal.tsx index a792319df..18b5cd8fc 100644 --- a/libs/ui-kit/src/lib/select-wallet-modal.tsx +++ b/libs/ui-kit/src/lib/select-wallet-modal.tsx @@ -1,4 +1,5 @@ 'use client'; +import { useTranslate } from '@tolgee/react'; import clsx from 'clsx'; import { Button } from './button'; import { Modal, ModalCloseButton, ModalHeading } from './modal'; @@ -27,6 +28,7 @@ export function SelectWalletModal({ deeplink?: string; isHaqqWallet: boolean; }) { + const { t } = useTranslate('common'); return (
- Select wallet + + {t('select-wallet-heading', 'Select wallet')} +
@@ -55,7 +59,7 @@ export function SelectWalletModal({ variant={4} className="w-full min-w-[220px]" > - Open in HAQQ Wallet + {t('open-in-haqq-wallet', 'Open in HAQQ Wallet')}
)} @@ -72,8 +76,8 @@ export function SelectWalletModal({ > {connector.name === 'WalletConnect' ? isMobileUA - ? 'WalletConnect' - : 'Scan with HAQQ Wallet' + ? t('wallet-connect', 'WalletConnect') + : t('scan-with-haqq-wallet', 'Scan with HAQQ Wallet') : connector.name}
diff --git a/libs/ui-kit/src/lib/staked-vested-balance.tsx b/libs/ui-kit/src/lib/staked-vested-balance.tsx index 1fbbde263..a49a79840 100644 --- a/libs/ui-kit/src/lib/staked-vested-balance.tsx +++ b/libs/ui-kit/src/lib/staked-vested-balance.tsx @@ -1,4 +1,5 @@ import { useMemo } from 'react'; +import { useTranslate } from '@tolgee/react'; import { formatNumber } from '../server'; export function StakedVestedBalance({ @@ -14,6 +15,7 @@ export function StakedVestedBalance({ daoLocked: number; unbonding: number; }) { + const { t } = useTranslate('common'); const { vestedPercent, stakedPercent, @@ -100,24 +102,38 @@ export function StakedVestedBalance({
{vested > 0 && ( -
Vested: {formatNumber(vested)}
+
+ {t('vested-amount', 'Vested: {amount}', { + amount: formatNumber(vested), + })} +
)} {staked > 0 && ( -
Staked: {formatNumber(staked)}
+
+ {t('staked-amount', 'Staked: {amount}', { + amount: formatNumber(staked), + })} +
)} {daoLocked > 0 && (
- UnitedContributorsDAO: {formatNumber(daoLocked)} + {t('dao-amount', 'UnitedContributorsDAO: {amount}', { + amount: formatNumber(daoLocked), + })}
)} {unbonding > 0 && (
- Unbonding: {formatNumber(unbonding)} + {t('unbonding-amount', 'Unbonding: {amount}', { + amount: formatNumber(unbonding), + })}
)} {liquidStaked > 0 && (
- Liquid Staked: {formatNumber(liquidStaked)} + {t('liquid-staked-amount', 'Liquid Staked: {amount}', { + amount: formatNumber(liquidStaked), + })}
)}
diff --git a/libs/ui-kit/src/lib/testedge-banner.tsx b/libs/ui-kit/src/lib/testedge-banner.tsx index b3bbf7c2b..e829a7d2c 100644 --- a/libs/ui-kit/src/lib/testedge-banner.tsx +++ b/libs/ui-kit/src/lib/testedge-banner.tsx @@ -1,7 +1,10 @@ +import { useTranslate } from '@tolgee/react'; + export function TestedgeBanner() { + const { t } = useTranslate('common'); return (
- You are on test network + {t('testnet-banner', 'You are on test network')}
); } diff --git a/libs/ui-kit/src/lib/tooltip.stories.tsx b/libs/ui-kit/src/lib/tooltip.stories.tsx index 8eba77664..58223601b 100644 --- a/libs/ui-kit/src/lib/tooltip.stories.tsx +++ b/libs/ui-kit/src/lib/tooltip.stories.tsx @@ -16,6 +16,7 @@ export const Tooltip: Story = { args: { children: 'Hover me!', text: ( + // eslint-disable-next-line i18next/no-literal-string
Lorem ipsum dolor sit, amet consectetur adipisicing elit.
diff --git a/libs/ui-kit/src/lib/top-validators-warning-modal.tsx b/libs/ui-kit/src/lib/top-validators-warning-modal.tsx index 442392c36..ae54e06ee 100644 --- a/libs/ui-kit/src/lib/top-validators-warning-modal.tsx +++ b/libs/ui-kit/src/lib/top-validators-warning-modal.tsx @@ -1,4 +1,5 @@ 'use client'; +import { useTranslate } from '@tolgee/react'; import clsx from 'clsx'; import { Button } from './button'; import { Modal, ModalCloseButton, ModalHeading } from './modal'; @@ -16,6 +17,7 @@ export function TopValidatorsWarningModal({ className?: string; votingPowerPercent: number; }) { + const { t } = useTranslate('common'); return (
- Warning + {t('warning', 'Warning')}
- You are attempting to delegate to a validator that ranks in the + {t( + 'top-validators-warning-message', + `You are attempting to delegate to a validator that ranks in the top {votingPowerPercent}% by voting power. Delegating to highly ranked validators might centralize voting power and potentially reduce the network's decentralization. Please ensure you - understand the implications before proceeding. + understand the implications before proceeding.`, + { votingPowerPercent }, + )}
diff --git a/libs/ui-kit/src/lib/validator-status.tsx b/libs/ui-kit/src/lib/validator-status.tsx index 0f6da6c79..59491e02a 100644 --- a/libs/ui-kit/src/lib/validator-status.tsx +++ b/libs/ui-kit/src/lib/validator-status.tsx @@ -1,3 +1,4 @@ +import { useTranslate } from '@tolgee/react'; import clsx from 'clsx'; export function ValidatorListStatus({ @@ -9,12 +10,13 @@ export function ValidatorListStatus({ status: number; className?: string; }) { + const { t } = useTranslate('common'); if (jailed) { return (
- Jailed + {t('jailed-status', 'Jailed')}
); } @@ -24,7 +26,7 @@ export function ValidatorListStatus({
- Active + {t('active-status', 'Active')}
); } @@ -33,7 +35,7 @@ export function ValidatorListStatus({
- Inactive + {t('inactive-status', 'Inactive')}
); } @@ -45,6 +47,7 @@ export function ValidatorDetailsStatus({ jailed: boolean; status: string; }) { + const { t } = useTranslate('common'); if (jailed) { return (
- Jailed + {t('jailed-status', 'Jailed')}
); } @@ -68,7 +71,7 @@ export function ValidatorDetailsStatus({ 'bg-[#01B26E]', )} > - Active + {t('active-status', 'Active')}
); } @@ -81,7 +84,7 @@ export function ValidatorDetailsStatus({ 'bg-[#E3A13F]', )} > - Inactive + {t('inactive-status', 'Inactive')}
); } From 2e5898a152e9f8581806e9dde0d10e27ee57097e Mon Sep 17 00:00:00 2001 From: viktoriabakun Date: Mon, 6 Jan 2025 15:32:49 +0100 Subject: [PATCH 19/22] chore: update lock file Signed-off-by: viktoriabakun --- pnpm-lock.yaml | 158 +++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 145 insertions(+), 13 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 7def7f13c..c7b0bb864 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -65,6 +65,9 @@ importers: '@testing-library/react-hooks': specifier: 8.0.1 version: 8.0.1(@types/react@18.3.12)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + '@tolgee/format-icu': + specifier: 5.31.1 + version: 5.31.1 '@tolgee/react': specifier: 5.31.5 version: 5.31.5(react@18.3.1) @@ -285,6 +288,9 @@ importers: '@testing-library/user-event': specifier: 14.5.2 version: 14.5.2(@testing-library/dom@10.4.0) + '@tolgee/cli': + specifier: 2.3.1 + version: 2.3.1(typescript@5.6.3) '@types/cookie': specifier: 0.6.0 version: 0.6.0 @@ -353,7 +359,7 @@ importers: version: 6.1.0 eslint-plugin-import: specifier: 2.31.0 - version: 2.31.0(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.6.3))(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.31.0(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.6.3))(eslint@8.57.0))(eslint@8.57.0))(eslint@8.57.0) + version: 2.31.0(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.6.3))(eslint-import-resolver-typescript@3.6.3)(eslint@8.57.0) eslint-plugin-jsx-a11y: specifier: 6.10.2 version: 6.10.2(eslint@8.57.0) @@ -4468,9 +4474,17 @@ packages: '@tokenizer/token@0.3.0': resolution: {integrity: sha512-OvjF+z51L3ov0OyAU0duzsYuvO01PH7x4t6DJx+guahgTnBHkhJdG7soQeTSFLWN3efnHyibZ4Z8l2EuWwJN3A==} + '@tolgee/cli@2.3.1': + resolution: {integrity: sha512-FtLWaPoWByKu8WYEtU92M5nM3orMuMLv+olgdbOBPkHcHC1VEt09P3d8l2JiU9qTrVTF/lFAsTlQ9ivxs0iYig==} + engines: {node: '>= 18'} + hasBin: true + '@tolgee/core@5.31.5': resolution: {integrity: sha512-op8Gt1FOKVLhL6gqLMCSpJxo6/PDDTn/h86HrI0Dwo8wbT5sSl4XVM3T/CoGvKmpl3+vXZKldmmKYrbuxzO1kw==} + '@tolgee/format-icu@5.31.1': + resolution: {integrity: sha512-ZjfZZuDxWzl8OiPhVf+7eSK6cRWm+oyIcOPV1KFswC9w1+JHrAD2FOvkqanOw01yj/DWTAyfW3hQ8JnZZpTu0w==} + '@tolgee/react@5.31.5': resolution: {integrity: sha512-nEWjxASbxS9ztoK4/TNbWRDVhygSif7BtxauR2AtiBQdwk5Z8KDUYlTco5UBQhAo3jZ0JAQfk+vkfjIMLYDk6Q==} peerDependencies: @@ -5594,6 +5608,9 @@ packages: base-x@3.0.10: resolution: {integrity: sha512-7d0s06rR9rYaIWHkpfLIFICM/tkSVdoPC9qYAQRpxn9DdKNWNsKC0uk++akckyLq16Tx2WIinnZ6WRriAt6njQ==} + base32-decode@1.0.0: + resolution: {integrity: sha512-KNWUX/R7wKenwE/G/qFMzGScOgVntOmbE27vvc6GrniDGYb6a5+qWcuoXl8WIOQL7q0TpK7nZDm1Y04Yi3Yn5g==} + base64-js@1.5.1: resolution: {integrity: sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==} @@ -7770,6 +7787,11 @@ packages: resolution: {integrity: sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==} hasBin: true + glob@11.0.0: + resolution: {integrity: sha512-9UiX/Bl6J2yaBbxKoEBRm4Cipxgok8kQYcOPEhScPwebu2I0HoQOuYdIO6S3hLuWoZgpDpwQZMzTFxgpkyT76g==} + engines: {node: 20 || >=22} + hasBin: true + glob@7.2.3: resolution: {integrity: sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==} deprecated: Glob versions prior to v9 are no longer supported @@ -8528,6 +8550,10 @@ packages: jackspeak@3.4.3: resolution: {integrity: sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==} + jackspeak@4.0.2: + resolution: {integrity: sha512-bZsjR/iRjl1Nk1UkjGpAzLNfQtzuijhn2g+pbZb98HQ1Gk8vM9hfbxeMBP+M2/UUdwj0RqGG3mlvk2MsAqwvEw==} + engines: {node: 20 || >=22} + jake@10.9.2: resolution: {integrity: sha512-2P4SQ0HrLQ+fw6llpLnOaGAvN2Zu6778SJMrCUwns4fOoG9ayrTiZk3VV8sCPkVZF8ab0zksVpS8FDY5pRCNBA==} engines: {node: '>=10'} @@ -8820,6 +8846,9 @@ packages: resolution: {integrity: sha512-POQXvpdL69+CluYsillJ7SUhKvytYjW9vG/GKpnf+xP8UWgYEM/RaMzHHofbALDiKbbP1W8UEYmgGl39WkPZsg==} engines: {'0': node >= 0.2.0} + jsonschema@1.4.1: + resolution: {integrity: sha512-S6cATIPVv1z0IlxdN+zUk5EPjkGCdnhN4wVSBlvoUO1tOLJootbo9CquNJmbIh4yikWHiUedhRYrNPn1arpEmQ==} + jsprim@2.0.2: resolution: {integrity: sha512-gqXddjPqQ6G40VdnI6T6yObEC+pDNvyP95wdQhkWkg7crHH3km5qP1FsOXEkzEQwnz6gz5qGTn1c2Y52wP3OyQ==} engines: {'0': node >=0.6.0} @@ -9091,6 +9120,10 @@ packages: lru-cache@10.4.3: resolution: {integrity: sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==} + lru-cache@11.0.2: + resolution: {integrity: sha512-123qHRfJBmo2jXDbo/a5YOQrJoHF/GNQTLzQ5+IdK5pWpceK17yRc6ozlWd25FxvGKQbIUs91fDFkXmDHTKcyA==} + engines: {node: 20 || >=22} + lru-cache@4.1.5: resolution: {integrity: sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==} @@ -9343,6 +9376,10 @@ packages: minimalistic-crypto-utils@1.0.1: resolution: {integrity: sha512-JIYlbt6g8i5jKfJ3xz7rF0LXmv2TkDxBLUkiBeZ7bAx4GnnNMr8xFpGnOxn6GhTEHx3SjRrZEoU+j04prX1ktg==} + minimatch@10.0.1: + resolution: {integrity: sha512-ethXTt3SGGR+95gudmqJ1eNhRO7eGEGIgYA9vnPatK4/etz2MEVDno5GMCibdMTuBMyElzIlgxMna3K94XDIDQ==} + engines: {node: 20 || >=22} + minimatch@3.1.2: resolution: {integrity: sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==} @@ -9774,6 +9811,12 @@ packages: resolution: {integrity: sha512-7x81NCL719oNbsq/3mh+hVrAWmFuEYUqrq/Iw3kUzH8ReypT9QQ0BLoJS7/G9k6N81XjW4qHWtjWwe/9eLy1EQ==} engines: {node: '>=12'} + openapi-fetch@0.10.6: + resolution: {integrity: sha512-6xXfvIEL/POtLGOaFPsp3O+pDe+J3DZYxbD9BrsQHXOTeNK8z/gsWHT6adUy1KcpQOhmkerMzlQrJM6DbN55dQ==} + + openapi-typescript-helpers@0.0.11: + resolution: {integrity: sha512-xofUHlVFq+BMquf3nh9I8N2guHckW6mrDO/F3kaFgrL7MGbjldDnQ9TIT+rkH/+H0LiuO+RuZLnNmsJwsjwUKg==} + opener@1.5.2: resolution: {integrity: sha512-ur5UIdyw5Y7yEj9wLzhqXiy6GZ3Mwx0yGI+5sMn2r0N0v3cKJvUmFH5yPP+WXh9e0xfyzyJX95D8l088DNFj7A==} hasBin: true @@ -9961,6 +10004,10 @@ packages: resolution: {integrity: sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==} engines: {node: '>=16 || 14 >=14.18'} + path-scurry@2.0.0: + resolution: {integrity: sha512-ypGJsmGtdXUOeM5u93TyeIEfEhM6s+ljAhrk5vAvSx8uyY/02OvrZnA0YNGUrPXfpJMgI1ODd3nwz8Npx4O4cg==} + engines: {node: 20 || >=22} + path-to-regexp@0.1.10: resolution: {integrity: sha512-7lf7qcQidTku0Gu3YDPc8DJ1q7OOucfa/BSsIwjuh56VU7katFvuM8hULfkwB3Fns/rsVF7PwPKVw1sl5KQS9w==} @@ -11610,6 +11657,9 @@ packages: resolution: {integrity: sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ==} engines: {node: '>=18'} + string.fromcodepoint@0.2.1: + resolution: {integrity: sha512-n69H31OnxSGSZyZbgBlvYIXlrMhJQ0dQAX1js1QDhpaUH6zmU3QYlj07bCwCNlPOu3oRXIubGPl2gDGnHsiCqg==} + string.prototype.includes@2.0.1: resolution: {integrity: sha512-o7+c9bW6zpAdJHTtujeePODAhkuicdAryFsfVKwA+wGw89wJ4GTY484WTucM9hLtDEOpOvI+aHnzqnC5lHp4Rg==} engines: {node: '>= 0.4'} @@ -11750,6 +11800,7 @@ packages: sudo-prompt@9.2.1: resolution: {integrity: sha512-Mu7R0g4ig9TUuGSxJavny5Rv0egCEtpZRNMrZaYS1vxkiIxGiGUwoezU3LazIQ+KE04hTrTfNPgxU5gzi7F5Pw==} + deprecated: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info. superstruct@1.0.4: resolution: {integrity: sha512-7JpaAoX2NGyoFlI9NBh66BQXGONc+uE+MRS5i2iOBKuS4e+ccgMDjATgZldkah+33DakBxDHiss9kvUcGAO8UQ==} @@ -12222,6 +12273,9 @@ packages: unenv@1.10.0: resolution: {integrity: sha512-wY5bskBQFL9n3Eca5XnhH6KbUo/tfvkwm9OpcdCvLaeA7piBNbavbOKJySEwQ1V0RH6HvNlSAFRTpvTqgKRQXQ==} + unescape-js@1.1.4: + resolution: {integrity: sha512-42SD8NOQEhdYntEiUQdYq/1V/YHwr1HLwlHuTJB5InVVdOSbgI6xu8jK5q65yIzuFCfczzyDF/7hbGzVbyCw0g==} + unicode-canonical-property-names-ecmascript@2.0.1: resolution: {integrity: sha512-dA8WbNeb2a6oQzAQ55YlT5vQAWGV9WXOsi3SskE3bcCdM0P4SDd+24zS/OCacdRq5BkdsRj9q3Pg6YyQoxIGqg==} engines: {node: '>=4'} @@ -12526,6 +12580,12 @@ packages: vm-browserify@1.1.2: resolution: {integrity: sha512-2ham8XPWTONajOR0ohOKOHXkm3+gaBmGut3SRuu75xLd/RRaY6vqgh8NBYYk7+RW3u5AtzPQZG8F10LHkl0lAQ==} + vscode-oniguruma@2.0.1: + resolution: {integrity: sha512-poJU8iHIWnC3vgphJnrLZyI3YdqRlR27xzqDmpPXYzA93R4Gk8z7T6oqDzDoHjoikA2aS82crdXFkjELCdJsjQ==} + + vscode-textmate@9.2.0: + resolution: {integrity: sha512-rkvG4SraZQaPSN/5XjwKswdU0OP9MF28QjrYzUBbhb8QyG3ljB1Ky996m++jiI7KdiAP2CkBiQZd9pqEDTClqA==} + w3c-xmlserializer@4.0.0: resolution: {integrity: sha512-d+BFHzbiCx6zGfz0HyQ6Rg69w9k19nviJspaj4yNscGjrHu94sVP+aRm75yEbCh+r2/yR+7q6hux9LVtbuTGBw==} engines: {node: '>=14'} @@ -12884,6 +12944,10 @@ packages: yauzl@2.10.0: resolution: {integrity: sha512-p4a9I6X6nu6IhoGmBqAcbJy1mlC4j27vEPZX9F4L4/vZT3Lyq1VkFHw/V/PUcB9Buo+DG3iHkT0x3Qya58zc3g==} + yauzl@3.2.0: + resolution: {integrity: sha512-Ow9nuGZE+qp1u4JIPvg+uCiUr7xGQWdff7JQSk5VGYTAZMDe2q8lxJ10ygv10qmSj031Ty/6FNJpLO4o1Sgc+w==} + engines: {node: '>=12'} + ylru@1.4.0: resolution: {integrity: sha512-2OQsPNEmBCvXuFlIni/a+Rn+R2pHW9INm0BxXJ4hVDA8TirqMj+J/Rp9ItLatT/5pZqWwefVrTQcHpixsxnVlA==} engines: {node: '>= 4.0.0'} @@ -18268,8 +18332,27 @@ snapshots: '@tokenizer/token@0.3.0': {} + '@tolgee/cli@2.3.1(typescript@5.6.3)': + dependencies: + ansi-colors: 4.1.3 + base32-decode: 1.0.0 + commander: 12.1.0 + cosmiconfig: 9.0.0(typescript@5.6.3) + glob: 11.0.0 + json5: 2.2.3 + jsonschema: 1.4.1 + openapi-fetch: 0.10.6 + unescape-js: 1.1.4 + vscode-oniguruma: 2.0.1 + vscode-textmate: 9.2.0 + yauzl: 3.2.0 + transitivePeerDependencies: + - typescript + '@tolgee/core@5.31.5': {} + '@tolgee/format-icu@5.31.1': {} + '@tolgee/react@5.31.5(react@18.3.1)': dependencies: '@tolgee/web': 5.31.5 @@ -18981,13 +19064,13 @@ snapshots: loupe: 3.1.2 tinyrainbow: 1.2.0 - '@wagmi/connectors@5.4.0(@types/react@18.3.12)(@wagmi/core@2.14.6(@tanstack/query-core@5.60.5)(@types/react@18.3.12)(react@18.3.1)(typescript@5.6.3)(use-sync-external-store@1.2.2(react@18.3.1))(viem@2.21.48(bufferutil@4.0.8)(typescript@5.6.3)(utf-8-validate@5.0.10)(zod@3.23.8)))(bufferutil@4.0.8)(encoding@0.1.13)(react-dom@18.3.1(react@18.3.1))(react-native@0.76.2(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))(@react-native-community/cli-server-api@14.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(@types/react@18.3.12)(bufferutil@4.0.8)(encoding@0.1.13)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1)(typescript@5.6.3)(utf-8-validate@5.0.10)(viem@2.21.48(bufferutil@4.0.8)(typescript@5.6.3)(utf-8-validate@5.0.10)(zod@3.23.8))(zod@3.23.8)': + '@wagmi/connectors@5.4.0(@types/react@18.3.12)(@wagmi/core@2.14.6(@tanstack/query-core@5.60.5)(@types/react@18.3.12)(react@18.3.1)(typescript@5.6.3)(use-sync-external-store@1.2.0(react@18.3.1))(viem@2.21.48(bufferutil@4.0.8)(typescript@5.6.3)(utf-8-validate@5.0.10)(zod@3.23.8)))(bufferutil@4.0.8)(encoding@0.1.13)(react-dom@18.3.1(react@18.3.1))(react-native@0.76.2(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))(@react-native-community/cli-server-api@14.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(@types/react@18.3.12)(bufferutil@4.0.8)(encoding@0.1.13)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1)(typescript@5.6.3)(utf-8-validate@5.0.10)(viem@2.21.48(bufferutil@4.0.8)(typescript@5.6.3)(utf-8-validate@5.0.10)(zod@3.23.8))(zod@3.23.8)': dependencies: '@coinbase/wallet-sdk': 4.2.3 '@metamask/sdk': 0.30.1(bufferutil@4.0.8)(encoding@0.1.13)(react-dom@18.3.1(react@18.3.1))(react-native@0.76.2(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))(@react-native-community/cli-server-api@14.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(@types/react@18.3.12)(bufferutil@4.0.8)(encoding@0.1.13)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1)(utf-8-validate@5.0.10) '@safe-global/safe-apps-provider': 0.18.4(bufferutil@4.0.8)(typescript@5.6.3)(utf-8-validate@5.0.10)(zod@3.23.8) '@safe-global/safe-apps-sdk': 9.1.0(bufferutil@4.0.8)(typescript@5.6.3)(utf-8-validate@5.0.10)(zod@3.23.8) - '@wagmi/core': 2.14.6(@tanstack/query-core@5.60.5)(@types/react@18.3.12)(react@18.3.1)(typescript@5.6.3)(use-sync-external-store@1.2.2(react@18.3.1))(viem@2.21.48(bufferutil@4.0.8)(typescript@5.6.3)(utf-8-validate@5.0.10)(zod@3.23.8)) + '@wagmi/core': 2.14.6(@tanstack/query-core@5.60.5)(@types/react@18.3.12)(react@18.3.1)(typescript@5.6.3)(use-sync-external-store@1.2.0(react@18.3.1))(viem@2.21.48(bufferutil@4.0.8)(typescript@5.6.3)(utf-8-validate@5.0.10)(zod@3.23.8)) '@walletconnect/ethereum-provider': 2.17.0(@types/react@18.3.12)(bufferutil@4.0.8)(encoding@0.1.13)(react@18.3.1)(utf-8-validate@5.0.10) cbw-sdk: '@coinbase/wallet-sdk@3.9.3' viem: 2.21.48(bufferutil@4.0.8)(typescript@5.6.3)(utf-8-validate@5.0.10)(zod@3.23.8) @@ -19934,6 +20017,8 @@ snapshots: dependencies: safe-buffer: 5.2.1 + base32-decode@1.0.0: {} + base64-js@1.5.1: {} basic-auth@2.0.1: @@ -21665,8 +21750,8 @@ snapshots: '@typescript-eslint/parser': 7.18.0(eslint@8.57.0)(typescript@5.6.3) eslint: 8.57.0 eslint-import-resolver-node: 0.3.9 - eslint-import-resolver-typescript: 3.6.3(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.31.0(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.6.3))(eslint@8.57.0))(eslint@8.57.0) - eslint-plugin-import: 2.31.0(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.6.3))(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.31.0(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.6.3))(eslint@8.57.0))(eslint@8.57.0))(eslint@8.57.0) + eslint-import-resolver-typescript: 3.6.3(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.31.0)(eslint@8.57.0) + eslint-plugin-import: 2.31.0(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.6.3))(eslint-import-resolver-typescript@3.6.3)(eslint@8.57.0) eslint-plugin-jsx-a11y: 6.10.2(eslint@8.57.0) eslint-plugin-react: 7.37.2(eslint@8.57.0) eslint-plugin-react-hooks: 4.6.2(eslint@8.57.0) @@ -21689,33 +21774,33 @@ snapshots: transitivePeerDependencies: - supports-color - eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.31.0(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.6.3))(eslint@8.57.0))(eslint@8.57.0): + eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.31.0)(eslint@8.57.0): dependencies: '@nolyfill/is-core-module': 1.0.39 debug: 4.3.7(supports-color@8.1.1) enhanced-resolve: 5.17.1 eslint: 8.57.0 - eslint-module-utils: 2.12.0(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.31.0(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.6.3))(eslint@8.57.0))(eslint@8.57.0))(eslint@8.57.0) + eslint-module-utils: 2.12.0(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.31.0)(eslint@8.57.0))(eslint@8.57.0) fast-glob: 3.3.2 get-tsconfig: 4.8.1 is-bun-module: 1.2.1 is-glob: 4.0.3 optionalDependencies: - eslint-plugin-import: 2.31.0(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.6.3))(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.31.0(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.6.3))(eslint@8.57.0))(eslint@8.57.0))(eslint@8.57.0) + eslint-plugin-import: 2.31.0(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.6.3))(eslint-import-resolver-typescript@3.6.3)(eslint@8.57.0) transitivePeerDependencies: - '@typescript-eslint/parser' - eslint-import-resolver-node - eslint-import-resolver-webpack - supports-color - eslint-module-utils@2.12.0(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.31.0(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.6.3))(eslint@8.57.0))(eslint@8.57.0))(eslint@8.57.0): + eslint-module-utils@2.12.0(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.31.0)(eslint@8.57.0))(eslint@8.57.0): dependencies: debug: 3.2.7(supports-color@8.1.1) optionalDependencies: '@typescript-eslint/parser': 7.18.0(eslint@8.57.0)(typescript@5.6.3) eslint: 8.57.0 eslint-import-resolver-node: 0.3.9 - eslint-import-resolver-typescript: 3.6.3(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.31.0(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.6.3))(eslint@8.57.0))(eslint@8.57.0) + eslint-import-resolver-typescript: 3.6.3(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.31.0)(eslint@8.57.0) transitivePeerDependencies: - supports-color @@ -21729,7 +21814,7 @@ snapshots: lodash: 4.17.21 requireindex: 1.1.0 - eslint-plugin-import@2.31.0(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.6.3))(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.31.0(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.6.3))(eslint@8.57.0))(eslint@8.57.0))(eslint@8.57.0): + eslint-plugin-import@2.31.0(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.6.3))(eslint-import-resolver-typescript@3.6.3)(eslint@8.57.0): dependencies: '@rtsao/scc': 1.1.0 array-includes: 3.1.8 @@ -21740,7 +21825,7 @@ snapshots: doctrine: 2.1.0 eslint: 8.57.0 eslint-import-resolver-node: 0.3.9 - eslint-module-utils: 2.12.0(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.31.0(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.6.3))(eslint@8.57.0))(eslint@8.57.0))(eslint@8.57.0) + eslint-module-utils: 2.12.0(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.31.0)(eslint@8.57.0))(eslint@8.57.0) hasown: 2.0.2 is-core-module: 2.15.1 is-glob: 4.0.3 @@ -22578,6 +22663,15 @@ snapshots: package-json-from-dist: 1.0.1 path-scurry: 1.11.1 + glob@11.0.0: + dependencies: + foreground-child: 3.3.0 + jackspeak: 4.0.2 + minimatch: 10.0.1 + minipass: 7.1.2 + package-json-from-dist: 1.0.1 + path-scurry: 2.0.0 + glob@7.2.3: dependencies: fs.realpath: 1.0.0 @@ -23388,6 +23482,10 @@ snapshots: optionalDependencies: '@pkgjs/parseargs': 0.11.0 + jackspeak@4.0.2: + dependencies: + '@isaacs/cliui': 8.0.2 + jake@10.9.2: dependencies: async: 3.2.6 @@ -23927,6 +24025,8 @@ snapshots: jsonparse@1.3.1: {} + jsonschema@1.4.1: {} + jsprim@2.0.2: dependencies: assert-plus: 1.0.0 @@ -24256,6 +24356,8 @@ snapshots: lru-cache@10.4.3: {} + lru-cache@11.0.2: {} + lru-cache@4.1.5: dependencies: pseudomap: 1.0.2 @@ -24591,6 +24693,10 @@ snapshots: minimalistic-crypto-utils@1.0.1: {} + minimatch@10.0.1: + dependencies: + brace-expansion: 2.0.1 + minimatch@3.1.2: dependencies: brace-expansion: 1.1.11 @@ -25094,6 +25200,12 @@ snapshots: is-docker: 2.2.1 is-wsl: 2.2.0 + openapi-fetch@0.10.6: + dependencies: + openapi-typescript-helpers: 0.0.11 + + openapi-typescript-helpers@0.0.11: {} + opener@1.5.2: {} optionator@0.9.4: @@ -25295,6 +25407,11 @@ snapshots: lru-cache: 10.4.3 minipass: 7.1.2 + path-scurry@2.0.0: + dependencies: + lru-cache: 11.0.2 + minipass: 7.1.2 + path-to-regexp@0.1.10: {} path-to-regexp@1.9.0: @@ -27128,6 +27245,8 @@ snapshots: get-east-asian-width: 1.3.0 strip-ansi: 7.1.0 + string.fromcodepoint@0.2.1: {} + string.prototype.includes@2.0.1: dependencies: call-bind: 1.0.7 @@ -27799,6 +27918,10 @@ snapshots: node-fetch-native: 1.6.4 pathe: 1.1.2 + unescape-js@1.1.4: + dependencies: + string.fromcodepoint: 0.2.1 + unicode-canonical-property-names-ecmascript@2.0.1: {} unicode-match-property-ecmascript@2.0.0: @@ -28082,6 +28205,10 @@ snapshots: vm-browserify@1.1.2: {} + vscode-oniguruma@2.0.1: {} + + vscode-textmate@9.2.0: {} + w3c-xmlserializer@4.0.0: dependencies: xml-name-validator: 4.0.0 @@ -28094,7 +28221,7 @@ snapshots: wagmi@2.12.33(@tanstack/query-core@5.60.5)(@tanstack/react-query@5.60.5(react@18.3.1))(@types/react@18.3.12)(bufferutil@4.0.8)(encoding@0.1.13)(react-dom@18.3.1(react@18.3.1))(react-native@0.76.2(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))(@react-native-community/cli-server-api@14.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(@types/react@18.3.12)(bufferutil@4.0.8)(encoding@0.1.13)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1)(typescript@5.6.3)(utf-8-validate@5.0.10)(viem@2.21.48(bufferutil@4.0.8)(typescript@5.6.3)(utf-8-validate@5.0.10)(zod@3.23.8))(zod@3.23.8): dependencies: '@tanstack/react-query': 5.60.5(react@18.3.1) - '@wagmi/connectors': 5.4.0(@types/react@18.3.12)(@wagmi/core@2.14.6(@tanstack/query-core@5.60.5)(@types/react@18.3.12)(react@18.3.1)(typescript@5.6.3)(use-sync-external-store@1.2.2(react@18.3.1))(viem@2.21.48(bufferutil@4.0.8)(typescript@5.6.3)(utf-8-validate@5.0.10)(zod@3.23.8)))(bufferutil@4.0.8)(encoding@0.1.13)(react-dom@18.3.1(react@18.3.1))(react-native@0.76.2(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))(@react-native-community/cli-server-api@14.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(@types/react@18.3.12)(bufferutil@4.0.8)(encoding@0.1.13)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1)(typescript@5.6.3)(utf-8-validate@5.0.10)(viem@2.21.48(bufferutil@4.0.8)(typescript@5.6.3)(utf-8-validate@5.0.10)(zod@3.23.8))(zod@3.23.8) + '@wagmi/connectors': 5.4.0(@types/react@18.3.12)(@wagmi/core@2.14.6(@tanstack/query-core@5.60.5)(@types/react@18.3.12)(react@18.3.1)(typescript@5.6.3)(use-sync-external-store@1.2.0(react@18.3.1))(viem@2.21.48(bufferutil@4.0.8)(typescript@5.6.3)(utf-8-validate@5.0.10)(zod@3.23.8)))(bufferutil@4.0.8)(encoding@0.1.13)(react-dom@18.3.1(react@18.3.1))(react-native@0.76.2(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))(@react-native-community/cli-server-api@14.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(@types/react@18.3.12)(bufferutil@4.0.8)(encoding@0.1.13)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1)(typescript@5.6.3)(utf-8-validate@5.0.10)(viem@2.21.48(bufferutil@4.0.8)(typescript@5.6.3)(utf-8-validate@5.0.10)(zod@3.23.8))(zod@3.23.8) '@wagmi/core': 2.14.6(@tanstack/query-core@5.60.5)(@types/react@18.3.12)(react@18.3.1)(typescript@5.6.3)(use-sync-external-store@1.2.0(react@18.3.1))(viem@2.21.48(bufferutil@4.0.8)(typescript@5.6.3)(utf-8-validate@5.0.10)(zod@3.23.8)) react: 18.3.1 use-sync-external-store: 1.2.0(react@18.3.1) @@ -28514,6 +28641,11 @@ snapshots: buffer-crc32: 0.2.13 fd-slicer: 1.1.0 + yauzl@3.2.0: + dependencies: + buffer-crc32: 0.2.13 + pend: 1.2.0 + ylru@1.4.0: {} yn@3.1.1: {} From fa22f0c9ea7446d6927e2301e127123e52a70bff Mon Sep 17 00:00:00 2001 From: viktoriabakun Date: Mon, 6 Jan 2025 16:05:39 +0100 Subject: [PATCH 20/22] chore: format and lint code Signed-off-by: viktoriabakun --- apps/shell/messages/authz/ru.json | 22 ++++++------ apps/shell/messages/faucet/en.json | 20 +++++------ apps/shell/messages/main/en.json | 36 +++++++++---------- apps/shell/messages/utils/en.json | 8 ++--- .../src/lib/address-conversion-page.tsx | 1 - .../src/lib/components/delegation-list.tsx | 1 - .../src/lib/components/delegations-block.tsx | 1 - .../src/lib/components/my-account-block.tsx | 6 +++- .../lib/components/delegate-modal-hooked.tsx | 3 +- .../src/lib/components/staking-info.tsx | 1 - .../stride/liquid-staking-delegate-modal.tsx | 2 -- .../components/undelegate-modal-hooked.tsx | 3 +- .../src/lib/components/validator-list.tsx | 1 - libs/ucdao/src/lib/ucdao-page-balance.tsx | 11 +++--- libs/ui-kit/src/lib/card.stories.tsx | 1 - libs/ui-kit/src/lib/footer.tsx | 1 - libs/ui-kit/src/lib/modal.stories.tsx | 1 - libs/ui-kit/src/lib/tooltip.stories.tsx | 1 - 18 files changed, 57 insertions(+), 63 deletions(-) diff --git a/apps/shell/messages/authz/ru.json b/apps/shell/messages/authz/ru.json index 59fff290f..90370696c 100644 --- a/apps/shell/messages/authz/ru.json +++ b/apps/shell/messages/authz/ru.json @@ -1,12 +1,12 @@ { - "access-you-granted" : "Доступ, который вы предоставили", - "five-years" : "5 лет", - "hundred-years" : "100 лет", - "one-month" : "1 месяц", - "one-week" : "1 неделя", - "one-year" : "1 год", - "revoke-button" : "Отозвать", - "revoke-loading" : "Отзыв в процессе", - "six-months" : "6 месяцев", - "three-months" : "3 месяца" -} \ No newline at end of file + "access-you-granted": "Доступ, который вы предоставили", + "five-years": "5 лет", + "hundred-years": "100 лет", + "one-month": "1 месяц", + "one-week": "1 неделя", + "one-year": "1 год", + "revoke-button": "Отозвать", + "revoke-loading": "Отзыв в процессе", + "six-months": "6 месяцев", + "three-months": "3 месяца" +} diff --git a/apps/shell/messages/faucet/en.json b/apps/shell/messages/faucet/en.json index 2e34a33de..fa05ff121 100644 --- a/apps/shell/messages/faucet/en.json +++ b/apps/shell/messages/faucet/en.json @@ -1,11 +1,11 @@ { - "claim-tokens" : "Claim tokens", - "faucet" : "Faucet", - "github" : "Github", - "login-github" : "Login with github", - "next-token-request-available" : "Next request tokens available after", - "request-tokens" : "Request tokens", - "switch-chain" : "Switch to {chain}", - "tokens-claimed" : "Tokens claimed", - "wallet" : "Wallet" -} \ No newline at end of file + "claim-tokens": "Claim tokens", + "faucet": "Faucet", + "github": "Github", + "login-github": "Login with github", + "next-token-request-available": "Next request tokens available after", + "request-tokens": "Request tokens", + "switch-chain": "Switch to {chain}", + "tokens-claimed": "Tokens claimed", + "wallet": "Wallet" +} diff --git a/apps/shell/messages/main/en.json b/apps/shell/messages/main/en.json index 2cdf7b237..c51cb5506 100644 --- a/apps/shell/messages/main/en.json +++ b/apps/shell/messages/main/en.json @@ -1,19 +1,19 @@ { - "accounts" : "Accounts", - "active-out-of-total" : "{active} out of {total}", - "active-validators" : "Active validators", - "available-for-stake" : "Available: {amount}", - "available-staking" : "Available for staking", - "fetching-validators" : "Fetching validators list", - "latest-proposals" : "Latest proposals", - "link-to-governance" : "Go to Governance", - "link-to-staking" : "Go to Staking", - "liquid-staked" : "Liquid staked", - "locked" : "Locked: {amount}", - "no-delegations" : "You don't have any active delegations", - "regular-staked" : "Regular staked", - "shell-title" : "Shell", - "staking-balance-popup-message" : "In regular staking you can use coins in liquid staking", - "total-staked" : "Total staked", - "total-supply" : "Total supply" -} \ No newline at end of file + "accounts": "Accounts", + "active-out-of-total": "{active} out of {total}", + "active-validators": "Active validators", + "available-for-stake": "Available: {amount}", + "available-staking": "Available for staking", + "fetching-validators": "Fetching validators list", + "latest-proposals": "Latest proposals", + "link-to-governance": "Go to Governance", + "link-to-staking": "Go to Staking", + "liquid-staked": "Liquid staked", + "locked": "Locked: {amount}", + "no-delegations": "You don't have any active delegations", + "regular-staked": "Regular staked", + "shell-title": "Shell", + "staking-balance-popup-message": "In regular staking you can use coins in liquid staking", + "total-staked": "Total staked", + "total-supply": "Total supply" +} diff --git a/apps/shell/messages/utils/en.json b/apps/shell/messages/utils/en.json index f034fd9bc..df47b4c9a 100644 --- a/apps/shell/messages/utils/en.json +++ b/apps/shell/messages/utils/en.json @@ -1,5 +1,5 @@ { - "address-conversion-title" : "Address Conversion", - "converted-address-label" : "Converted address", - "invalid-address" : "Please enter a valid address" -} \ No newline at end of file + "address-conversion-title": "Address Conversion", + "converted-address-label": "Converted address", + "invalid-address": "Please enter a valid address" +} diff --git a/libs/address-conversion/src/lib/address-conversion-page.tsx b/libs/address-conversion/src/lib/address-conversion-page.tsx index 42d7ed702..75e67ffe0 100644 --- a/libs/address-conversion/src/lib/address-conversion-page.tsx +++ b/libs/address-conversion/src/lib/address-conversion-page.tsx @@ -104,7 +104,6 @@ export function AddressConversionPage() {
- {/* eslint-disable-next-line i18next/no-literal-string */} Bech32 / EVM diff --git a/libs/main/src/lib/components/delegation-list.tsx b/libs/main/src/lib/components/delegation-list.tsx index 55c52967c..ff9936fd5 100644 --- a/libs/main/src/lib/components/delegation-list.tsx +++ b/libs/main/src/lib/components/delegation-list.tsx @@ -205,7 +205,6 @@ export function ShellIndexPageDelegationList() {
)} - {/* eslint-disable-next-line i18next/no-literal-string */} {status === 'error' &&

Error: {(error as Error).message}

} {status === 'success' && (
diff --git a/libs/main/src/lib/components/delegations-block.tsx b/libs/main/src/lib/components/delegations-block.tsx index 54a7732cb..fe0493e0d 100644 --- a/libs/main/src/lib/components/delegations-block.tsx +++ b/libs/main/src/lib/components/delegations-block.tsx @@ -76,7 +76,6 @@ export function DelegationsBlock({ )}
*/} - {/* eslint-disable-next-line i18next/no-literal-string */} {status === 'error' &&

Error: {(error as Error).message}

} {status === 'success' && ( diff --git a/libs/main/src/lib/components/my-account-block.tsx b/libs/main/src/lib/components/my-account-block.tsx index 6dc617c12..9455c23dc 100644 --- a/libs/main/src/lib/components/my-account-block.tsx +++ b/libs/main/src/lib/components/my-account-block.tsx @@ -163,7 +163,11 @@ function MyAccountConnected({ handleMouseLeave: handleMouseLeaveLiquidStaking, } = useHoverPopover(100); - const lockedTokensDescription = t('about-locked-tokens', 'Locked tokens are your tokens but you cannot transfer to other users or use them to pay for gas, but you can delegate to validators - stake to improve the reliability of the HAQQ network, and make a profit. Locked tokens are unlocked according to the schedule.', { ns: 'main'}) + const lockedTokensDescription = t( + 'about-locked-tokens', + 'Locked tokens are your tokens but you cannot transfer to other users or use them to pay for gas, but you can delegate to validators - stake to improve the reliability of the HAQQ network, and make a profit. Locked tokens are unlocked according to the schedule.', + { ns: 'main' }, + ); if (!balances) { return null; diff --git a/libs/staking/src/lib/components/delegate-modal-hooked.tsx b/libs/staking/src/lib/components/delegate-modal-hooked.tsx index b111e568f..b9330c745 100644 --- a/libs/staking/src/lib/components/delegate-modal-hooked.tsx +++ b/libs/staking/src/lib/components/delegate-modal-hooked.tsx @@ -48,7 +48,8 @@ export function DelegateModalHooked({ validatorCommission, }: DelegateModalProps) { const { t } = useTranslate('staking'); - const { delegate, getDelegateEstimatedFee, approveStaking } = useStakingActions(); + const { delegate, getDelegateEstimatedFee, approveStaking } = + useStakingActions(); const [delegateAmount, setDelegateAmount] = useState( undefined, ); diff --git a/libs/staking/src/lib/components/staking-info.tsx b/libs/staking/src/lib/components/staking-info.tsx index f5bfa473e..91eb8c28e 100644 --- a/libs/staking/src/lib/components/staking-info.tsx +++ b/libs/staking/src/lib/components/staking-info.tsx @@ -1,6 +1,5 @@ 'use client'; import { useMemo } from 'react'; -import { useCallback, useEffect, useMemo, useState } from 'react'; import { useTranslate } from '@tolgee/react'; import clsx from 'clsx'; import { useMediaQuery } from 'usehooks-ts'; diff --git a/libs/staking/src/lib/components/stride/liquid-staking-delegate-modal.tsx b/libs/staking/src/lib/components/stride/liquid-staking-delegate-modal.tsx index 32c995604..e93d29608 100644 --- a/libs/staking/src/lib/components/stride/liquid-staking-delegate-modal.tsx +++ b/libs/staking/src/lib/components/stride/liquid-staking-delegate-modal.tsx @@ -303,7 +303,6 @@ export function LiquidStakingDelegateModal({ {t('you-will-get', "What you'll get:", { ns: 'staking' })}
- {/* eslint-disable-next-line i18next/no-literal-string */} {formatNumber(stIslmFormIslm)} stISLM
@@ -316,7 +315,6 @@ export function LiquidStakingDelegateModal({ })}
- {/* eslint-disable-next-line i18next/no-literal-string */} {formatNumber(annualizedYield)} stISLM
diff --git a/libs/staking/src/lib/components/undelegate-modal-hooked.tsx b/libs/staking/src/lib/components/undelegate-modal-hooked.tsx index b4ba6b4a7..3eb939974 100644 --- a/libs/staking/src/lib/components/undelegate-modal-hooked.tsx +++ b/libs/staking/src/lib/components/undelegate-modal-hooked.tsx @@ -45,7 +45,8 @@ export function UndelegateModalHooked({ validatorAddress, }: UndelegateModalProps) { const { t } = useTranslate('staking'); - const { undelegate, getUndelegateEstimatedFee, approveStaking } = useStakingActions(); + const { undelegate, getUndelegateEstimatedFee, approveStaking } = + useStakingActions(); const [undelegateAmount, setUndelegateAmount] = useState( undefined, ); diff --git a/libs/staking/src/lib/components/validator-list.tsx b/libs/staking/src/lib/components/validator-list.tsx index 40c4d7c99..5add28439 100644 --- a/libs/staking/src/lib/components/validator-list.tsx +++ b/libs/staking/src/lib/components/validator-list.tsx @@ -195,7 +195,6 @@ export function ValidatorList({ )} {status === 'error' && ( - // eslint-disable-next-line i18next/no-literal-string

Error: {error?.message ?? 'unknown error'}

)} diff --git a/libs/ucdao/src/lib/ucdao-page-balance.tsx b/libs/ucdao/src/lib/ucdao-page-balance.tsx index 6cc8068d2..5ab4f8dc6 100644 --- a/libs/ucdao/src/lib/ucdao-page-balance.tsx +++ b/libs/ucdao/src/lib/ucdao-page-balance.tsx @@ -1,7 +1,4 @@ 'use client'; -import { useState } from 'react'; -import { useTranslate } from '@tolgee/react'; -import { formatUnits } from 'viem'; import { useMemo, useState } from 'react'; import { Coin } from '@evmos/provider'; import { useTranslate } from '@tolgee/react'; @@ -54,14 +51,16 @@ export function DaoPageBalance() {
- {filteredBankBalances?.length > 0 && ( + {filteredBankBalances && filteredBankBalances.length > 0 && ( )} - {filteredDaoBalances?.length > 0 && ( + {filteredDaoBalances && filteredDaoBalances.length > 0 && ( dev diff --git a/libs/ui-kit/src/lib/modal.stories.tsx b/libs/ui-kit/src/lib/modal.stories.tsx index 318dfe8fe..f021caca6 100644 --- a/libs/ui-kit/src/lib/modal.stories.tsx +++ b/libs/ui-kit/src/lib/modal.stories.tsx @@ -1,4 +1,3 @@ -/* eslint-disable i18next/no-literal-string */ import { Fragment, useState } from 'react'; import { Meta } from '@storybook/react'; import { Button } from './button'; diff --git a/libs/ui-kit/src/lib/tooltip.stories.tsx b/libs/ui-kit/src/lib/tooltip.stories.tsx index 58223601b..8eba77664 100644 --- a/libs/ui-kit/src/lib/tooltip.stories.tsx +++ b/libs/ui-kit/src/lib/tooltip.stories.tsx @@ -16,7 +16,6 @@ export const Tooltip: Story = { args: { children: 'Hover me!', text: ( - // eslint-disable-next-line i18next/no-literal-string
Lorem ipsum dolor sit, amet consectetur adipisicing elit.
From 2f993f5e71715e53b5a7c0037127e5dec2f33e07 Mon Sep 17 00:00:00 2001 From: viktoriabakun Date: Mon, 6 Jan 2025 17:03:29 +0100 Subject: [PATCH 21/22] feat: add new translations Signed-off-by: viktoriabakun --- libs/staking/src/lib/components/delegate-modal.tsx | 4 ++-- .../staking/src/lib/components/redelegate-modal.tsx | 2 +- .../src/lib/components/safe-approve-warning.tsx | 13 +++++++++++-- .../staking/src/lib/components/undelegate-modal.tsx | 2 +- 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/libs/staking/src/lib/components/delegate-modal.tsx b/libs/staking/src/lib/components/delegate-modal.tsx index a7f21de3c..e0aa36db3 100644 --- a/libs/staking/src/lib/components/delegate-modal.tsx +++ b/libs/staking/src/lib/components/delegate-modal.tsx @@ -304,7 +304,7 @@ export function DelegateModal({ variant={4} className="w-full" > - Approve + {t('approve-button', 'Approve', { ns: 'staking' })}
@@ -317,7 +317,7 @@ export function DelegateModal({ className="w-full" disabled={isDisabled} > - {t('delegate', 'Delegate')} + {t('delegate', 'Delegate', { ns: 'common' })}
diff --git a/libs/staking/src/lib/components/redelegate-modal.tsx b/libs/staking/src/lib/components/redelegate-modal.tsx index e2456c060..b1e34f6c9 100644 --- a/libs/staking/src/lib/components/redelegate-modal.tsx +++ b/libs/staking/src/lib/components/redelegate-modal.tsx @@ -260,7 +260,7 @@ export function RedelegateModal({ variant={4} className="w-full" > - Approve + {t('approve-button', 'Approve', { ns: 'staking' })}
diff --git a/libs/staking/src/lib/components/safe-approve-warning.tsx b/libs/staking/src/lib/components/safe-approve-warning.tsx index 956d2f6e5..3fb45107f 100644 --- a/libs/staking/src/lib/components/safe-approve-warning.tsx +++ b/libs/staking/src/lib/components/safe-approve-warning.tsx @@ -1,8 +1,17 @@ +import { T } from '@tolgee/react'; + export function SafeApproveWarning() { return (
- Warning: In SAFE, the sender of the transaction (executing the - transaction) must necessarily do Approve before proceeding. + , + }} + />
); } diff --git a/libs/staking/src/lib/components/undelegate-modal.tsx b/libs/staking/src/lib/components/undelegate-modal.tsx index cb44d1bad..3f69f6152 100644 --- a/libs/staking/src/lib/components/undelegate-modal.tsx +++ b/libs/staking/src/lib/components/undelegate-modal.tsx @@ -222,7 +222,7 @@ export function UndelegateModal({ variant={4} className="w-full" > - Approve + {t('approve-button', 'Approve', { ns: 'staking' })}
From ec2cbd71e5a974598a400ae2262a4909f0210cb4 Mon Sep 17 00:00:00 2001 From: viktoriabakun Date: Mon, 13 Jan 2025 12:26:24 +0100 Subject: [PATCH 22/22] fix: tolgee provider place in the layout Signed-off-by: viktoriabakun --- apps/shell/src/providers/app-providers.tsx | 10 +++++----- libs/ui-kit/src/lib/footer.tsx | 1 + 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/apps/shell/src/providers/app-providers.tsx b/apps/shell/src/providers/app-providers.tsx index 39c6d7bef..be1e3cad5 100644 --- a/apps/shell/src/providers/app-providers.tsx +++ b/apps/shell/src/providers/app-providers.tsx @@ -46,15 +46,15 @@ export function AppProviders({ - - + + {children} - - - + + + diff --git a/libs/ui-kit/src/lib/footer.tsx b/libs/ui-kit/src/lib/footer.tsx index f5141b699..0f4f8831e 100644 --- a/libs/ui-kit/src/lib/footer.tsx +++ b/libs/ui-kit/src/lib/footer.tsx @@ -1,3 +1,4 @@ +'use client'; import { useTranslate } from '@tolgee/react'; import Link from 'next/link'; import { Container } from './container';