GenCode - Fix pluralization of words ending in x
authorColeman Watts <coleman@civicrm.org>
Tue, 7 Jul 2020 23:54:21 +0000 (19:54 -0400)
committerTim Otten <totten@civicrm.org>
Thu, 16 Jul 2020 22:21:09 +0000 (15:21 -0700)
CRM/Utils/String.php
ang/api4Explorer/Explorer.js

index 654b74ff0ebcb41cbd4c28162935265021dbebe0..8ffc390096fd850f21de324560b2655eba96797b 100644 (file)
@@ -941,7 +941,7 @@ class CRM_Utils_String {
   public static function pluralize($str) {
     $lastLetter = substr($str, -1);
     $lastTwo = substr($str, -2);
-    if ($lastLetter == 's' || $lastTwo == 'ch') {
+    if ($lastLetter == 's' || $lastLetter == 'x' || $lastTwo == 'ch') {
       return $str . 'es';
     }
     if ($lastLetter == 'y' && $lastTwo != 'ey') {
index 653ee7bd8f794f82aa88bc110bb4aa15bfacec0c..f07c22958a4d8ba87896b87dd4853b8f77ec09fb 100644 (file)
@@ -96,7 +96,7 @@
     function pluralize(str) {
       var lastLetter = str[str.length - 1],
         lastTwo = str[str.length - 2] + lastLetter;
-      if (lastLetter === 's' || lastTwo === 'ch') {
+      if (lastLetter === 's' || lastLetter === 'x' || lastTwo === 'ch') {
         return str + 'es';
       }
       if (lastLetter === 'y' && lastTwo !== 'ey') {