2
2
3
3
## Installation
4
4
5
- add ` runfix-container ` package ` next-client-cookies ` package
5
+ add ` runfix-container ` package ` get-user-locale ` package
6
6
7
7
``` bash
8
- npm install runfix-container next-client-cookies
8
+ npm install runfix-container get-user-locale
9
9
```
10
10
On your app/layout.tsx file, add the CookiesProvider:
11
11
12
- ``` tsx
13
- import { CookiesProvider } from ' next-client-cookies/server' ;
14
12
15
- export default function RootLayout({ children }) {
16
- return <CookiesProvider >{ children } </CookiesProvider >;
17
- }
18
- ```
19
13
on your layout component that is rendered on the client, add this
20
14
21
15
22
- create this file ` components/translator-layout .tsx `
16
+ create this file ` components/translator.tsx `
23
17
24
- ``` tsx
18
+
19
+ ``` tsx filename="components/translator.tsx"
25
20
" use client" ;
26
21
27
22
import { useEffect } from " react" ;
@@ -102,25 +97,23 @@ export default async function RootLayout({ children }) {
102
97
{ /* Your additional tags should be passed as `children` of `<Head>` element */ }
103
98
</Head >
104
99
<body >
105
- <CookiesProvider >
106
- <Translator >
107
- <Layout
108
- banner = { banner }
109
- navbar = { navbar }
110
- pageMap = { await getPageMap ()}
111
- docsRepositoryBase = " https://github.com/FINGU-GRINDA/runfix-container/tree/main/docs"
112
- feedback = { {
113
- content:
114
- " https://github.com/FINGU-GRINDA/runfix-container/issues" ,
115
- labels: " bug" ,
116
- }}
117
- footer = { footer }
118
- // ... Your additional layout options
119
- >
120
- { children }
121
- </Layout >
122
- </Translator >
123
- </CookiesProvider >
100
+ <Translator >
101
+ <Layout
102
+ banner = { banner }
103
+ navbar = { navbar }
104
+ pageMap = { await getPageMap ()}
105
+ docsRepositoryBase = " https://github.com/FINGU-GRINDA/runfix-container/tree/main/docs"
106
+ feedback = { {
107
+ content:
108
+ " https://github.com/FINGU-GRINDA/runfix-container/issues" ,
109
+ labels: " bug" ,
110
+ }}
111
+ footer = { footer }
112
+ // ... Your additional layout options
113
+ >
114
+ { children }
115
+ </Layout >
116
+ </Translator >
124
117
</body >
125
118
</html >
126
119
);
@@ -133,7 +126,7 @@ What does it do ?
133
126
- it will deduct the source language based on
134
127
- html lang attribute
135
128
- it will deduct target language based on
136
- - cookie ` NEXT_LOCALE `
129
+ - ` get-user-locale ` package
137
130
- default to ` en `
138
131
- it will add overflow break to prevent text overflow
139
132
- it will check for existing overflow, and diff it after translation
0 commit comments