From 487dc509d5afa4744bdbd1252e9ccc15b129d58b Mon Sep 17 00:00:00 2001 From: Andy Vandenberghe Date: Sun, 4 Oct 2026 22:05:59 +0200 Subject: [PATCH] Make the Who Is Online label plain text in every language VIEWING_RECENT_TOPICS was 'Viewing Recent Topics' in all 14 language packs, but the listener calls lang() without an argument and core's viewonline template already wraps the location in its own link. Who Is Online rendered a link nested inside core's link, pointing at a literal "%s". Drop the markup and placeholder, keeping each translation's wording. Closes #199 Co-Authored-By: Claude Opus 5.5 --- language/ar/recenttopics.php | 2 +- language/cs/recenttopics.php | 2 +- language/de/recenttopics.php | 2 +- language/de_x_sie/recenttopics.php | 2 +- language/en/recenttopics.php | 2 +- language/es/recenttopics.php | 2 +- language/es_x_tu/recenttopics.php | 2 +- language/fr/recenttopics.php | 2 +- language/nl/recenttopics.php | 2 +- language/pt/recenttopics.php | 2 +- language/ru/recenttopics.php | 2 +- language/sk/recenttopics.php | 2 +- language/sv/recenttopics.php | 2 +- language/uk/recenttopics.php | 2 +- tests/language/viewonline_lang_test.php | 47 +++++++++++++++++++++++++ tests/tests.md | 18 +++++++++- 16 files changed, 78 insertions(+), 15 deletions(-) create mode 100644 tests/language/viewonline_lang_test.php diff --git a/language/ar/recenttopics.php b/language/ar/recenttopics.php index 104e239..5187c75 100644 --- a/language/ar/recenttopics.php +++ b/language/ar/recenttopics.php @@ -23,7 +23,7 @@ 'RECENT_TOPICS' => 'أحدث المواضيع', 'RT_NO_TOPICS' => 'لا توجد مواضيع جديدة لعرضها.', 'LIKES' => 'إعجابات', - 'VIEWING_RECENT_TOPICS' => 'يتصفح أحدث المواضيع', + 'VIEWING_RECENT_TOPICS' => 'يتصفح أحدث المواضيع', 'EXTENSION_REQUIRES_330' => 'هذا الامتداد يتطلب phpBB 3.3.0 أو أعلى.', // is_enableable() error messages diff --git a/language/cs/recenttopics.php b/language/cs/recenttopics.php index fccc47b..b2b74e5 100644 --- a/language/cs/recenttopics.php +++ b/language/cs/recenttopics.php @@ -22,7 +22,7 @@ 'RECENT_TOPICS' => 'Nedávná témata', 'RT_NO_TOPICS' => 'Žádná nedávná témata.', 'LIKES' => 'Lajky', - 'VIEWING_RECENT_TOPICS' => 'Prohlíží Nedávná témata', + 'VIEWING_RECENT_TOPICS' => 'Prohlíží Nedávná témata', 'EXTENSION_REQUIRES_330' => 'Tato extenze vyžaduje phpBB 3.3.0 nebo vyšší.', // is_enableable() error messages diff --git a/language/de/recenttopics.php b/language/de/recenttopics.php index fae3ea0..e1b7902 100644 --- a/language/de/recenttopics.php +++ b/language/de/recenttopics.php @@ -23,7 +23,7 @@ 'RECENT_TOPICS' => 'Aktuelle Themen', 'RT_NO_TOPICS' => 'Es sind keine neuen Themen vorhanden.', 'LIKES' => 'Likes', - 'VIEWING_RECENT_TOPICS' => 'Schaut sich Aktuelle Themen an', + 'VIEWING_RECENT_TOPICS' => 'Schaut sich Aktuelle Themen an', 'EXTENSION_REQUIRES_330' => 'Diese Erweiterung benötigt phpBB 3.3.0 oder höher.', // is_enableable() error messages diff --git a/language/de_x_sie/recenttopics.php b/language/de_x_sie/recenttopics.php index 26c7eea..fac1c0f 100644 --- a/language/de_x_sie/recenttopics.php +++ b/language/de_x_sie/recenttopics.php @@ -23,7 +23,7 @@ 'RECENT_TOPICS' => 'Aktuelle Themen', 'RT_NO_TOPICS' => 'Es sind keine neuen Themen vorhanden.', 'LIKES' => 'Likes', - 'VIEWING_RECENT_TOPICS' => 'Schaut sich Aktuelle Themen an', + 'VIEWING_RECENT_TOPICS' => 'Schaut sich Aktuelle Themen an', 'EXTENSION_REQUIRES_330' => 'Diese Erweiterung benötigt phpBB 3.3.0 oder höher.', // is_enableable() error messages diff --git a/language/en/recenttopics.php b/language/en/recenttopics.php index 528fbf6..f600e12 100644 --- a/language/en/recenttopics.php +++ b/language/en/recenttopics.php @@ -23,7 +23,7 @@ 'RECENT_TOPICS' => 'Recent Topics', 'RT_NO_TOPICS' => 'There are no new topics to display.', 'LIKES' => 'Likes', - 'VIEWING_RECENT_TOPICS' => 'Viewing Recent Topics', + 'VIEWING_RECENT_TOPICS' => 'Viewing Recent Topics', 'EXTENSION_REQUIRES_330' => 'This extension requires phpBB 3.3.0 or higher.', // is_enableable() error messages diff --git a/language/es/recenttopics.php b/language/es/recenttopics.php index 3879900..fcd60f0 100644 --- a/language/es/recenttopics.php +++ b/language/es/recenttopics.php @@ -23,7 +23,7 @@ 'RECENT_TOPICS' => 'Temas Recientes', 'RT_NO_TOPICS' => 'No hay nuevos temas que mostrar.', 'LIKES' => 'Me gusta', - 'VIEWING_RECENT_TOPICS' => 'Viendo Temas Recientes', + 'VIEWING_RECENT_TOPICS' => 'Viendo Temas Recientes', 'EXTENSION_REQUIRES_330' => 'Esta extensión requiere phpBB 3.3.0 o superior.', // is_enableable() error messages diff --git a/language/es_x_tu/recenttopics.php b/language/es_x_tu/recenttopics.php index a8b8046..2c0cfa4 100644 --- a/language/es_x_tu/recenttopics.php +++ b/language/es_x_tu/recenttopics.php @@ -23,7 +23,7 @@ 'RECENT_TOPICS' => 'Temas Recientes', 'RT_NO_TOPICS' => 'No hay nuevos temas que mostrar.', 'LIKES' => 'Me gusta', - 'VIEWING_RECENT_TOPICS' => 'Viendo Temas Recientes', + 'VIEWING_RECENT_TOPICS' => 'Viendo Temas Recientes', 'EXTENSION_REQUIRES_330' => 'Esta extensión requiere phpBB 3.3.0 o superior.', // is_enableable() error messages diff --git a/language/fr/recenttopics.php b/language/fr/recenttopics.php index 937fc1a..3be7ab6 100644 --- a/language/fr/recenttopics.php +++ b/language/fr/recenttopics.php @@ -39,7 +39,7 @@ 'RECENT_TOPICS' => 'Sujets récents', 'RT_NO_TOPICS' => 'Il n’y a aucun nouveau sujet à afficher.', 'LIKES' => 'J’aime', - 'VIEWING_RECENT_TOPICS' => 'Consulte les Sujets récents', + 'VIEWING_RECENT_TOPICS' => 'Consulte les Sujets récents', 'EXTENSION_REQUIRES_330' => 'Cette extension nécessite phpBB 3.3.0 ou supérieur.', // is_enableable() error messages diff --git a/language/nl/recenttopics.php b/language/nl/recenttopics.php index ecb9562..e38fa21 100644 --- a/language/nl/recenttopics.php +++ b/language/nl/recenttopics.php @@ -23,7 +23,7 @@ 'RECENT_TOPICS' => 'Recente Onderwerpen', 'RT_NO_TOPICS' => 'Er zijn geen recente onderwerpen weer te geven.', 'LIKES' => 'Likes', - 'VIEWING_RECENT_TOPICS' => 'Bekijkt Recente Onderwerpen', + 'VIEWING_RECENT_TOPICS' => 'Bekijkt Recente Onderwerpen', 'EXTENSION_REQUIRES_330' => 'Deze extensie vereist phpBB 3.3.0 of hoger.', // is_enableable() error messages diff --git a/language/pt/recenttopics.php b/language/pt/recenttopics.php index ce8a81f..43341ad 100644 --- a/language/pt/recenttopics.php +++ b/language/pt/recenttopics.php @@ -23,7 +23,7 @@ 'RECENT_TOPICS' => 'Tópicos Recentes', 'RT_NO_TOPICS' => 'Não há novos tópicos a serem exibidos.', 'LIKES' => 'Gostos', - 'VIEWING_RECENT_TOPICS' => 'Visualizando Tópicos Recentes', + 'VIEWING_RECENT_TOPICS' => 'Visualizando Tópicos Recentes', 'EXTENSION_REQUIRES_330' => 'Esta extensão requer o phpBB 3.3.0 ou superior.', // is_enableable() error messages diff --git a/language/ru/recenttopics.php b/language/ru/recenttopics.php index a6cd46a..f200fe4 100644 --- a/language/ru/recenttopics.php +++ b/language/ru/recenttopics.php @@ -22,7 +22,7 @@ 'RECENT_TOPICS' => 'Последние темы', 'RT_NO_TOPICS' => 'Нет последних тем для отображения.', 'LIKES' => 'Лайки', - 'VIEWING_RECENT_TOPICS' => 'Просматривает Последние темы', + 'VIEWING_RECENT_TOPICS' => 'Просматривает Последние темы', 'EXTENSION_REQUIRES_330' => 'Это расширение требует phpBB 3.3.0 или выше.', // is_enableable() error messages diff --git a/language/sk/recenttopics.php b/language/sk/recenttopics.php index 3da15d6..4ed4870 100644 --- a/language/sk/recenttopics.php +++ b/language/sk/recenttopics.php @@ -23,7 +23,7 @@ 'RECENT_TOPICS' => 'Najnovšie témy', 'RT_NO_TOPICS' => 'Nie sú žiadne nové témy na zobrazenie.', 'LIKES' => 'Lajky', - 'VIEWING_RECENT_TOPICS' => 'Prezerá Najnovšie témy', + 'VIEWING_RECENT_TOPICS' => 'Prezerá Najnovšie témy', 'EXTENSION_REQUIRES_330' => 'Toto rozšírenie vyžaduje phpBB 3.3.0 alebo vyššie.', // is_enableable() error messages diff --git a/language/sv/recenttopics.php b/language/sv/recenttopics.php index d2dab47..44a1872 100644 --- a/language/sv/recenttopics.php +++ b/language/sv/recenttopics.php @@ -24,7 +24,7 @@ 'RECENT_TOPICS' => 'Senaste trådar', 'RT_NO_TOPICS' => 'Det finns inga nya trådar att visa.', 'LIKES' => 'Gillningar', - 'VIEWING_RECENT_TOPICS' => 'Visar Senaste trådar', + 'VIEWING_RECENT_TOPICS' => 'Visar Senaste trådar', 'EXTENSION_REQUIRES_330' => 'Detta tillägg kräver phpBB 3.3.0 eller högre.', // is_enableable() error messages diff --git a/language/uk/recenttopics.php b/language/uk/recenttopics.php index a51cd1d..34bd55c 100644 --- a/language/uk/recenttopics.php +++ b/language/uk/recenttopics.php @@ -23,7 +23,7 @@ 'RECENT_TOPICS' => 'Останні Теми', 'RT_NO_TOPICS' => 'Немає нових тем.', 'LIKES' => 'Вподобання', - 'VIEWING_RECENT_TOPICS' => 'Переглядає Останні Теми', + 'VIEWING_RECENT_TOPICS' => 'Переглядає Останні Теми', 'EXTENSION_REQUIRES_330' => 'Це розширення потребує phpBB 3.3.0 або вище.', // is_enableable() error messages diff --git a/tests/language/viewonline_lang_test.php b/tests/language/viewonline_lang_test.php new file mode 100644 index 0000000..51fd77e --- /dev/null +++ b/tests/language/viewonline_lang_test.php @@ -0,0 +1,47 @@ +, and the listener + * passes no argument, so VIEWING_RECENT_TOPICS must be plain text: a nested link with an + * unfilled %s broke the label (#199). + * + * @dataProvider language_data + */ + public function test_viewing_recent_topics_is_plain_text($file) + { + $lang = []; + include $file; + + $this->assertArrayHasKey('VIEWING_RECENT_TOPICS', $lang); + $this->assertStringNotContainsString('<', $lang['VIEWING_RECENT_TOPICS']); + $this->assertStringNotContainsString('%', $lang['VIEWING_RECENT_TOPICS']); + } +} diff --git a/tests/tests.md b/tests/tests.md index 664892c..f5b9346 100644 --- a/tests/tests.md +++ b/tests/tests.md @@ -46,6 +46,8 @@ tests/ │ ├── topic_count_test.php "Show all pages" count uses the forum list │ ├── topic_likes_test.php ACP "Show like counts" setting │ └── recenttopics_events_test.php Public event API contract (contrib/events.md) +├── language/ +│ └── viewonline_lang_test.php Who Is Online label in every language pack └── functional/ └── recenttopics_test.php End-to-end browser tests ``` @@ -208,7 +210,21 @@ It runs `fill_template()` for one topic with a stand-in Post Love service that r --- -## 8. Functional tests (`functional/recenttopics_test.php`) +## 8. Who Is Online label (`language/viewonline_lang_test.php`) + +**What this code does:** +When someone is on `/app.php/rt` or `/app.php/rt/simple`, the listener sets their Who Is Online location to `VIEWING_RECENT_TOPICS` and the link to the page. Core's `viewonline_body.html` wraps that label in its own ``. + +**What this test file does:** +It loads `recenttopics.php` from every language pack and checks that `VIEWING_RECENT_TOPICS` is plain text: no HTML and no `%` placeholder. + +| Test | Scenario | What it verifies | +|------|----------|-----------------| +| `test_viewing_recent_topics_is_plain_text` | Data provider: one row per language pack | The label has no `<` and no `%`. The packs used to carry `…`, which nested a link with an unfilled `%s` inside core's link (#199) | + +--- + +## 9. Functional tests (`functional/recenttopics_test.php`) **What this code does:** These tests start a real phpBB installation (using the test framework's built-in install), enable the extension, and make HTTP requests using a real browser-like crawler (Symfony DomCrawler). They check the actual rendered HTML for specific elements.