How to translate strings in (programmatically created) custom module? 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' =&gt; $this-&gt;t('How and where can I translate this string?'),
  );
}
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.