Hi Michal,
I've found a solution and it worked for me now: I've contacted the developer of TWIG and he gives me a sample filter for gettext. So I can use in templates as an expample {{ 'Welcome to phpMyAdmin'|t }}.
I know, that phpMyAdmin should still work without javascript. Javascript should only be a feature. But if user want to use javascript, this should be secure enough.
I guess with you, that with wrong encoding/charset in browser settings also text in pages may be displayed wrong, but phpMyAdmin still works. Perhabs I will see 'L?schen' instead of 'Löschen', but it still works. But it's different in javascript (I've written many javascripts in past): With wrong encoding/charset in browser settings, you'll get 'Löschen' (or something other terrible for javascript like 'ä' for the letter 'ä') for the string 'Löschen', which crashes all used javascripts. With my "bulletproof"-suggestion (using 'L\u00F6schen' instead of 'Löschen'), only the text is displayed wrong (I will see 'L\u00F6schen' or 'L?schen' instead 'Löschen'), but javascript still working.
Regards Michael