This is an automated email from the ASF dual-hosted git repository.

gcruz pushed a commit to branch gc/8464
in repository https://gitbox.apache.org/repos/asf/allura.git


The following commit(s) were added to refs/heads/gc/8464 by this push:
     new 7d109683c [#8464] added helper to pluralize specific tool names
7d109683c is described below

commit 7d109683cf02396a9ed3abfb2feaddb8ef24139d
Author: Guillermo Cruz <[email protected]>
AuthorDate: Wed Sep 21 15:02:33 2022 -0600

    [#8464] added helper to pluralize specific tool names
---
 Allura/allura/controllers/project.py | 2 +-
 Allura/allura/lib/helpers.py         | 7 +++++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/Allura/allura/controllers/project.py 
b/Allura/allura/controllers/project.py
index e78d29e03..56d01c9d0 100644
--- a/Allura/allura/controllers/project.py
+++ b/Allura/allura/controllers/project.py
@@ -329,7 +329,7 @@ class ToolListController:
             total_entries=total_entries,
             entries=entries[start:start + limit],
             type=tool_label,
-            tool_name=tool_label,
+            tool_name=h.pluralize_tool_name(tool_label, total_entries),
             )
 
 
diff --git a/Allura/allura/lib/helpers.py b/Allura/allura/lib/helpers.py
index 5ecb7862f..4a5445b26 100644
--- a/Allura/allura/lib/helpers.py
+++ b/Allura/allura/lib/helpers.py
@@ -1318,3 +1318,10 @@ def username_project_url(user_or_username):
         url = user.url()
 
     return f'{url}profile/'
+
+
+def pluralize_tool_name(tool_name:string, count:int):
+    pluralize_tools = ['Wiki', 'Discussion', 'Blog']
+    if tool_name is not None and tool_name in pluralize_tools:
+        return f"{tool_name}{'s'[:count^1]}"
+    return tool_name

Reply via email to