/replit-tutorials

How to support multiple languages in Replit apps

Learn how to add multilingual support to your Replit apps with simple tools and best practices to improve accessibility and reach global users.

Matt Graham, CEO of Rapid Developers

Book a call with an Expert

Starting a new venture? Need to upgrade your web app? RapidDev builds application with your growth in mind.

Book a free No-Code consultation

How to support multiple languages in Replit apps

To support multiple languages in a Replit app, you use normal internationalization (i18n) techniques — such as JSON translation files and a language‑selection mechanism — exactly like you would in a local project. Replit doesn’t add special translation tools, but it fully supports any Node, Python, or frontend i18n libraries. The key is organizing your translation files correctly, serving them properly, and avoiding common Replit pitfalls like putting secrets in the wrong place or letting the Replit file watcher restart your server constantly while you test language files.

 

What “multi‑language support” really means in a Replit app

 

When people say they want “multiple languages” in a Replit app, they usually mean one of these:

  • Different UI languages (English, Spanish, French, etc.).
  • Internationalized backend messages returned from an API.
  • User‑selectable language stored in cookies, localStorage, or a database.

Replit supports all of this the same way a normal project does — you just need to set up your file structure and libraries cleanly.

 

Node.js backend example (Express + JSON translation files)

 

This is the simplest stable setup inside Replit:

  • Create a folder named locales.
  • Inside it, create translation JSON files like en.json and es.json.
  • Load the correct file depending on the user’s choice or browser settings.
// server.js
import express from "express";
import fs from "fs";

const app = express();

app.get("/greet", (req, res) => {
  // Read desired language, fallback to English
  const lang = req.query.lang || "en";

  // Load the translation file
  const translations = JSON.parse(
    fs.readFileSync(`./locales/${lang}.json`, "utf8")
  );

  res.send({
    message: translations.greeting // Comes from the JSON file
  });
});

app.listen(3000, () => {
  console.log("Server running!");
});

 

// locales/en.json
{
  "greeting": "Hello!"
}

 

// locales/es.json
{
  "greeting": "¡Hola!"
}

 

This works perfectly in Replit. Replit watches file changes, so when you edit translation JSON files, your server restarts automatically — no special configuration required.

 

React frontend example in Replit (using i18next)

 

Replit’s React template works with i18next normally. Your translation files go into /public/locales.

// i18n.js
import i18n from "i18next";
import { initReactI18next } from "react-i18next";

i18n.use(initReactI18next).init({
  lng: "en",           // default language
  fallbackLng: "en",
  resources: {
    en: { translation: { greeting: "Hello!" } },
    es: { translation: { greeting: "¡Hola!" } }
  }
});

export default i18n;

Then in a component:

// App.jsx
import { useTranslation } from "react-i18next";

function App() {
  const { t, i18n } = useTranslation();

  return (
    <>
      <p>{t("greeting")}</p>

      <button onClick={() => i18n.changeLanguage("en")}>English</button>
      <button onClick={() => i18n.changeLanguage("es")}>Español</button>
    </>
  );
}

export default App;

This runs fine on Replit’s hosted environment with zero special configuration.

 

Python (Flask) i18n example using flask‑babel

 

If you’re building a Python web app, Flask with flask‑babel works on Replit in the same way as local.

# main.py
from flask import Flask, request
from flask_babel import Babel, _

app = Flask(__name__)
app.config['BABEL_DEFAULT_LOCALE'] = 'en'

babel = Babel(app)

@babel.localeselector
def get_locale():
    return request.args.get('lang', 'en')

@app.route("/greet")
def greet():
    return {"message": _("Hello!")}

app.run(host="0.0.0.0", port=3000)

Babel translation files must be generated with the normal commands, and Replit supports them.

 

Common Replit‑specific tips (things juniors usually miss)

 

  • Put translation files in normal folders (not in .replit or hidden directories). Replit’s file watcher won’t behave predictably otherwise.
  • Never store language preferences in Secrets. Secrets are machine‑level, not per‑user. Use cookies, DB, or localStorage.
  • If you need per‑user language stored server‑side, use Replit DB or a hosted DB (Postgres, MongoDB, etc.). Replit DB is key‑value only, but it’s fine for something like "user123\_lang = es".
  • For deployments: translation JSON files are included automatically — you don’t need to add anything to .replit unless you changed the project structure.
  • When using the new Replit Deployments, ensure your translation files sit inside the project folder (not symlinked), because deployed containers don’t include external paths.

 

Simple, reliable approach for most Replit users

 

The most stable pattern across all languages is this:

  • Store translations in JSON files inside a locales folder.
  • Serve them or import them with an i18n library.
  • Let users select a language via query param, cookie, or UI button.
  • Store user preference in browser or database.

Replit doesn’t get in your way — translations behave like normal files, libraries install normally, and deployments include everything automatically. If you set up your file structure cleanly, multilingual support works smoothly.

Still stuck?
Copy this prompt into ChatGPT and get a clear, personalized explanation.

This prompt helps an AI assistant understand your setup and guide you through the fix step by step, without assuming technical knowledge.

AI AI Prompt

Want to explore opportunities to work with us?

Connect with our team to unlock the full potential of no-code solutions with a no-commitment consultation!

Book a Free Consultation

Client trust and success are our top priorities

When it comes to serving you, we sweat the little things. That’s why our work makes a big impact.

Rapid Dev was an exceptional project management organization and the best development collaborators I've had the pleasure of working with. They do complex work on extremely fast timelines and effectively manage the testing and pre-launch process to deliver the best possible product. I'm extremely impressed with their execution ability.

CPO, Praction - Arkady Sokolov

May 2, 2023

Working with Matt was comparable to having another co-founder on the team, but without the commitment or cost. He has a strategic mindset and willing to change the scope of the project in real time based on the needs of the client. A true strategic thought partner!

Co-Founder, Arc - Donald Muir

Dec 27, 2022

Rapid Dev are 10/10, excellent communicators - the best I've ever encountered in the tech dev space. They always go the extra mile, they genuinely care, they respond quickly, they're flexible, adaptable and their enthusiasm is amazing.

Co-CEO, Grantify - Mat Westergreen-Thorne

Oct 15, 2022

Rapid Dev is an excellent developer for no-code and low-code solutions.
We’ve had great success since launching the platform in November 2023. In a few months, we’ve gained over 1,000 new active users. We’ve also secured several dozen bookings on the platform and seen about 70% new user month-over-month growth since the launch.

Co-Founder, Church Real Estate Marketplace - Emmanuel Brown

May 1, 2024 

Matt’s dedication to executing our vision and his commitment to the project deadline were impressive. 
This was such a specific project, and Matt really delivered. We worked with a really fast turnaround, and he always delivered. The site was a perfect prop for us!

Production Manager, Media Production Company - Samantha Fekete

Sep 23, 2022