The Wayback Machine - https://web.archive.org/web/20201130162041/https://github.com/strapi/strapi/issues/7098
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(Russian cyrillic) ERROR on save - Content Type name cannot be pluralized #7098

Open
reslear opened this issue Jul 21, 2020 · 8 comments
Open

(Russian cyrillic) ERROR on save - Content Type name cannot be pluralized #7098

reslear opened this issue Jul 21, 2020 · 8 comments

Comments

@reslear
Copy link

@reslear reslear commented Jul 21, 2020

Describe the bug
A clear and concise description of what the bug is.

Steps to reproduce the behavior

  1. Go to 'http://localhost:1337/admin/plugins/content-type-builder/'
  2. Click on 'content-type edit'
  3. change name in cyr symbols "Заказы"
  4. Click on 'Save'
  5. See error in console

Expected behavior
payload: error: contentType.name
Content Type name "Заказы" cannot be pluralized. Suggestion: add Item after the name (e.g News -> NewsItem).

Screenshots
Снимок экрана 2020-07-21 в 15 14 00

System

  • Node.js version: v12.16.3
  • NPM version: latest
  • Strapi version: 3.0.6
  • Database: postgres
  • Operating system: macos
@reslear reslear changed the title Content Type name cannot be pluralized (Russian cyrillic) ERROR on save - Content Type name cannot be pluralized Jul 22, 2020
@lacoste-sochi

This comment was marked as off-topic.

@lauriejim
Copy link
Member

@lauriejim lauriejim commented Jul 31, 2020

Hello! It's not planned to support this.
In fact, we should avoid the possibility to have other that Latin characters as Content-Type name (for now)
@petersg83 @alexandrebodin probably something easy to fix.

@reslear
Copy link
Author

@reslear reslear commented Aug 2, 2020

Hello! It's not planned to support this.
In fact, we should avoid the possibility to have other that Latin characters as Content-Type name (for now)
@petersg83 @alexandrebodin probably something easy to fix.

thx for answer
unstable, but worked on previous versions (last beta), maybe need to make another text field label without pluralization and regexp check, for good visualization in the sidebar post types multi-language.

Снимок экрана 2020-08-03 в 00 29 44

@Ashot-KR
Copy link
Contributor

@Ashot-KR Ashot-KR commented Sep 7, 2020

@reslear i have made some investigations.
Actually issue not in cyrillic, any non-latin words will throw error.
pluralize library works well with english, but will made wrong plurals for other languages. For example Czech: kniha -> knihy, but pluralize will return knyhas, which is wrong.

I found a little workaround (but it's not ideal! you will see explanation at the end of comment):
pluralize library has addPluralRule which allows to add custom rules for pluralization.
So we can preconfigure pluralize lib:

  1. edit config/functions/bootstrap.js file:
const pluralize = require('pluralize')

module.exports = () => {
  // add any rules. First argument is Regex, second is string to replace
  pluralize.addPluralRule($/i, 'и')
  pluralize.addPluralRule(/мышь$/i, 'мыши')
};

UPD: methods addSingularRule, addIrregularRule, addUncountableRule can also be used here. See https://github.com/plurals/pluralize#usage for examples.

  1. create collection type in content-type builder, but type in Article as display name(at this point i recommend use english, so stapi generate folders/files/rotes/etc with proper names).

  2. open articles content type edit dialog and set статьи as display name. save it.

  3. voila! we have properly names
    image

But there is a bad thing i mentioned above: we have mis grammars in other places 😄
image image

This method can be used for any language.

@reslear
Copy link
Author

@reslear reslear commented Sep 8, 2020

@Ashot-KR wow, good temporary solution 🎉
@lauriejim @alexandrebodin Please consider the idea of creating an additional field for the Label only for display in the admin panel

@iksent
Copy link

@iksent iksent commented Oct 20, 2020

This is a very important issue: If you change "info.name" (to smth, that can't be pluralized) from the code at .json file, then you won't be able to add new fields to this content type.
Please, fix this asap.

I've tried one of the latest Strapi (3.2.3) and the issue is still there.

@smwbtech
Copy link

@smwbtech smwbtech commented Oct 28, 2020

One of my project was on Strapi 3.0.0-beta.19. I got some free time and now want migrate for last and stable version. As code base was not large I started start from scratch, but I stuck with this problem. It would be nice to have extra field for side bar label.

@sam-pires
Copy link

@sam-pires sam-pires commented Oct 28, 2020

Hello everyone, thanks for your feedback.
We have an RFC (Request For Comments) about the pluralization topic in general. If you want to take part in the discussion and share feedback and suggest ideas you can do it there too :)
strapi/rfcs#18

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
7 participants
You can’t perform that action at this time.