Search code examples
strapi

How to disable Plural suffix?


Collection Types List does not list collectionName

API name is not "collection name" instead it is "Display Name" of Created collection type.

How to control Plural suffix?

Is there any way to define new irregular rule for pluralize utility?

pluralize.plural('irregular') //=> "irregulars"

I can not create content types other than English. It just adds it's own suffix, it makes i18n impossible.

Steps to reproduce the behavior

  1. Go to 'Content-Types Builder'
  2. Click on 'Create new collection type'
  3. Enter "araba" (a non-english word) to 'Display name'
  4. Enter "arabalar" (plural non-english word) to 'Collection name' under 'Advanced Settings'
  5. Check out left menu it does not display collectionName instead it displays API name

Expected behavior

IT SHOULD BE "arabalar" not "arabas" which was entered as collection name

Screenshots

singular plural

"arabalar" is plural of "araba" not "arabas"

wrong

System

  • Node.js version: v12.16.1
  • yarn version: 1.22.4
  • Strapi version: v3.0.0-beta.19.3
  • Database: sqlite
  • Operating system: windows

Solution

  • It's not possible to disable pluralization, but there is a workaround:

    1. Open file api\araba\models\araba.settings.json (araba is your API name)
    2. Add key displayName to info part of the
    
        "info": {
           "name": "Araba",
           "displayName": "arabalar"
         },
    
    
    1. create a file admin/src/components/LeftMenuLinkSection/index.js
    2. copy into it the contents of file node_modules/strapi-admin/admin/src/components/LeftMenuLinkSection/index.js
    3. Change this
    
       <LeftMenuLink
         location={location}
         key={index}
         iconName={link.icon}
         label={link.label}
         destination={getLinkDestination(link)}
       /> 
    
    

    to this

           <LeftMenuLink
             location={location}
             key={index}
             iconName={link.icon}
             label={link.schema && link.schema.info.displayName ? link.schema.info.displayName : link.label}
             destination={getLinkDestination(link)}
            />
    
    

    and yarn strapi build