0

I've (programmatically) created a custom module which includes a block with a string wrapped in the $this->t() function. How or where can I extract this translation file?

In Drupal 7 I would extract a translation file of the custom module, but the POTX module is not ported to Drupal 8 yet.

public function build() {
  return array(
    '#markup' => $this->t('How and where can I translate this string?'),
  );
} 
1
  • @4k4 I don't think that's the answer I'm looking for. The 'Translate Interface' option only allows to export one file with all translations. I'm looking for a way to extract the translations for one specific (custom) module, like in Drupal 7 would be done with POTX.
    – LizZerrG
    Commented Jan 24, 2017 at 16:51

1 Answer 1

1

Potx is not yet ported to Drupal 8 but it can parse Drupal 8 modules.

You can install it as a drush command instead of a drupal module and then it should work fine on your Drupal 8 module.

What that doesn't support yet is extracing existing translations from a running site. Looks like people are working on a port in https://www.drupal.org/node/2356469 which supports that.

1
  • Thanks for your reply. The proposed solution (downloading the Drupal 7 module to use the Drush command) didn't work for me, but I did get it to work with the kgaut/drupal-potx module. Doesn't sound like the best solution yet, but at least it works..
    – LizZerrG
    Commented Jan 25, 2017 at 9:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.