I want to translate my Drupal 8 site to another language.
I have several translatable strings in my custom theme and modules specified via either the t
method or {% trans %}
.
To translate these I have activated interface translation. I can now find my strings by going to admin/config/regional/translate
.
The problem is this page lists all strings including all strings defined by core. For this project I don't want to translate the admin interface, we specifically want it to stay in the default language (English). This means 90% of the strings listed should not be translated.
I know that I can set the admin interface to stay in a certain language by checking a box on the user account settings page, but this only works when on an admin page. When visiting a node in a translated language, the admin toolbar will still be translated if there are translated strings. If this problem could be solved it would probably be the best solution to just have that box checked.
But for now it seems like my only other option is to only translate the strings I want translated and none of the admin strings. To do this I feel like I have to be able to filter the list of strings on the interface translation page somehow. But there is no way to filter out strings based on which theme or module they are defined in. Or is there?
I have seen that there is a context parameter you can pass to the t
method or {% trans %}
. Maybe if I add a key like "translate" or something here, I could filter out strings with this context and only translate them. The thing is it feels like using the context parameter in the wrong way and it does not seem to be any way to filter by context either.
Does anyone have a good solution for this?