Skip to main content

MSG2PO

Build status Patreon Telegram Discord IRC

A set of tools to convert Fallout 1/2 MSG and WeiDU TRA into GNU gettext PO and back, used in BGforge Hive. Ask questions here.

Table of Contents

Installation

pipx install msg2po

Also install Gettext tools, and make sure they are in PATH.

Configuration

Create a .bgforge.yml file in your project root to configure the tool:

translation:
  encoding: cp1252      # source encoding (cp1252 default, cp1251/ru, cp1250/pl, cp1258/vi)
  tra_dir: "."          # translation root directory
  src_lang: "english"   # source language (used for poify)
  extract_format: ""    # "" (default), "sfall" for Fallout
  no_female: false      # skip female translations
  extract_fuzzy: false  # include fuzzy entries

Commands

poify

Converts game translation files (MSG, SVE, TXT, TRA) from a source language directory into a single .pot (PO Template) file.

poify [DIR] [-e ENC] [-v] [-q] [-t]
Argument Description Default
DIR Source language directory ./english
-e ENC Source encoding cp1252
-v, --verbose Enable verbose output -
-q, --quiet Suppress info messages -
-t, --timestamps Show timestamps in log output -

Example:

poify ./english -e cp1252

This scans the ./english directory for all translation files and creates ./po/english.pot.


unpoify

Extracts translated files from PO files back into the game's directory structure. Used after translation is done in Weblate/PO editor.

unpoify [DIR] [-v] [-q] [-t]
Argument Description Default
DIR Directory with PO files ./po
-v, --verbose Enable verbose output -
-q, --quiet Suppress info messages -
-t, --timestamps Show timestamps in log output -

Example:

unpoify ./po

This reads PO files from ./po and extracts translations back into language-specific directories (e.g., ./french/).


file2po

Converts a single game translation file (MSG, SVE, TXT, TRA) into a PO file. Useful for extracting from individual files.

file2po INPUT_SOURCE OUTPUT_PO [-e ENC] [-v] [-q] [-t]
Argument Description Default
INPUT_SOURCE Input translation file -
OUTPUT_PO Output PO file -
-e ENC Source encoding cp1252
-v, --verbose Enable verbose output -
-q, --quiet Suppress info messages -
-t, --timestamps Show timestamps in log output -

Example:

file2po ./english/dialog.msg ./output.pot -e cp1252

po2file

Converts PO entries back into a single game translation file. The reverse of file2po.

po2file INPUT_FILE OUTPUT_FILE [-e ENC] [--path PATH] [-v] [-q] [-t]
Argument Description Default
INPUT_FILE Input PO file -
OUTPUT_FILE Output translation file -
-e ENC Output encoding cp1252
--path PATH File occurrence in PO (relative path) Output filename
-v, --verbose Enable verbose output -
-q, --quiet Suppress info messages -
-t, --timestamps Show timestamps in log output -

Example:

po2file ./french.po ./french/dialog.msg -e cp1252

file2msgstr

Loads translations from a game translation file into the msgstr fields of an existing PO file. Useful for reloading edited translations.

file2msgstr INPUT_FILE OUTPUT_FILE [-e ENC] [--path PATH] [--overwrite] [--same] [-v] [-q] [-t]
Argument Description Default
INPUT_FILE Input translation file -
OUTPUT_FILE Output PO file (must exist) -
-e ENC Source encoding cp1252
--path PATH PO occurrence path Input filename
--overwrite Overwrite existing translations -
--same Load translations identical to original strings -
-v, --verbose Enable verbose output -
-q, --quiet Suppress info messages -
-t, --timestamps Show timestamps in log output -

Example:

file2msgstr ./french/dialog.msg ./french.po --overwrite

dir2msgstr

Batch loads translations from all files in a directory into corresponding PO files. Reverse of unpoify - used when translators edit files directly instead of PO.

dir2msgstr [--auto] [-s SRC_DIR] [-o OUTPUT_FILE] [--ext EXT] [--same] [--overwrite] [-v] [-q] [-t]
Argument Description Default
--auto Auto-find POs and language dirs, process all valid extensions -
-s SRC_DIR Directory to load from .
-o OUTPUT_FILE Existing PO file -
--ext EXT Load files with this extension -
--same Load translations identical to original strings -
--overwrite Overwrite existing translations -
-v, --verbose Enable verbose output -
-q, --quiet Suppress info messages -
-t, --timestamps Show timestamps in log output -

