{
  "id": 9532479,
  "title": "pg_i18n: translatable columns in PostgreSQL without rewriting your app",
  "url": "https://urgent.news/2026/09/24/pg-i18n-translatable-columns-in-postgresql-without-rewriting-your-app",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-09-24T09:53:43.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/sirmmo/pgi18n-translatable-columns-in-postgresql-without-rewriting-your-app-b51"
  },
  "original_language": "en",
  "account": "A PostgreSQL extension named pg_i18n allows for translatable columns without rewriting existing applications. It works with both text and jsonb columns, automatically handling mixed content and enabling proper translations. The extension is simple to install, either as a PostgreSQL extension or as a script loaded with psql. It supports multiple languages per row, automatically promoting plain strings to JSON objects when a translation is added. The application remains unchanged, as it continues to read and write plain strings. A view can be created to expose the columns as plain strings in the current language. Triggers ensure that any updates are written back to the JSON object for the relevant language. Once all writers go through the functions or the view, the text columns can be converted to jsonb with a check constraint ensuring only translation objects are present. Automatic backfilling can be performed for missing languages, using machine translation providers like DeepL, Google Cloud Translation, or OpenRouter. The system keeps track of which rows are missing translations and which have already been processed. Language detection can also be enabled, allowing the system to identify the actual language of a plain string and move it to the appropriate language key. This extension is ideal for applications where translations belong inside the row and the application is not planned to change, such as legacy databases with mixed content or catalogues. However, it may not be suitable for long documents requiring per-language versioning and an approval workflow, for which a translations table or a translation management system would be more appropriate.",
  "summary": "Every project I have worked on eventually needed a second language for some text stored in the database. Product names, category labels, descriptions, menu entries. And every time, the same thing happened: the schema was already there, the API was already reading and writing those columns as plain strings, and nobody wanted to touch either. So the pragmatic hack appeared: someone started writing…",
  "key_points": [],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}