Skip to content

Commit 84b1fe3

Browse files
committed
chore: add tips to the readme
1 parent a8aceef commit 84b1fe3

File tree

1 file changed

+23
-8
lines changed

1 file changed

+23
-8
lines changed

readme.md

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,13 @@ So, if you want a hassle-free i18n on autopilot, **follow The Replexica Rule** w
100100

101101
## Getting Started
102102

103-
#### Step 1. Install Replexica
103+
### Step 1. Install Replexica
104104

105105
```bash
106106
pnpm add replexica @replexica/compiler @replexica/react
107107
```
108108

109-
#### Step 2. Configure NextJS
109+
### Step 2. Configure NextJS
110110

111111
```js
112112
// next.config.mjs
@@ -131,7 +131,7 @@ export default compiler.next(
131131

132132
```
133133

134-
#### Step 3. Configure React App
134+
### Step 3. Configure React app
135135

136136
> [!NOTE]
137137
> This guide is for Next.js App Router apps only. Guides for other setups are coming soon (ETA April 2024).
@@ -166,23 +166,32 @@ export default async function RootLayout({
166166

167167
```
168168

169-
#### Step 4. Run the Compiler
169+
### Step 4. Run the compiler
170170

171171
```bash
172172
# If you haven't already, authenticate with the Replexica platform
173173
pnpm replexica auth
174174

175-
# Build the app
175+
# Build the app, without translations
176176
pnpm run build
177177

178178
# Fetch translations from the Replexica platform
179179
pnpm replexica i18n
180180

181+
# Build the app again, to inject translations into the build output
182+
pnpm run build
183+
181184
# Start the app
182185
pnpm run start
183186
```
184187

185-
#### Step 5 (Optional). Test the result
188+
> [!TIP]
189+
> `pnpm replexica i18n` must be run after every build, to fetch the latest translations from the Replexica platform. It must be run in CI/CD pipelines as well, right after the `build` step.
190+
191+
> [!NOTE]
192+
> We know that running `pnpm replexica i18n` after every build and running the build twice can be a bit cumbersome. We're working on a solution to make this process more streamlined!
193+
194+
### Step 5 (Optional). Test the result
186195

187196
If you haven't yet implemented the language switcher on the UI, run the following code in the browser console to switch the language to Spanish:
188197

@@ -191,8 +200,14 @@ document.cookie = "REPLEXICA_LOCALE=es; path=/;";
191200
location.reload();
192201
```
193202

194-
> [!TIP]
195-
> `pnpm replexica i18n` must be run after every build, to fetch the latest translations from the Replexica platform. It must be run in CI/CD pipelines as well, right after the `build` step.
203+
... and you should see the app in Spanish!
204+
205+
To switch back to English, run:
206+
207+
```js
208+
document.cookie = "REPLEXICA_LOCALE=en; path=/;";
209+
location.reload();
210+
```
196211

197212
## How to Switch Between Languages
198213

0 commit comments

Comments
 (0)