Skip to main content

Update PO Translation Files

The bench update-po-files command synchronizes your existing PO translation files with the latest POT template. It removes obsolete translation strings and adds newly discovered translatable strings, ensuring your localization files remain up to date.

Prerequisites

Before running this command, make sure your application already contains a valid main.pot template file along with one or more existing .po translation files inside the locale directory.

Usage

bench update-po-files [OPTIONS]

What This Command Does

Whenever new labels are added to your application or existing ones are removed, the translation files also need to be updated. This command compares every PO file against the current POT template and performs the following actions:

  • Adds newly discovered translatable strings.
  • Removes obsolete translation entries.
  • Keeps existing translations wherever possible.
  • Ensures all translation files stay synchronized with the latest source strings.

Run this command after regenerating the POT file to keep translations up to date.

Available Options

Option Description
--app Updates translation files for a specific application. If omitted, all installed apps are processed.
--locale Updates translation files for a specific language or locale. If omitted, all locales are updated.

Example

Update the German translation file for the ERPNext application:

bench update-po-files --app erpnext --locale de

This command reads:

  • apps/erpnext/erpnext/locale/main.pot
  • apps/erpnext/erpnext/locale/de.po

It then synchronizes the German translation file by adding any new translatable strings and removing outdated ones before saving the updated de.po file.

Best Practice

Whenever you regenerate the POT template using bench generate-pot-file, run bench update-po-files before translating. This keeps all language files aligned with the latest application source code.

Rating: 0 / 5 (0 votes)