code: protected function isLanguageSupported($requested, $supported)
      {
          $supported = str_replace('_', '-', strtolower($supported));
          $requested = str_replace('_', '-', strtolower($requested));
          return strpos($requested . '-', $supported . '-') === 0;
      }
docs: Returns a value indicating whether the requested language matches the supported language.
  @param string $requested the requested language code
  @param string $supported the supported language code
  @return bool whether the requested language is supported