Skip to content

Commit

Permalink
restore LangService
Browse files Browse the repository at this point in the history
  • Loading branch information
willybrauner committed Nov 9, 2023
1 parent 6333396 commit 6f2e004
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 27 deletions.
14 changes: 7 additions & 7 deletions examples/example-ssr/src/components/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ export function App() {


{/* NAV */}
{/*<nav>*/}
{/* <Link to={{ name: EPages.HOME }}>Home</Link> |{" "}*/}
{/* <Link to={{ name: EPages.ABOUT }}>About</Link> |{" "}*/}
{/* <Link to={{ name: EPages.ARTICLE, params: { slug: "article-1" } }}>Article 1</Link> |{" "}*/}
{/* <Link to={{ name: EPages.ARTICLE, params: { slug: "article-2" } }}>Article 2</Link> |{" "}*/}
{/* <Link to={{ name: EPages.CONTACT, queryParams: {foo: "bar", "zoo": "ok" }, hash: "yo" }}>Contact</Link>*/}
{/*</nav>*/}
<nav>
<Link to={{ name: EPages.HOME }}>Home</Link> |{" "}
<Link to={{ name: EPages.ABOUT }}>About</Link> |{" "}
<Link to={{ name: EPages.ARTICLE, params: { slug: "article-1" } }}>Article 1</Link> |{" "}
<Link to={{ name: EPages.ARTICLE, params: { slug: "article-2" } }}>Article 2</Link> |{" "}
<Link to={{ name: EPages.CONTACT, queryParams: {foo: "bar", "zoo": "ok" }, hash: "yo" }}>Contact</Link>
</nav>

{/* RENDER PAGES */}
<Stack manageTransitions={crossedTransitions} />
Expand Down
18 changes: 0 additions & 18 deletions src/core/LangService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,6 @@ class LangService<TLang = any> {
*/
public showDefaultLangInUrl: boolean

/**
* Current url need to display lang in URL
*/
public curentUrlNeedToContainLang: boolean

/**
* Base URL of the app
*/
Expand Down Expand Up @@ -82,7 +77,6 @@ class LangService<TLang = any> {
this.currentLang = this.getLangFromString() || this.defaultLang
this.browserLang = this.getBrowserLang(languages)
this.showDefaultLangInUrl = showDefaultLangInUrl
this.curentUrlNeedToContainLang = this.needToContainLangInUrl()
}

/**
Expand Down Expand Up @@ -423,18 +417,6 @@ class LangService<TLang = any> {
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
2 changes: 0 additions & 2 deletions src/core/ROUTERS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ export type TRouters = {
/**
* Global routes list
*/
//rootRoutes: TRoute[]
routes: TRoute[]
/**
* Global browser history
Expand Down Expand Up @@ -51,7 +50,6 @@ export type TRouters = {
*/
export const ROUTERS: TRouters = {
base: undefined,
//rootRoutes: undefined,
routes: undefined,
history: undefined,
staticLocation: undefined,
Expand Down

0 comments on commit 6f2e004

Please sign in to comment.