I Easily Translated My React.js Applications into Multiple Languages. Here Is How... ๐คฏ

Search for a command to run...

No comments yet. Be the first to comment.
Expanding your app into new markets can feel daunting, but it doesnโt have to be! With the right tools at your fingertips, you can streamline processes, engage users, and gain valuable insightsโall while keeping things affordable and accessible. Letโ...

Are you ready to elevate your skills and create websites that everyone can enjoy? Making your websites and apps accessible means opening the door for everyone to enjoy what youโve created, no matter their abilities. This means creating experiences th...

I was working on cool gifs for Tolgee's new readme, where we show how simply you can modify a localization string in your App. But when I need to type something into input, I always make like 5 mistakes and my typing is not very nice to look at. So I...

So you develop an app in React and you want many users to use it, right? To make your app usable for users in foreign countries, you have to translate your App to their languages. ๐ฌ๐ง ๐จ๐ณ ๐ฎ๐น ๐ช๐ธ ๐ซ๐ท In this article, I am going to show you, how ...

Translating an App to multiple languages (localization) is tricky part of many applications.
Tolgee is simplifying the localization process and saves developer's time by removing repetitive tasks ๐ โ
Saving time? That's what I want. Show me how to localize my React app!

Tolgee is an open-source i18n tool combining localization platform and SDKs to provide simple way to translate the web applications for both developers and translators.
Tolgee is not just another software localization platform offering integrations that only syncs local data with the backend. Instead, Tolgee is truly integrated into your app via SDKs.
As a developer of localized application, you probably have to modify localization data every time you need to change a text.
So you have to open the file, add or find the key to modify, save it and check whether everything was changed correctly in the app.
With Tolgee you can just ALT + click the actual translated text in your app and ๐ฅboom๐ฅ translation dialog appears and you are able to translate it right away.

Another tricky part of localization is providing context to translators. Only exporting the keys and translations in source language is not always enough.
Tolgee enables you to take and upload screenshot directly in the in-context translation dialog. So no more manual taking and uploading screenshots.

Tolgee is also localization platform, where you can manage all your localization strings. You can provide access to translators and they can translate the texts there.
If you have uploaded screenshots before, they know the context of the translations perfectly and can produce perfect results.
To get started, you can simply follow the integration guides provided in the platform.
Login to Tolgee Cloud or use your self hosted Tolgee instance.
Create a new project by clicking Add button in the top right. Fill the project name.

Optionally, you can add multiple languages to translate your app into.
Select Integrate from side menu, choose React (Vite) and generate an API key with all scopes checked.

Success! ๐ Now you just have to follow the integration guide.
Generate brand new React App and open it your favorite editor
npm create vite@latest tolgee-hello-world -- --template react-ts
# follow the vite guide
Install Tolgee packages โฌ๏ธ
npm install @tolgee/react
Add Tolgee properties to you development .env file env.development.local by copying it from the integration guide
VITE_APP_TOLGEE_API_URL=https://app.tolgee.io
VITE_APP_TOLGEE_API_KEY=<your API key>
Wrap your App component in main.tsx with TolgeeProvider component. Again, you can copy it from the integration guide.
Go to App.tsx and replace all the crap with simple "Hello world!" message.
import './App.css';
function App() {
return (
<div className="App">
<h1>Hello world!</h1>
</div>
);
}
export default App;
Wrap the "Hello world!" with <T> component and add keyName prop.
import './App.css';
import { T } from '@tolgee/react';
function App() {
return (
<div className="App">
<h1>
<T keyName="hello_world">Hello world!</T>
</h1>
</div>
);
}
export default App;
Let's run the App in the browser and see the magic! ๐ช
Hold your ALT key and move your mouse over the text. It should be highlighted.
When you click it, dialog opens and you're able to edit the text or generate screenshots.

After you hit the update button, your Hello World! text will be immediately changed to the new value!
Now you are able to translate your React applications. To learn more about Tolgee or to find out how to translate more complicated cases, visit our docs.

Tolgee helps teams localize apps effortlessly. We make translation simple with real-time updates and easy integration into your workflow.
Say goodbye to complex file management and focus on building great products. Fast, smooth, and built for devs.

If you like this tutorial, please help us with a star. It would help us to create more articles like this ๐