How to Translate Gettext PO and POT Files with PTC

PTC (Private Translation Cloud), a powerful software translation tool, makes it quick and easy to translate PO files and deliver multilingual software.

If you’re developing in environments like WordPress, Java programs, or using the GNU gettext system, PO files are an essential part of making your project multilingual. These files let you translate the text in your application’s user interface so users can interact with your software in their own language.

As you work with PO files, you’ll also come across related formats like POT and MO files. Before you start translating, it’s important you understand how these files work together in the localization process.

What Are POT, PO, and MO Files?

POT, PO, and MO files each handle a different aspect of your project’s translations.

.pot

POT (Portable Object Template) file

The Starting Point for Translations

Template for creating PO files

Doesn’t contain translations

Lists all the original text strings that need translation

Example:

msgid "Hello, World!"
msgstr ""
msgid "File not found"
msgstr ""
  • msgid entries contain the original strings in the source language
  • msgstr entries remain empty because the POT file serves as a template for the translations

.po

PO (Portable Object) file

Where You Store Translations

Stores the actual translations for your software’s user interface

Each entry in a PO file pairs an original string from your software with its translated version

Example:

#:path/to/source/file:23 
msgid "File not found" 
msgstr "Archivo no encontrado"
  • #: path/to/source/file:23 tells you where the original string is in your source code, making it easy to find and edit
  • msgid shows the original (source language) text
  • msgstr provides the translation

.mo

MO (Machine Object) file

Ready for Your Software to Use

A compiled, binary version of the PO file

Allows your software to access translations quickly and efficiently

Where Does an MO File Go?

WordPress: Place the MO file in the languages directory within your theme or plugin (e.g., wp-content/themes/your-theme/languages/).

GNU gettext: Place the MO file within a directory named after the locale (e.g., locale/es/LC_MESSAGES/ for Spanish).

Java: Store the MO file in a resource directory, often named resources or i18n, depending on your project’s structure.

Translating POT/PO Files

PTC (Private Translation Cloud) lets you automatically translate your POT and PO files in just a few simple clicks. For instant translations, it offers Free resource files translation. This translation tool:

  • Generates high-quality automatic translations for strings in minutes
  • Doesn’t cost you anything—it’s completely free
  • Lets you preview and download the translated resource files, ready to use in your project

To use Free resource files translation:

  1. Upload your source .po or .pot file.
  2. Select the languages you want to translate the file into.
  3. Choose to receive .mo files with compiled translations.
  4. Click the Translate button.
Using Free resource files translation to translate a PO file

Once the translation process finishes, you can review your original text and translations side-by-side. As you can see below, PTC identifies all the msgid strings from the .po file in the source language ( English). It then adds the translations into the msgstr field in the file that holds the translations in your target language ( Spanish).

A .po file translated from English to Spanish using PTC

You can download the .po and .mo translation files and place them in the correct location for your project. It’s that easy!

Integrate PO/POT File Localization Directly Into Your Development

While PTC’s Free Resource Files Translation tool is great you still need to manage updates for all files manually. That can quickly get very time-consuming and prone to human error.

There’s a more efficient way to manage your whole translation workflow – by fully integrating PTC into your Git development process.

With PTC’s full Git integration, you’ll benefit from:

Set it up once, then let PTC handle the rest

By connecting PTC to your Git repository, you automate the entire translation process. PTC makes sure that your software’s translations are always up to date without requiring manual intervention.

Automatic merge requests for translations

As you continue to develop your software, PTC automatically translates new or updated strings. It then sends you merge requests with the translations, allowing you to review and merge them into your project.

Translate across all branches

PTC automatically detects new texts in any branch you’re working on and translates them. You can also choose which branches to translate, giving you control over the localization process in different stages of development.

Superior translation quality

PTC uses advanced AI and machine learning technologies to deliver Better Than Human Translations.Your software’s localization will be fast and meet the highest standards, providing a better experience for your users.

Take Control of Your Software Translations

Whether you’re working with Java programs, GNU gettext, or localizing WordPress themes and plugins, delivering software that resonates with users in their preferred language begins with translating PO files.

Understanding how POT, PO, and MO files work together helps you manage translations smoothly. POT files provide the template, PO files store the translations, and MO files bring them into your software.

Instead of handling translations manually, save time and ensure consistency with PTC. The Free Resource Files Translation tool allows you to generate accurate translations quickly and easily. For an even smoother process, integrating PTC with your Git repository automates the entire workflow, keeping your translations up-to-date across all project branches.

Scroll to Top