Fix pluralize function for words like 'display'
authorColeman Watts <coleman@civicrm.org>
Thu, 15 Oct 2020 13:26:06 +0000 (09:26 -0400)
committerColeman Watts <coleman@civicrm.org>
Thu, 15 Oct 2020 13:26:06 +0000 (09:26 -0400)
CRM/Utils/String.php
ang/api4Explorer/Explorer.js

index 8ffc390096fd850f21de324560b2655eba96797b..7c0897436508acb9f83c494f343981706c3b235c 100644 (file)
@@ -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';
index a9741dadc45ab8be22048e0a017510508dd5643f..4b8c0257d92155506fd2ca26723363dc15f6670a 100644 (file)
       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';