Open sebqq opened 3 years ago
The solution could be as simple as giving us an optional env var or argument or flag, which decides, whether we (admins) would like to display to our dashboard users pluralized collection types inside of UI or not.
I believe that this behaviour would not be breaking change and it is simple enough to implement.
Another solution could be a checkbox next to Display name that says "Dont pluralize in dashboard".
So basically, after some testing of that already closed PR of mine I've found out it is not gonna be that easy. Including some points about potential solution, that might be usefull:
The effects of setting 'display name' are currently divided by:
Display name
set during collection creation:
api/
folder.Display name
changed after collection was created:
api/
files of that collection are not overriden, which is IMHO good, because when developer needs to set Display name
(localized) for dashboard, in most scenarios, he still would like to work with english-named endpoints, etc.As strapi still needs both, a plural and singular form od collection name, I've written some notes about possible solution:
Display name
represents only labels across the dahsboard.Collection name
to be automatically generated from display name by default, BUT make it writeable to allow changes (this is current behaviour).api/
folder using Collection name
and Pluraziled Collection name
meta fields.[collectionName].settings.json
, so we can access them in strapi's code without need to use pluralize
plugin.Colleciton name
(not Display name
)Does it make any sense? I'm still not totally familiar with Strapi's codebase so there probably will be some cases that I did not cover.
cc @alexandrebodin
Linking the forum thread that had some more information: https://forum.strapi.io/t/weird-behaviour-of-display-name-of-a-collection-type-in-admin
To summarize my thoughts:
somename.settings.json
should have an option to define the singular version, and plural version.Personally I -still- feel our display stuff for the model itself (not the fields) needs to be based off the model settings.
I completely agree with @derrickmehaffy . In this case, pretty much anything is better than the current silently automated process. A small disclaimer would do as a fast, cheap and easy solution.
Summary
Current way of Collection name's pluralizing does not work in other languages as different languages has different rules in order to pluralize words.
Example
For example, when I try to use word "Produkt" (in slovak it means product), the content-type-builder makes "Produkts" from it in order to pluralize it, which is wrong, because right form of this word in slovak language is "Produkty".
I will cite another example from #7505 from @bernhardw:
Motivation
These inconsistencies could be critical (for us, that are not working for English-speaking clients) in order to present our work to our clients, that expects precision and professionalism from our solution.
Detailed design
Most simplified solution would be to let admins decide, whether content-type-builder should use
pluralize
package (default option) or admin will provide pluralized form of targetted word.Pluralized form could be potentially added from Main tab area (maybe below display name) or from "Advanced Settings" Tab during collection creation.
I don't know strapi's internals good enough yet, but maybe we can store both forms (singular and plural) inside of json model and use appropriate form when needed.
Tradeoffs
Alternatives
I'm not able to thing of any alternative right now. Maybe, I will add something later
Unresolved questions
I don't see any right now, but I might add them later