From 01d476f5427c650eb51750e348b6df2ee2a245c9 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sat, 17 Nov 2018 08:02:09 -0500 Subject: [PATCH] Use only language part of locale for popular languages - Fixes https://github.com/friendica/friendica-directory/issues/13 --- src/classes/Views/Widget/PopularLanguages.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/classes/Views/Widget/PopularLanguages.php b/src/classes/Views/Widget/PopularLanguages.php index 0798d86..288f666 100644 --- a/src/classes/Views/Widget/PopularLanguages.php +++ b/src/classes/Views/Widget/PopularLanguages.php @@ -24,7 +24,7 @@ class PopularLanguages 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); $vars = [