1
0
Fork 0
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:
Simounet 2019-01-11 21:09:49 +01:00
parent 7937ed0c20
commit 416d44d0ae
No known key found for this signature in database
GPG key ID: 77D3B7DC794EB770
5 changed files with 51 additions and 9 deletions

View file

@ -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
*/