What is the correct way to cache blocks by language? I have a multilingual site with custom blocks in the right-hand menu - the content of which is generated dynamically through the build() function of BlockBase and which changes depending on the interface language. I want to cache these once per language. Elsewhere I've used:

public function build() {
 $node = \Drupal::routeMatch()-&gt;getParameter('node');
 return array(
  '#theme' =&gt; 'my_template',
   ....
  '#cache' =&gt; [
    'tags' =&gt; [
      'node:' . $node-&gt;getId()
    ],
  ],
);


}

I've gone with this approach, which appears to work, although I'm not sure how to test that it isn't still processing templates on every call:

public function build() {
 return array(
  '#theme' =&gt; 'my_template',
   ....
  '#cache' =&gt; [
    'tags' =&gt; [
      'language:' . \Drupal::languageManager()-&gt;getCurrentLanguage()-&gt;getId()
    ],
  ],
);


}

Is this the correct way to do it? I could find examples of the node: prefix in the docs, but nothing about language:
You should use the languages context, don't use tags here.

Like this: '#cache' =&gt; ['contexts' =&gt; ['languages:language_interface']],

You'll find more here: https://www.drupal.org/developing/api/8/cache/contexts