Menu

1 / 2

JSON Translation Files Explained: A Beginner’s Guide to Localization

DEV Community: react·Mohit Sapat·4 days ago
#90fPEmQL
#devtoreact#devto#dev#json#file
Reading 0:00
15s threshold

TL;DR: A JSON translation file stores your app's user-facing text for one language as key-value pairs, such as en.json and fr.json. Your code calls t("auth.login") instead of hardcoding text, and the i18n library returns the value from the active locale's file. Every locale uses identical keys; only the translated values change.

A JSON translation file is where your app's words live. Learn how JSON locale files are structured, how the t() function finds the right string, how to name and organize files per language, how to translate a JSON file without breaking it, and the mistakes that cause missing text in production.

What Is a JSON Translation File?

A JSON translation file (also called a JSON locale file or JSON language file) stores the user-facing text of your application for one language. Instead of writing text directly inside your components, you give every string a key and put the actual words in a file per language.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.