Example:

dir2msgstr --auto

Or manually:

dir2msgstr -s ./french -o ./french.po --ext msg --overwrite

msgmerge-female

Updates PO files from a POT template using GNU gettext's msgmerge, with special handling to keep female translations. Requires Gettext tools in PATH.

msgmerge-female [PO POT] [-v] [-q] [-t]
Argument Description Default
PO PO file to update -
POT POT template file -
-v, --verbose Enable verbose output -
-q, --quiet Suppress info messages -
-t, --timestamps Show timestamps in log output -

Single file:

msgmerge-female french.po english.pot

Batch (uses .bgforge.yml config):

msgmerge-female

resave-po

Resaves a PO file using the polib API to correct formatting. Useful for normalizing PO file structure.

resave-po INPUT_FILE [-v] [-q] [-t]
Argument Description Default
INPUT_FILE PO file to resave -
-v, --verbose Enable verbose output -
-q, --quiet Suppress info messages -
-t, --timestamps Show timestamps in log output -

Example:

resave-po ./french.po

lowercase

Recursively renames files and directories to lowercase. Useful for preparing case-insensitive file systems.

lowercase DIR [-v] [-q] [-t]
Argument Description Default
DIR Directory to process -
-v, --verbose Enable verbose output -
-q, --quiet Suppress info messages -
-t, --timestamps Show timestamps in log output -

Example:

lowercase ./french

Note: Excludes .git, .svn, .hg, .github directories, .po files, and README.md.


unfuzzy

Removes fuzzy flags from PO entries where the previous msgid matches the current msgid after applying string replacements. Used to reduce diff noise after source language spelling changes.

Create unfuzzy.yml with replacements:

- ["Nuka Cola", "Nuka-Cola"]
- ["nuka cola", "Nuka-Cola"]
unfuzzy INPUT_FILE [-w] [-v] [-q] [-t]
Argument Description Default
INPUT_FILE PO file to process -
-w Write changes to file (without this, previews only) -
-v, --verbose Enable verbose output -
-q, --quiet Suppress info messages -
-t, --timestamps Show timestamps in log output -

Example:

unfuzzy ./french.po -w

bgforge-config

Reads values from .bgforge.yml configuration. Primarily used by GitHub Actions.

bgforge-config STANZA KEY
Argument Description
STANZA Config section (e.g., translation)
KEY Config key (e.g., encoding)

Example:

bgforge-config translation encoding

GitHub Action

A GitHub Action is available for automatic processing. See docs/action.md for details.

Metadata

Release files for msg2po 1.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for msg2po 1.6.0
File Size Uploaded
msg2po-1.6.0.tar.gz 62.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for msg2po 1.6.0
File Interpreter ABI Platform
msg2po-1.6.0-py3-none-any.whl Python 3 none any Details

Total release size: 102.4 kB

Release files / msg2po-1.6.0.tar.gz

Download URL msg2po-1.6.0.tar.gz
Size 62.9 kB
Tags Source
SHA-256 checksum
How to use checksums
2731f180b28d126c7c441aa36afab6bd479c9ec924848ee2018315dae75114bd
BLAKE2b-256 checksum
How to use checksums
37d768aa81e44f749a8dd5d51ec27b9c9af4fcf5f4427066ec6a2b1c382ddbf9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / msg2po-1.6.0-py3-none-any.whl

Download URL msg2po-1.6.0-py3-none-any.whl
Size 39.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5e83925ca30f11c5fa86401a963c0348b7e3eccd0b7271c999b0ec80e81e6431
BLAKE2b-256 checksum
How to use checksums
e4877406953f7bcda39ffd719ccc5a2b7442a48cd7cbc923063713de63ad56f9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

This release

1.6.0 This release

2 release files

1.5.3

2 release files

1.5.2

2 release files

1.5.1

2 release files

1.5.0

2 release files

1.4.3

2 release files

1.4.2

2 release files

1.4.1

2 release files

1.4.0

2 release files

1.3.2

2 release files

1.3.1

2 release files

1.3.0

2 release files

1.2.3

2 release files

1.2.2

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.16

2 release files

1.1.15

2 release files

1.1.14

2 release files

1.1.13

2 release files

1.1.12

2 release files

1.1.11

2 release files

1.1.10

2 release files

1.1.9

2 release files

1.1.8

2 release files

1.1.7

2 release files

1.1.5

2 release files

1.1.4

2 release files

1.1.3

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page