How do I get the path alias without the language code? Suppose I have an alias like http://www.example.com/en/the-new-webpage.html.

I want to get the the-new-webpage.html part in hook_preprocess_html(). The language code might change into 'ja' or some other code due to the language availability. So I can't get the URL and pass it to str_replace() to replace the language part. Is there a function or a way to get the alias part without the language code?
Since you just need the last part of the path, you can use the following code in a hook_preprocess_html() implementation.

$current_path = \Drupal::service('path.current')-&gt;getPath();
$alias = \Drupal::service('path.alias_manager')-&gt;getAliasByPath($current_path);
if (basename($alias) == 'the-new-webpage.html') {
  // Your code here
}