
In several of our applications, the texts for each language are in their own
TypeScript files as key-value pairs. Each key points to a message or
label in the interface, while the value contains the translated text.
English can, for example, be in english.ts, and Spanish in spanish.ts.
The customer delivers new translations in an Excel sheet where each row contains:
The structure is simple, but the amount can be large. To manually copy each line from Excel to TypeScript takes time and increases the risk of errors, especially when a key, a translation or variable is missing.
We created a Python script that reads the Excel sheet and updates the TypeScript files automatically. The script finds the correct key, checks the translation and replaces the text in the correct language file. This is how the process works.
Each language gets a separate sheet, for example "Spanish". The sheet has three necessary columns:
common.greeting.
Usually the customer fills in the sheet after we have sent over the keys and the English reference texts. Here we assume that the sheet has been translated and is ready for import.
With pandas the script reads the Excel file and filters out rows without a key or
translation. Thus, only valid data continues in the process.
Before the import, the script checks for empty translations and variables that may have
been changed by mistake. Then it reads the TypeScript file line by line,
finds each key and replaces the old text with the new translation.
Finally, the result is written back to the language file, for example spanish.ts.
Any TODO-marks are removed when the update is successful.
We use regular expressions to split each entry into three parts: the key and characters up to the opening quote, the text itself, and the end of the line. The script can then change the text without altering the surrounding formatting.
The script gives a short and clear status for each step. With colorama,
different message types have their own colors:

The colors are added by using Fore.COLOR_NAME in the relevant
print messages. The log makes it easy to find and correct deviations before the changes
go into production.
Once the client provides updated Spanish translations, we run
import_translations.py with one command. The script reads the Excel data,
checks the translations and updates spanish.ts. Variable errors,
missing texts and keys without matches are marked, so that we can quickly clean them up
before publication.
The automation not only saves time. It removes monotonous copying, gives better control and allows us to spend more time on the product itself. It's still a bit satisfying to see an hour's manual work done in one second.
If your team handles translations without a dedicated tool, a simple import flow like this is a good place to start. The goal is not a complicated system, but a reliable process that makes it easier to deliver the correct text in the right place.
From MVP prototypes to scalable platforms, our full-stack dev team turns your roadmap into rock-solid code. Get to market faster without sacrificing quality.
Get started