From fb5d5e8a7128ee193def6322fb2f75f542e23fb9 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Thu, 15 Oct 2020 09:26:06 -0400 Subject: [PATCH] Fix pluralize function for words like 'display' --- CRM/Utils/String.php | 2 +- ang/api4Explorer/Explorer.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CRM/Utils/String.php b/CRM/Utils/String.php index 8ffc390096..7c08974365 100644 --- a/CRM/Utils/String.php +++ b/CRM/Utils/String.php @@ -944,7 +944,7 @@ class CRM_Utils_String { if ($lastLetter == 's' || $lastLetter == 'x' || $lastTwo == 'ch') { return $str . 'es'; } - if ($lastLetter == 'y' && $lastTwo != 'ey') { + if ($lastLetter == 'y' && !in_array($lastTwo, ['ay', 'ey', 'iy', 'oy', 'uy'])) { return substr($str, 0, -1) . 'ies'; } return $str . 's'; diff --git a/ang/api4Explorer/Explorer.js b/ang/api4Explorer/Explorer.js index a9741dadc4..4b8c0257d9 100644 --- a/ang/api4Explorer/Explorer.js +++ b/ang/api4Explorer/Explorer.js @@ -102,7 +102,7 @@ if (lastLetter === 's' || lastLetter === 'x' || lastTwo === 'ch') { return str + 'es'; } - if (lastLetter === 'y' && lastTwo !== 'ey') { + if (lastLetter === 'y' && !_.includes(['ay', 'ey', 'iy', 'oy', 'uy'], lastTwo)) { return str.slice(0, -1) + 'ies'; } return str + 's'; -- 2.25.1