First modify module_name.info.yml add:
'interface translation project': block_example
'interface translation server pattern': modules/examples/%project/translations/%language.po*
Then create in your module directory folder translations.
Add translations/language.po files, where you will store translations.
language.po:
msgid "your id to translate"
msgstr "translations test"
template.html.twig:
<p>{% trans %}your id to translate{% endtrans %}</p>
Then go to your Drupal admin page Configuration/User interface translation, there you can filtr your msgid and see already translated files.
You may have to use IMPORT {just upload .po file}
Translations are imported automatically when you install your module.