t() and {% trans %} show no effect although rest of site is translated
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 }}