Put your translations in motion.

Provides a normalized way to collect internationalization strings to export, merge & create .po files from versatile sources such as Twig, PHP or YML files.
Ensure an enhanced Developer Experience (DX) when dealing with translations & multilingual websites.

Warning

Potion has been deprecated.

You need Potion if

  • You want to use the Drupal Core built-in translation importation features directly from your CLI,
  • You want to use the Drupal Core built-in translation exportation features directly from your CLI,
  • You want to use a module based on the Core Translation API,
  • You want to retrieve translation strings from your Twig templates in theme(s),
  • You want to retrieve translation strings from the code
  • You want to retrieve translation strings from your shipped configuration and configuration schema files formatted in YML(s),
  • You want to make your life easier by generating final client-friendly .po files by scrapping your code looking for custom translations,
  • You want to be able to re-play a .po file by filling it with data from your database,
  • You are a CLI lover & don't like to click in an UI to deal with translations.

Potion can do a lot more than that, but those are some of the obvious uses of this module.

Features

Still under active development, checkout our ./ROADMAP.md.

Everything contained in the ROADMAP document is in draft form and subject to change at any time and provided for information purposes only

Standard usage scenario

Every command line has a strong documentation when using the --help argument.
Give it a try and feel free to send us feedback in the issue thread.

Import standard po files into Drupal database

drush potion-import [--mode mode] [--overwrite] [-q|--quiet] [-h|--help] langcode source

Export standard po files from Drupal database

drush potion-export [--include-core] [--include-custom] [--include-untranslated] [--progress] [--verbose] [--quiet] [--dry-run] langcode dest

Generate, scrape, parse, & compile your code to generate po file

drush potion-generate [--exclude-yaml] [--exclude-twig] [--exclude-php] [--progress] [--verbose] [--quiet] langcode source dest

Re-fill an existing po file with translations from Drupal database

drush potion-fill [--overwrite] [--verbose] [--quiet] langcode source

Versions

Potion is available for both Drupal 8 & Drupal 9 !

The version 8.x-1.x is not compatible with Drupal 8.8.x.

Drupal 8.8.x brings some breaking change with tests and so you
must upgrade to 8.x-2.x version of Potion.

Which version should I use?

Drupal Core Potion Drush
8.7.x 1.x 9.x
8.8.x 2.x 10.x
9.x 2.x 10.x

Dependencies

The Drupal 8 & Drupal 9 version of Potion requires gettext & the [Symfony Process Component](https://symfony.com/doc/current/components/process.html).

* Gettext is a binary library embedded in the module to prevent version incompatibility & other mishandled behaviours.
* Symfony Process Component is an external PHP library. The recommended way of solving this dependency is using composer, running the following from the command line:

composer require symfony/process:^3.4

Potion is - for now - not compatibility with Windows environment.

We use gettext utilities to extract message IDs or compile message files (.po) and this library need to run under a Unix-like operating system.
Check out our ./ROADMAP.md for future Windows compatibility.

Supporting organizations

This project is sponsored by Antistatique. We are a Swiss Web Agency, Visit us at www.antistatique.net or Contact us.

Getting Started

We highly recommend you to install the module using composer.

composer require drupal/potion

You can also install it using the drush or drupal console cli.

  drush dl potion
  drupal module:install potion
Supporting organizations: 

Project information

Releases