From 01c6af2ca78de7ac3974f78b2d5c221ec66ab1e8 Mon Sep 17 00:00:00 2001 From: Anish Date: Fri, 14 Jun 2024 16:14:28 +0500 Subject: [PATCH] improvement: fix the folder structure (#2609) * improvement: fix the folder structure * improvement: fix the folder structure * improvement: fix the folder structure * improvement: fix the folder structure * improvement: fix the folder structure * improvement: final build --- .cspell.json | 3 ++- apps/web/app/[locale]/layout.tsx | 2 +- .../signin-workspace}/signin-workspace.ts | 0 apps/web/app/constants.ts | 2 +- apps/web/i18n.ts | 2 +- apps/web/{messages => locales}/ar.json | 0 apps/web/{messages => locales}/bg.json | 0 apps/web/{messages => locales}/de.json | 0 apps/web/{messages => locales}/en.json | 0 apps/web/{messages => locales}/es.json | 0 apps/web/{messages => locales}/fr.json | 0 apps/web/{messages => locales}/he.json | 0 apps/web/{messages => locales}/it.json | 0 apps/web/{messages => locales}/nl.json | 0 apps/web/{messages => locales}/pl.json | 0 apps/web/{messages => locales}/pt.json | 0 apps/web/{messages => locales}/ru.json | 0 apps/web/{messages => locales}/zh.json | 0 apps/web/types/local.ts | 26 +++++++++---------- 19 files changed, 18 insertions(+), 17 deletions(-) rename apps/web/{pages/api/auth => app/api/auth/signin-workspace}/signin-workspace.ts (100%) rename apps/web/{messages => locales}/ar.json (100%) rename apps/web/{messages => locales}/bg.json (100%) rename apps/web/{messages => locales}/de.json (100%) rename apps/web/{messages => locales}/en.json (100%) rename apps/web/{messages => locales}/es.json (100%) rename apps/web/{messages => locales}/fr.json (100%) rename apps/web/{messages => locales}/he.json (100%) rename apps/web/{messages => locales}/it.json (100%) rename apps/web/{messages => locales}/nl.json (100%) rename apps/web/{messages => locales}/pl.json (100%) rename apps/web/{messages => locales}/pt.json (100%) rename apps/web/{messages => locales}/ru.json (100%) rename apps/web/{messages => locales}/zh.json (100%) diff --git a/.cspell.json b/.cspell.json index 02ba90f82..b3dc78e37 100644 --- a/.cspell.json +++ b/.cspell.json @@ -383,7 +383,8 @@ "signin", "Chatwoot", "CHATWOOT", - "apps/web/messages/*.json", + "apps/web/locales/*.json", + "apps/web/i18n.ts", "apps/web/lib/i18n/*.ts", "apps/web/lib/settings/timezones.js", "apps/mobile/app/screens/DemoShowroomScreen/demos/**", diff --git a/apps/web/app/[locale]/layout.tsx b/apps/web/app/[locale]/layout.tsx index 5586b1718..5fe73e277 100644 --- a/apps/web/app/[locale]/layout.tsx +++ b/apps/web/app/[locale]/layout.tsx @@ -97,7 +97,7 @@ const LocaleLayout = ({ children, params: { locale }, pageProps }: Props) => { const name = searchParams?.get('name'); // eslint-disable-next-line @typescript-eslint/no-var-requires - const messages = require(`../../messages/${locale}.json`); + const messages = require(`../../locales/${locale}.json`); useEffect(() => { if (!isApiWork && !loading) router.push(`/maintenance`); diff --git a/apps/web/pages/api/auth/signin-workspace.ts b/apps/web/app/api/auth/signin-workspace/signin-workspace.ts similarity index 100% rename from apps/web/pages/api/auth/signin-workspace.ts rename to apps/web/app/api/auth/signin-workspace/signin-workspace.ts diff --git a/apps/web/app/constants.ts b/apps/web/app/constants.ts index efcb8d3dd..879899334 100644 --- a/apps/web/app/constants.ts +++ b/apps/web/app/constants.ts @@ -1,7 +1,7 @@ import { JitsuOptions } from '@jitsu/jitsu-react/dist/useJitsu'; import { I_SMTPRequest } from './interfaces/ISmtp'; import { getNextPublicEnv } from './env'; -import enLanguage from '../messages/en.json'; +import enLanguage from '../locales/en.json'; // import { } from 'country-flag-icons/react/3x2' import { BG, CN, DE, ES, FR, IS, IT, NL, PL, PT, RU, SA, US } from 'country-flag-icons/react/1x1'; export const API_BASE_URL = '/api'; diff --git a/apps/web/i18n.ts b/apps/web/i18n.ts index 40b1270c7..3421e560e 100644 --- a/apps/web/i18n.ts +++ b/apps/web/i18n.ts @@ -11,5 +11,5 @@ import { getRequestConfig } from 'next-intl/server'; // })); export default getRequestConfig(async ({ locale }) => ({ - messages: (await import(`./messages/${locale}.json`)).default + messages: (await import(`./locales/${locale}.json`)).default })); diff --git a/apps/web/messages/ar.json b/apps/web/locales/ar.json similarity index 100% rename from apps/web/messages/ar.json rename to apps/web/locales/ar.json diff --git a/apps/web/messages/bg.json b/apps/web/locales/bg.json similarity index 100% rename from apps/web/messages/bg.json rename to apps/web/locales/bg.json diff --git a/apps/web/messages/de.json b/apps/web/locales/de.json similarity index 100% rename from apps/web/messages/de.json rename to apps/web/locales/de.json diff --git a/apps/web/messages/en.json b/apps/web/locales/en.json similarity index 100% rename from apps/web/messages/en.json rename to apps/web/locales/en.json diff --git a/apps/web/messages/es.json b/apps/web/locales/es.json similarity index 100% rename from apps/web/messages/es.json rename to apps/web/locales/es.json diff --git a/apps/web/messages/fr.json b/apps/web/locales/fr.json similarity index 100% rename from apps/web/messages/fr.json rename to apps/web/locales/fr.json diff --git a/apps/web/messages/he.json b/apps/web/locales/he.json similarity index 100% rename from apps/web/messages/he.json rename to apps/web/locales/he.json diff --git a/apps/web/messages/it.json b/apps/web/locales/it.json similarity index 100% rename from apps/web/messages/it.json rename to apps/web/locales/it.json diff --git a/apps/web/messages/nl.json b/apps/web/locales/nl.json similarity index 100% rename from apps/web/messages/nl.json rename to apps/web/locales/nl.json diff --git a/apps/web/messages/pl.json b/apps/web/locales/pl.json similarity index 100% rename from apps/web/messages/pl.json rename to apps/web/locales/pl.json diff --git a/apps/web/messages/pt.json b/apps/web/locales/pt.json similarity index 100% rename from apps/web/messages/pt.json rename to apps/web/locales/pt.json diff --git a/apps/web/messages/ru.json b/apps/web/locales/ru.json similarity index 100% rename from apps/web/messages/ru.json rename to apps/web/locales/ru.json diff --git a/apps/web/messages/zh.json b/apps/web/locales/zh.json similarity index 100% rename from apps/web/messages/zh.json rename to apps/web/locales/zh.json diff --git a/apps/web/types/local.ts b/apps/web/types/local.ts index 37b27206b..f9521e2d7 100644 --- a/apps/web/types/local.ts +++ b/apps/web/types/local.ts @@ -1,16 +1,16 @@ -import en from '../messages/en.json'; -import zh from '../messages/zh.json'; -import he from '../messages/he.json'; -import it from '../messages/it.json'; -import pl from '../messages/pl.json'; -import pt from '../messages/pt.json'; -import ru from '../messages/ru.json'; -import es from '../messages/es.json'; -import fr from '../messages/fr.json'; -import ar from '../messages/ar.json'; -import bg from '../messages/bg.json'; -import nl from '../messages/nl.json'; -import de from '../messages/de.json'; +import en from '../locales/en.json'; +import zh from '../locales/zh.json'; +import he from '../locales/he.json'; +import it from '../locales/it.json'; +import pl from '../locales/pl.json'; +import pt from '../locales/pt.json'; +import ru from '../locales/ru.json'; +import es from '../locales/es.json'; +import fr from '../locales/fr.json'; +import ar from '../locales/ar.json'; +import bg from '../locales/bg.json'; +import nl from '../locales/nl.json'; +import de from '../locales/de.json'; type Locale = 'en' | 'de' | 'ar' | 'bg' | 'zh' | 'nl' | 'he' | 'it' | 'pl' | 'pt' | 'ru' | 'es' | 'fr'; type EnTYPE = typeof en;