strapi / rfcs

RFCs for Strapi future changes
67 stars 31 forks source link

Request — Collection Display names pluralizing problems #18

Open sebqq opened 3 years ago

sebqq commented 3 years ago

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:

The problem is, the "Display name" as shown in your screenshot is pluralized based on English rules.

In German for example the plural of events is "Veranstaltungen" and Strapi automatically adds an "s" to the end => "Veranstaltungens" - which is not correct.

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

sebqq commented 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.

sebqq commented 3 years ago

Another solution could be a checkbox next to Display name that says "Dont pluralize in dashboard".

sebqq commented 3 years ago

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:

As strapi still needs both, a plural and singular form od collection name, I've written some notes about possible solution:

  1. Let Display name represents only labels across the dahsboard.
  2. MakeCollection name to be automatically generated from display name by default, BUT make it writeable to allow changes (this is current behaviour).
  3. Add a new Checkbox with "Pluralize manually" label, that allows developers to decide, whether they would like to provide pluralized form, or it can be automatically generated (by pluralize package, as it is now).
  4. There also should be a new input field, which represents pluralized collection name - This field should be readonly by default and should change to writeable, when user checks mentioned checkbox.

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

derrickmehaffy commented 3 years ago

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:

Personally I -still- feel our display stuff for the model itself (not the fields) needs to be based off the model settings.

Ortimis commented 3 years ago

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.