You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+79-59Lines changed: 79 additions & 59 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,63 +6,6 @@ A lightweight, efficient auto-translation SDK for React and Next.js applications
6
6
7
7
You don't need to prepare any translation files, just provide your API key and the SDK will handle the rest.
8
8
9
-
## Next.js Server-Side Rendering Support
10
-
11
-
This SDK fully supports Next.js server-side rendering (SSR). You can pre-fetch translations on the server and hydrate the client with these translations for a seamless user experience.
This SDK provides comprehensive SSR support through middleware-based locale detection and server components. Here's how to implement end-to-end server-side translation:
95
+
96
+
### Middleware Setup
97
+
98
+
Create a middleware file to detect user's locale from request headers or URL parameters:
<h1>{translations["Hello from Server Component"]}</h1>
151
+
<p>{translations["This component is rendered on the server side"]}</p>
152
+
</div>
153
+
);
154
+
}
155
+
```
156
+
157
+
### SEO Considerations
158
+
159
+
While our SDK currently supports server-side rendering of translated content, achieving full locale-specific visibility in search engine results requires additional implementation. We're working on this step by step example and welcome community contributions to:
160
+
161
+
- Implement canonical URL handling for localized content
162
+
- Develop locale-specific sitemap generation
163
+
- Show hreflang tag implementation
164
+
165
+
If you'd like to contribute examples or implementations for these features, please submit a Pull Request!
166
+
147
167
## Locale Format
148
168
149
169
The locale format follows the ISO 639-1 language code standard, optionally combined with an ISO 3166-1 country code:
0 commit comments