Free UI/UX design course
Learn how to create exceptional designs by reading my new tutorial.
Start learningInternationalization (i18n)
Thanks to the MDB, and our Vite starter, translating Bootstrap projects into other languages is child's play.
In this lesson we will learn how to do this using the i18n process.
"Internationalization (i18n) is the process of preparing software so that it can support local languages and cultural settings. An internationalized product supports the requirements of local markets around the world, functioning more appropriately based on local norms and better meeting in-country user expectations."
Prerequisites
In this tutorial we will be using the Vite starter. If you have done the previous lessons in this section, you do not need to prepare anything. If you haven't, go back to the Vite lesson and follow all the steps, then come back here.
Step 1 - install dependencies
We need 2 dependencies:
- i18next, a very popular internationalization framework.
- i18next-fetch-backend plugin to load resources using the fetch API.
To install it, launch the terminal in the directory with your Vite starter, and type this command:
Step 2 - prepare structure
At the beginning, we need to create an additional folder and a few files in which we will place translations and configuration for i18n.
Create a locales
folder inside your src
,
json
files for translations,
and i18n.js
for internationalization plugin configuration.
You can do it simply by copying and pasting the commands below into your terminal:
Step 3 - add translated content
Copy the contents of the following snippets to the appropriate files created in the previous step:
Step 4 - import i18next and finish the configuration
Now inside the /src/js/i18n.js
file we need to import i18next, set up the configuration and add the code that will handle switching between the languages:
Step 5 - import the Translator
Next, inside the /src/js/i18n.js
file, just above MDB files, import the Translator
class to initialize Translator
.
Step 6 - add example HTML content
After we go through all the previous steps, we can start developing our multilingual application. Let's update the content of index.html
so that we can check if the app is working properly.
Add the code below inside the <body>
tag:
And done! When you see the live preview in your browser, click on the flag icon in the upper right corner. The content of the entire page will change the language.

You can see a working demo by clicking the button below:
Internationalization demo
About author
Michal Szymanski
Co Founder at MDBootstrap / Listed in Forbes „30 under 30" / Open-source enthusiast / Dancer, nerd & book lover.
Author of hundreds of articles on programming, business, marketing and productivity. In the past, an educator working with troubled youth in orphanages and correctional facilities.