mirror of
https://github.com/wallabag/wallabag.git
synced 2025-10-15 19:42:08 +00:00
Use lang attribute
This commit is contained in:
parent
7937ed0c20
commit
416d44d0ae
5 changed files with 51 additions and 9 deletions
|
@ -787,6 +787,19 @@ class Entry
|
|||
return $this->language;
|
||||
}
|
||||
|
||||
/**
|
||||
* Format the entry language to a valid html lang attribute.
|
||||
*/
|
||||
public function getHTMLLanguage()
|
||||
{
|
||||
$parsedLocale = \Locale::parseLocale($this->getLanguage());
|
||||
$lang = '';
|
||||
$lang .= $parsedLocale['language'] ?? '';
|
||||
$lang .= isset($parsedLocale['region']) ? '-' . $parsedLocale['region'] : '';
|
||||
|
||||
return $lang;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue