What is i18n (Internationalization)?
i18n is short for internationalization (there are 18 letters between i and n). It is the practice of designing your app so it can support multiple languages and regional formats without changing your core code.
What does i18n usually include?
A good i18n setup usually covers more than just translating labels.
Translations (English, Portuguese, French...)
Plural rules ("1 file" vs "2 files")
Dates and times (MM/DD/YYYY vs DD/MM/YYYY)
Numbers and currency (1,000.50 vs 1.000,50, $ vs EUR)
Sometimes right-to-left layout support (Arabic, Hebrew)
When should you use i18n?
Use i18n when:
Your app will be used by people in more than one language
You want to avoid hardcoding text in components and pages
You need correct formatting for dates, numbers, and money by locale
You want to scale: adding a new language should mean adding translation files, not editing code everywhere
Do not bother yet if:
The app is strictly internal and guaranteed to be one language
It is a quick prototype you will throw away (though i18n early can still save time later)
How do you use i18n (typical approach)?
Create translation dictionaries per language (JSON, YAML, or objects)
Pick a language (locale), like "en" or "pt-BR"
Replace hardcoded strings with keys, like home.title
Use a function (often called t) to translate: t("home.title") -> "Welcome"
Optionally support variables, plurals, and date or number formatting
Simple example (JavaScript)
1) Translation dictionaries
const messages = {
en: {
greeting: "Hello, {name}!",
files: "{count} file(s)"
},
pt: {
greeting: "Ola, {name}!",
files: "{count} arquivo(s)"
}
};
2) A tiny t() function
function t(locale, key, params = {}) {
let text = messages[locale]?.[key] ?? key;
for (const [k, v] of Object.entries(params)) {
text = text.replaceAll(`{${k}}`, String(v));
}
return text;
}
3) Using it
const locale = "en";
console.log(t(locale, "greeting", { name: "Davi" })); // Hello, Davi!
console.log(t(locale, "files", { count: 3 })); // 3 file(s)
console.log(t("pt", "greeting", { name: "Davi" })); // Ola, Davi!
This example is intentionally simple, but real i18n libraries add proper plural rules per language, fallback languages, date and currency formatting, and async loading of translation files.