Download the PHP package publishpress/translations without Composer

On this page you can find all versions of the php package publishpress/translations. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package translations

PublishPress Translations

AI-powered translation automation for PublishPress plugins using Potomatic, OpenAI, and Weblate.

Features

Requirements

Installation

Note: This setup works the same whether you're working from the plugin root or inside dev-workspace.

Recommended setup:

Step 1: Add to root composer.json

Step 2: Install

Usage

Set Environment Variables

Before using the translation tools, set your API keys as environment variables: Create a .env file in your plugin root with your API keys:

The .env file is automatically loaded when you run the translation tool. No additional configuration needed.

Values can be quoted or unquoted:

Alternatively, you can set environment variables directly in your shell:

Windows (PowerShell):

Windows (CMD):

Mac/Linux:

Or create a .env file in your plugin root (don't commit this!):

Note: Shell environment variables take precedence over .env file values.

Get your Weblate API token:

  1. Sign up at weblate.publishpress.com
  2. Go to your profile: https://weblate.publishpress.com/accounts/profile/#api
  3. Copy your personal API key

Additional configuration

The following environment variables control advanced behaviour:

Complete Translation Workflow

1. Run Translation (Full Cycle)

From dev-workspace:

From plugin root:

What happens when you run composer translate:

  1. 📥 Download - Pulls existing translations from Weblate (if project exists)
  2. 🤖 AI Translate - Potomatic adds translations for new/missing strings
  3. 📤 Upload - Pushes updated translations back to Weblate

This ensures:

2. Review & Improve in Weblate

After running translate, you can visit your project in Weblate:

  1. Hosted Weblate: https://hosted.weblate.org/projects/YOUR-PROJECT/
  2. Self-hosted Weblate: https://YOUR-WEBLATE-DOMAIN/projects/YOUR-PROJECT/
  3. Review and improve AI-generated translations
  4. Use Weblate's translation memory and suggestions
  5. Collaborate with community translators

3. Download Only

If you just want to download the latest translations without running AI translation:

Use this when:

Advanced options:

4. Repair Malformed Plural Entries

If you have existing .po files with malformed plural entries (a known issue with older Potomatic versions where msgstr[0] contains "singular|plural" instead of separate msgstr[0]/msgstr[1] lines), you can fix them:

What this fixes:

Note: New translations are automatically repaired during the translation process, so you only need this for existing files.

Note: The library automatically detects your environment (dev-workspace vs plugin root) and uses the correct vendor path.

5. Clean Duplicate Entries

Remove duplicate extracted comments from all .po files:

What this does:

When to use:

Important: This command only processes .po files and doesn't interact with Weblate or run AI translation.

6. Check Translation File Status

Check whether .po source files and compiled formats (.mo, .json, .l10n.php) are in sync:

What this does:

When to use:

Compiling Translation Files:

Compile .mo, .json, and .l10n.php files from .po sources using:

The library verifies compilation status but delegates actual compilation to your build/deployment tools.

7. Translation audit (--audit)

Run static checks (and optionally an OpenAI "worthiness" review) on .po files under languages/. This does not call Weblate or run the normal translate/upload cycle.

Basic usage:

What it checks (all run by default; see --audit-only to limit):

Id Focus
text Git-changed .po entries: optional AI judgment whether the translation still fits the source (uses OPENAI_API_KEY; spending capped by --audit-max-cost)
empty Untranslated (msgstr empty) strings
fuzzy Fuzzy-flagged entries
pot Strings present in .pot but missing or mismatched in .po
version Project-Id-Version header vs plugin version (advisory; headers are not rewritten by the tool)
source-i18n Statically extractable i18n calls in PHP and JS/JSX source vs POT entries for each text domain

Modes (--audit-mode):

Scope: Only locales in the translator target language list are scanned (same defaults and --languages handling as AI translation). Codes filtered out by SKIP_LANGUAGES are not audited, even if you list them in --languages. To audit a narrower set of allowed locales, use e.g. --languages=de_DE,fr_FR.

For the source-i18n check, source scanning also excludes paths from AUDIT_SOURCE_EXCLUDE_PATHS (comma-separated fragments). If unset, defaults are: dev-workspace-cache,vendor,lib/vendor,node_modules.

Run a subset of checks:

--audit-only accepts a comma-separated list: text, empty, fuzzy, pot, version, source-i18n.

Cost control (text check only):

Optional context for the text check: set PLUGIN_AI_CONTEXT to a short blurb about the plugin under audit if you want the AI judge to weigh domain-specific wording. See Additional configuration for behavior and limits.

Report files: By default, findings are summarized on the terminal only. To also write full reports to disk:

Formats: txt (plain UTF-8, good for CI logs), ansi (color codes), html (single-file overview). Aliases plain and text map to txt. If --audit-report-dir is omitted, files are written to the plugin root. Report files use the basename translation-audit-report with extensions .txt, .ansi.txt, or .html depending on format.

Exit code: The process exits with a non-zero status if any finding is treated as failing (for example severity error, user quit at a prompt, or a failed revert). Warnings alone may still exit 0 depending on finding metadata—use --audit-report-format=txt in CI if you need a full artifact to review.

--audit-strict-po: Reserved for stricter PO parsing when a gettext v5 stack is available; typical Composer stacks (e.g. alongside WP-CLI) still use gettext v4, so this flag may only log that strict mode is unavailable.

Default Languages

The tool translates into these languages by default:

Skipping Languages (Optional)

No languages are skipped by default; Italian (it_IT), Spanish (es_ES), and French (fr_FR) are translated like any other target language. If you want specific languages to be handled by human translators instead of AI, opt them out with the SKIP_LANGUAGES environment variable (see Additional configuration):

How Skipped Languages Work:

  1. Translation (composer translate) - Skipped languages are not passed to Potomatic AI translation
  2. Upload (composer translate:upload) - Skipped languages are NOT uploaded to Weblate
  3. Download (composer translate:download) - Skipped languages ARE downloaded from Weblate (translations can be pulled but not replaced by AI)
  4. Cleaning/Syncing - Skipped languages ARE operated on by --clean-po and --sync-files (useful for maintenance without risk of overwriting with AI)
  5. Audit (--audit) - Uses the same target-language list as translation (skipped locales are excluded by default, and --languages is filtered the same way), so skipped-language .po files are not scanned. This differs from --clean-po / --sync-files, which iterate every .po in languages/.

Preventing Plugin Name Translation

By default, all strings in your plugin are translated, including the plugin name. To keep your plugin name untranslated, add it to your composer.json file:

The translation tool will then automatically keep the plugin name untranslated in all PO files, both when:

Translation Overrides and Exclusions

You can control which words or phrases should be kept untranslated (excluded) or have specific translations enforced across all languages or per-language using environment variables.

Global Overrides (All Languages)

Set TRANSLATION_OVERRIDES to specify words that should be kept untranslated in all languages:

Or in your .env file:

Per-Language Overrides

Use TRANSLATION_OVERRIDES_{language} to override specific words for individual languages:

Or in your .env file:

Custom Translations (Overrides)

You can also force specific translations using the source=target format:

How Overrides Work

Priority: Language-specific overrides take precedence over global overrides.

Example:

Automatic Dictionary Integration:

The library includes a built-in dictionary (config/dictionaries.json) with common brand names and technical terms that are automatically kept untranslated:

These are applied automatically without needing to set them in TRANSLATION_OVERRIDES.

How It Works

Translation Cycle (composer translate)

Step 1: Download from Weblate

Step 2: AI Translation with Potomatic

Step 3: Upload to Weblate

Download Only (composer translate:download)

  1. Connects to Weblate using your API token
  2. Finds your plugin's project and components
  3. Downloads latest .po files for all languages
  4. Converts to .mo files for WordPress
  5. Saves to your languages/ folder

Use this when:

Weblate Integration

One-Time Setup

Set your API keys permanently:

Windows:

Mac/Linux (add to ~/.bashrc or ~/.zshrc):

Troubleshooting

"Potomatic not found" Error

This shouldn't happen if you installed via Composer. If it does, please report it as a bug.

"OPENAI_API_KEY not set" warning / exit

If OPENAI_API_KEY is not configured:

Make sure you've set the environment variable before running live translations.

"Weblate not configured" Error

This appears when running --download without WEBLATE_API_TOKEN set. Weblate integration is optional for generation but required for download.

"No .pot files found" Error

Ensure your plugin has a languages/ directory with .pot translation template files. Generate these using tools like:

Weblate Upload Fails

If Weblate upload fails, the translation process continues (translations are still saved locally). Check:

Development

Clone the Repository

Testing Locally

To test the library before publishing:

  1. In your plugin's composer.json, add a repository:

  2. Run composer install

License

GPL-3.0-or-later

Credits

Built with Potomatic by GravityKit.


All versions of translations with dependencies

PHP Build Version
Package Version
Requires php Version >=7.2.5
ext-json Version *
gettext/gettext Version ^4.8
guzzlehttp/guzzle Version ^7.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package publishpress/translations contains the following files

Loading the files please wait ...