t() and {% trans %} show no effect although rest of site is translated I'm a bit hesitant to ask this, but I have a drupal 8 site with 2 languages enabled - English as default and German. I have URL prefixes 'en' and 'de' to detect the chosen language. When setting German as default, the menus are translated, fields etc. It all works reasonably well. However, none of strings I use in my custom modules are translated. A very simple example

class testController extends ControllerBase {

...
drupal_set_message(t("Sorry, that does not work"));
....
}


The string is not translated when using german as the site's default language. Furthermore in my twig templates {% trans %} Hello {% endtrans %} have absolutely no effect.

Is there something I am missing here or I have to specifically set up ? I have used google for hours but do not find any solution to this weird problem. I've also tried all kinds of language detection methods in the Drupal settings - no effect. I have modules: Configuration Translation, Content Translation, Interface Translation and Language enabled.
If the strings in your custom module are in English but the site's default language is in German, you will need to translate the strings in the admin UI:

/admin/config/regional/translate

If you search for the string on this page but don't see it, you will need to first visit the page/path on the site that causes the string to be displayed so that the string will be created for translation purposes.  Then you can return to the translation page and translate the string.

To translate strings in a twig template, do it like this:

{{ 'This is a string to translate.'|trans }}