Skip to main content

Bench Migrate CSV to PO Command

The bench migrate-csv-to-po command converts existing translation files from the legacy CSV format to the newer PO (Portable Object) format. It matches the existing translations with the application’s POT template and generates locale-specific .po files.

Prerequisite:

Before running this command, your application must already have a main.pot file. If it doesn’t exist, generate it first using bench generate-pot-file.

Usage

bench migrate-csv-to-po [OPTIONS]

What Does This Command Do?

Earlier versions of Frappe stored translations in CSV files. The newer translation system uses PO files, which provide better support for translation workflows and localization tools.

This command reads translations from existing CSV files, compares them with the application’s main.pot template, and creates a corresponding .po file for each selected language.

The generated PO files are saved in the application’s locale directory.

Available Options

Option Description
--app Migrate translations for a specific application. If omitted, all applications are processed.
--locale Migrate translations for a specific locale. If omitted, all available locales are processed.

Common Example

Migrate ERPNext German Translations

Convert the German translation file from CSV format to PO format.

bench migrate-csv-to-po --app erpnext --locale de

This command performs the following actions:

  • Reads translations from apps/erpnext/erpnext/translations/de.csv.
  • Uses apps/erpnext/erpnext/locale/main.pot as the translation template.
  • Generates the PO file at apps/erpnext/erpnext/locale/de.po.
Best Practice:

After verifying that the generated .po file contains all expected translations, you can safely remove the old CSV translation file to complete the migration to the new translation system.

Rating: 0 / 5 (0 votes)