Use only language part of locale for popular languages

- Fixes https://github.com/friendica/friendica-directory/issues/13
This commit is contained in:
Hypolite Petovan 2018-11-17 08:02:09 -05:00
parent b29aafc2d9
commit 01d476f542

View file

@ -24,7 +24,7 @@ class PopularLanguages
public function render(): string public function render(): string
{ {
$stmt = 'SELECT `language`, COUNT(*) AS `total` FROM `profile` WHERE `language` IS NOT NULL GROUP BY `language` ORDER BY COUNT(`language`) DESC LIMIT 10'; $stmt = 'SELECT LEFT(`language`, 2) AS `language`, COUNT(*) AS `total` FROM `profile` WHERE `language` IS NOT NULL GROUP BY LEFT(`language`, 2) ORDER BY COUNT(*) DESC LIMIT 10';
$languages = $this->connection->fetchAll($stmt); $languages = $this->connection->fetchAll($stmt);
$vars = [ $vars = [