diff options
author | Jérémy Benoist <j0k3r@users.noreply.github.com> | 2020-01-28 10:06:30 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-28 10:06:30 +0100 |
commit | 8afcb3a6478325959c872fccf206bf8dc80d164c (patch) | |
tree | e2d97a8b979ac0eac67a200600cdd9ece2113a61 /src/Wallabag/CoreBundle/Entity/Entry.php | |
parent | 97c6561d5ce3c963ab77a0afd7a9164b2af56c20 (diff) | |
parent | 416d44d0aef68b04aec90d207e33feb68706e1c3 (diff) | |
download | wallabag-8afcb3a6478325959c872fccf206bf8dc80d164c.tar.gz wallabag-8afcb3a6478325959c872fccf206bf8dc80d164c.tar.zst wallabag-8afcb3a6478325959c872fccf206bf8dc80d164c.zip |
Merge pull request #4257 from Simounet/feat/lang-attribute
Use lang attribute
Diffstat (limited to 'src/Wallabag/CoreBundle/Entity/Entry.php')
-rw-r--r-- | src/Wallabag/CoreBundle/Entity/Entry.php | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/Wallabag/CoreBundle/Entity/Entry.php b/src/Wallabag/CoreBundle/Entity/Entry.php index beda581a..19045798 100644 --- a/src/Wallabag/CoreBundle/Entity/Entry.php +++ b/src/Wallabag/CoreBundle/Entity/Entry.php | |||
@@ -788,6 +788,19 @@ class Entry | |||
788 | } | 788 | } |
789 | 789 | ||
790 | /** | 790 | /** |
791 | * Format the entry language to a valid html lang attribute. | ||
792 | */ | ||
793 | public function getHTMLLanguage() | ||
794 | { | ||
795 | $parsedLocale = \Locale::parseLocale($this->getLanguage()); | ||
796 | $lang = ''; | ||
797 | $lang .= $parsedLocale['language'] ?? ''; | ||
798 | $lang .= isset($parsedLocale['region']) ? '-' . $parsedLocale['region'] : ''; | ||
799 | |||
800 | return $lang; | ||
801 | } | ||
802 | |||
803 | /** | ||
791 | * @return string|null | 804 | * @return string|null |
792 | */ | 805 | */ |
793 | public function getUid() | 806 | public function getUid() |