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
Replexica is a free, open-source compiler plugin for React, paired with an AI translation platform. It's a toolset that enables React apps to speak many languages.
Why does this matter? Because 75% of the world doesn't speak English. If the app is multilingual, it can serve many more users. But, let's be honest, making an app multilingual is a headache: extract strings to JSON files, update translations every time something changes, etc.
15
+
75% of the world doesn't speak English. So, if the app is multilingual, it can reach so many more users!
14
16
15
-
That's where Replexica comes in: it's a build system plugin (+ AI engine in the cloud) that translates React apps into multiple languages. The best part - it doesn't require messing around with extracting or maintaining JSON files!
17
+
But, making an app multilingual is a headache: extracting text, managing JSON files, asking a native-speaking friend to double-check the translations... Oftentimes, it's a lot of work.
18
+
19
+
That's where Replexica comes in: it's an AI-powered i18n engine, that integrates with React, to make the app multilingual instantly, and scale to more international users much faster.
20
+
21
+
The best part - *you don't even have to deal with JSON files!*
16
22
17
23
## API
18
24
19
25
> [!NOTE]
20
26
> This guide is for Next.js App Router apps only. Support for other setups is coming soon (ETA April 2024). <https://github.com/replexica/replexica/issues/25>
21
27
28
+
While the full getting started guide is below, here's a quick TLDR of the changes needed to get Replexica up and running in a modern Next.js app:
29
+
22
30
```js
23
31
// next.config.mjs
24
32
25
-
importcompilerfrom'@replexica/compiler';
33
+
importreplexicafrom'@replexica/compiler';
26
34
27
35
/**@type{import('next').NextConfig}*/
28
36
constnextConfig= {};
@@ -35,74 +43,120 @@ const replexicaConfig = {
35
43
},
36
44
};
37
45
38
-
exportdefaultcompiler.next(
46
+
exportdefaultreplexica.next(
39
47
replexicaConfig,
40
48
nextConfig,
41
49
);
42
50
43
51
```
44
52
45
-
## Roadmap
53
+
## What is Replexica
54
+
55
+
Replexica is an AI-powered i18n engine for React, and it consists of **two main parts**:
56
+
57
+
1.**Replexica i18n Compiler** (this repo) - an open-source compiler plugin for React:
58
+
* Doesn't require extracting strings into JSON files;
59
+
* Seamlessly integrates with React build system;
60
+
* Infers metadata and user-facing text from the app;
61
+
* Prepares the content for translation.
46
62
47
-
The Replexica compiler is open-source, and the platform API is open, allowing you to build your own translation engine.
48
-
49
-
We're also developing our own i18n engine called [Replexica Cloud](https://replexica.com), to make it even easier to ship your first multi-language app!
50
-
51
-
-[x] Replexica Compiler
52
-
-[x] Next.js App Router
53
-
-[ ] Next.js Pages Router (April 2024)
54
-
-[ ] Remix (May 2024)
55
-
-[ ] Create React App (May 2024)
56
-
-[x] Replexica Framework
57
-
-[x] Core JSX translation
58
-
-[x] Custom context hints
59
-
-[x] Translation of JSX attributes (title, alt, placeholder)
60
-
-[ ] Translation of generic literals with helper functions
-[ ] (Create a GitHub issue to request a new language!)
71
-
-[ ] Quality checks (May 2024)
72
-
-[ ] Documentation/examples on self-hosted translation engine
73
-
-[x] Replexica CLI
74
-
-[x] CLI for Replexica Platform
75
-
-[x] Open-source API schema
76
-
-[ ] GitHub Actions integration
63
+
1.**Replexica i18n Cloud** ([replexica.com](https://replexica.com)) - an AI translation engine in the cloud that translates apps into multiple languages, fast:
* State-of-the-art quality translations (adding even more new languages soon!) via a mix of open-source and proprietary AI models;
67
+
* API is open, so anyone could build their own translation engine (self-hosting guide coming soon).
68
+
69
+
The core idea behind Replexica is simple: apps must be multi-language by default, from day one. **The Internet is global, and so should be any software that runs on it!**
77
70
78
71
## How it Works
79
72
80
-
Replexica is a compiler plugin that integrates with the build system, collecting all user-facing text in the app and preparing it for translation with the Replexica platform. Here's how it works:
73
+
Replexica Compiler integrates with the build system, collecting all user-facing text in the app and preparing it for translation with the Replexica Cloud.
74
+
75
+
Here's how it works:
76
+
77
+
1.**Infers** metadata from the app, such as the text that needs to be translated and its context. This metadata is then stored alongside the build artifacts.
78
+
1.**Translates** the text using the CLI that connects to the Replexica Cloud. The cloud engine uses AI to translate the text, and the more it's used, the better it gets. Also, the API is open, so that everyone can build their own translation engine if desired.
79
+
1.**Injects** the translations back into the app, so that the translated text is displayed to the user, based on their locale, when React renders the app.
80
+
81
+
With Replexica, you can build multi-language apps without the hassle of dealing with i18n JSON files, and with the power of AI-powered translation engine!
82
+
83
+
## OSS + Commercial
84
+
85
+
### Open Source
86
+
87
+
Everyone in the world deserves to have access to great software. And we believe that making software multilingual is the most important step towards removing digital barriers.
88
+
89
+
That's why Replexica is open source: so that anyone can start building multi-language apps quickly and ship them to the world faster!
90
+
91
+
### Commercial
92
+
93
+
Replexica Cloud, the commercial part of Replexica, is where we hope to start making money in the future. We don't have a clear business model yet, but we're thinking $0/month + usage, along with a free tier (with a fair usage policy), would be a good start.
94
+
95
+
Having built hundreds of side-projects ourselves, we're committed to making Replexica an affordable / free tool for indie hackers and hobbyists building side-projects. In the end, that's where we come from, and that's where our heart is.
81
96
82
-
1.**Infers** metadata from your app, such as the text that needs to be translated and its context. This metadata is then stored alongside the build artifacts.
83
-
1.**Translates** the text using the CLI that connects to the Replexica Cloud. The cloud engine uses AI to translate the text, and the more you use it, the better it gets. The API is open, so you can build your own translation engine if you wish!
84
-
1.**Injects** the translations back into your app, so that the translated text is displayed to the user, based on their locale.
97
+
At the same time, we're also committed to making Replexica a powerful tool for startups and enterprises building commercial software, to enable them to reach more users faster.
85
98
86
-
With Replexica, you can build multi-language apps without the hassle of managing JSON files, and with the power of AI translation.
99
+
### Self-Hosting
100
+
101
+
Additionally, since the API is open, anyone can build their own translation engine, memory, and fine-tune it themselves instead of using these features of Replexica Cloud. We're planning to release the self-hosting guide soon.
102
+
103
+
## Roadmap
104
+
105
+
Replexica is a new project (support our work with a GitHub star btw! 😉), and here are the main features we're working on next:
106
+
107
+
***Next.js App Router** - Replexica Compiler currently supports only Next.js App Router. Support for other setups is coming soon (ETA April 2024).
108
+
***New Languages** - Replexica Cloud currently supports only English and Spanish. More languages are coming soon (ETA April 2024).
109
+
110
+
The more detailed roadmap is below:
111
+
112
+
*[x] Replexica Compiler
113
+
*[x] Next.js App Router
114
+
*[ ] Next.js Pages Router (April 2024)
115
+
*[ ] Remix (May 2024)
116
+
*[ ] Create React App (May 2024)
117
+
*[x] Replexica Framework
118
+
*[x] Core JSX translation
119
+
*[x] Custom context hints
120
+
*[x] Translation of JSX attributes (title, alt, placeholder)
121
+
*[ ] Translation of generic literals with helper functions
*[ ] 10+ more languages to be announced (June 2024)
132
+
*[ ] (Create a GitHub issue to request a new language!)
133
+
*[ ] Self-hosting guides / docs
134
+
*[x] Replexica CLI
135
+
*[x] CLI for Replexica Platform
136
+
*[x] Open-source API schema
137
+
*[ ] GitHub Actions integration
87
138
88
139
## The Replexica Rule
89
140
90
141
At Replexica, we believe in the elegance of [Convention over configuration](https://en.wikipedia.org/wiki/Convention_over_configuration) principle.
91
142
92
-
Therefore, there's an important rule to remember when using Replexica:
143
+
Therefore, there's one important rule to remember when using Replexica:
93
144
94
145
> [!TIP]
95
146
> Place translatable text inside `JSX`.
96
147
97
148
As long as you follow this rule, the Replexica Compiler can automatically infer the metadata from your app and prepare the text inside JSX for translation.
98
149
99
-
If you don't follow the rule and decide to store some of your translatable content in variables, that **can be translated too**, but you'll need to manually wrap that text in a helper function.
150
+
If you don't follow the rule and decide to store some of your translatable content in variables, that **can be translated too**, but you'll need to manually wrap that text in a helper function (... that we're planning to release soon, ETA April 2024).
100
151
101
152
So, if you want a hassle-free i18n on autopilot, **follow The Replexica Rule** whenever possible.
102
153
103
-
### But what if I have an array of items, and some of the fields should be translated?
104
-
105
-
There's a common scenario, when you have an array of items that you render in a list, like this:
154
+
<details>
155
+
<summary>
156
+
Edge case: But what if I have an array of items, and some of the fields should be translated?
157
+
</summary>
158
+
159
+
There's a common scenario, when you have an array of items that you render in a list, like this:
106
160
107
161
```jsx
108
162
constmenuItems= [
@@ -141,6 +195,7 @@ const menuItesm = [
141
195
```
142
196
143
197
And that's it! The Replexica Compiler will automatically infer the metadata from the JSX and prepare the text for translation.
198
+
</details>
144
199
145
200
## Getting Started
146
201
@@ -233,7 +288,7 @@ pnpm run start
233
288
> `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.
234
289
235
290
> [!NOTE]
236
-
> 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 (ETA April 2024 🙏)!<https://github.com/replexica/replexica/issues/26>
291
+
> 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 (ETA April 2024). We're working really hard on this one! 🙏<https://github.com/replexica/replexica/issues/26>
237
292
238
293
### Step 5 (Optional). Test the result
239
294
@@ -257,10 +312,10 @@ location.reload();
257
312
258
313
Different apps use different strategies for switching between supported languages. Here are a few approaches we've seen:
@@ -270,8 +325,38 @@ To support every possible strategy, now and in the future, Replexica does the fo
270
325
271
326
So, whatever approach you choose for switching between locales, just be sure to update the value of the `REPLEXICA_LOCALE` cookie, and Replexica will handle the rest.
272
327
273
-
## Questions?
328
+
> [!WARNING]
329
+
> Be sure to drop by our Discord (link at the bottom) if you have an opinion on how Replexica should be handling the locale detection. Even if your idea is exotic or feels unfeasible, we'd love to hear it! 🙏 (feel free to send in private, if you want).
330
+
331
+
## Team
332
+
333
+
Before Replexica, we were bootstrapping a B2B SaaS startup. It got acquired, and we decided to build a devtool that'd just be cool and would be fun to work on.
334
+
335
+
We used to work with i18n a lot, using tens of different libraries, and none of them was a perfect match: something has always been a bit off.
336
+
337
+
So, we decided to build Replexica, to solve the i18n problem once and for all, for everyone, in a way that's simple, elegant, and powerful.
338
+
339
+
We're a lean team of two:
340
+
341
+
***[Veronica](https://github.com/vrcprl)** - Product, and AI.
342
+
***[Max](https://github.com/maxprilutskiy)** - React, Typescript and Compilers.
343
+
344
+
## Contributing
345
+
346
+
If you're building a side-project, or a startup, or you're working at a big company that uses Replexica - we'd LOVE to hear from you!
347
+
348
+
You can contribute in the form of:
349
+
350
+
***Feedback** - tell us what you like, what you don't like, what you'd like to see next.
351
+
***Feature requests** - tell us what you need, and we'll do our best to build it.
352
+
***Bug reports** - if you find a bug, please let us know, and we'll fix it as soon as we physically can.
353
+
354
+
Also the special one:
355
+
356
+
***Complaints** - if you're unhappy with *ANYTHING* about your current i18n approach, and you just need to vent, we're (our co-founder Max specifically) here to listen!
357
+
358
+
Lastly, we have a small [Discord channel](https://discord.gg/P2J3dGUM): come say hi! 👋
274
359
275
-
If you have any questions, feel free to create a GitHub issue!
360
+
## Questions
276
361
277
-
Also, we're [on Discord](https://discord.gg/P2J3dGUM): come say hi!
362
+
If you found a bug, or have a feature request, please [create an issue](https://github.com/replexica/replexica/issues) and post the link in the Discord channel. We'll take a look as soon as we can!
0 commit comments