From 6f2e0040414615e7876771f98df3009b795fdb6f Mon Sep 17 00:00:00 2001 From: Willy Brauner Date: Thu, 9 Nov 2023 12:01:03 +0100 Subject: [PATCH] restore LangService --- examples/example-ssr/src/components/App.tsx | 14 +++++++------- src/core/LangService.ts | 18 ------------------ src/core/ROUTERS.ts | 2 -- 3 files changed, 7 insertions(+), 27 deletions(-) diff --git a/examples/example-ssr/src/components/App.tsx b/examples/example-ssr/src/components/App.tsx index 42385ff2..c4301b2f 100644 --- a/examples/example-ssr/src/components/App.tsx +++ b/examples/example-ssr/src/components/App.tsx @@ -46,13 +46,13 @@ export function App() { {/* NAV */} - {/**/} + {/* RENDER PAGES */} diff --git a/src/core/LangService.ts b/src/core/LangService.ts index c7e59953..a31bb5b6 100644 --- a/src/core/LangService.ts +++ b/src/core/LangService.ts @@ -38,11 +38,6 @@ class LangService { */ public showDefaultLangInUrl: boolean - /** - * Current url need to display lang in URL - */ - public curentUrlNeedToContainLang: boolean - /** * Base URL of the app */ @@ -82,7 +77,6 @@ class LangService { this.currentLang = this.getLangFromString() || this.defaultLang this.browserLang = this.getBrowserLang(languages) this.showDefaultLangInUrl = showDefaultLangInUrl - this.curentUrlNeedToContainLang = this.needToContainLangInUrl() } /** @@ -423,18 +417,6 @@ class LangService { if (isSSR()) return forcePageReload ? window?.open(newUrl, "_self") : ROUTERS.history.push(newUrl) } - - /** - * Determine if current URL need to contain lang - * @param currentLangKey - * @protected - */ - protected needToContainLangInUrl(currentLangKey = this.currentLang.key): boolean { - return ( - (this.isDefaultLangKey(currentLangKey) && this.showDefaultLangInUrl) || - !this.isDefaultLangKey(currentLangKey) - ) - } } export default LangService diff --git a/src/core/ROUTERS.ts b/src/core/ROUTERS.ts index ade95a20..4515950d 100644 --- a/src/core/ROUTERS.ts +++ b/src/core/ROUTERS.ts @@ -10,7 +10,6 @@ export type TRouters = { /** * Global routes list */ - //rootRoutes: TRoute[] routes: TRoute[] /** * Global browser history @@ -51,7 +50,6 @@ export type TRouters = { */ export const ROUTERS: TRouters = { base: undefined, - //rootRoutes: undefined, routes: undefined, history: undefined, staticLocation: undefined,