This is an automated email from the ASF dual-hosted git repository. dill0wn pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/allura.git
commit 70fab3a2127eb0af25d3a5efc6301f7227cd0839 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
