How do I get a contextual filter argument in a template file? I use contextual filters for a view whose path is /path/langcode, where langcode is a contextual filter. How can I get langcode in a template file?
You can get the contextual filter argument from the route match:

  $variables['arg_0'] = \Drupal::routeMatch()-&gt;getParameter('arg_0');


Usually the route parameters of contextual filters are named arg_0, arg_1 etc. If it doesn't work, check the route definition of this View page with Devel (/devel/routes) or Drupal Console.

Dependent on the Twig template you might need to add a cache context as well:

  $variables['#cache']['contexts'][] = 'route';