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

When creating a record and the collection labels are localized, "document" shows instead of the singular label #5992

Open
CherryDT opened this issue Apr 24, 2024 · 0 comments · May be fixed by #5995
Assignees
Labels
[possible-bug] Possible bug which hasn't been reproduced yet

Comments

@CherryDT
Copy link

CherryDT commented Apr 24, 2024

Link to reproduction

No response

Describe the Bug

This is a follow-up to #5796.

At this point here, the word "document" is shown:

image

...even though the collection has labels:

labels: {
  singular: {
    de: 'Benutzer',
    en: 'User'
  },
  plural: {
    de: 'Benutzer',
    en: 'Users'
  }
}

I think the issue is here:

label:
typeof collection?.labels?.singular === 'string'
? collection.labels.singular
: t('document'),

collection.labels.singular is not a string but an object like { en: 'User', de: 'Benutzer' } , because it has multiple languages.

It should probably be getTranslation(collection?.labels?.singular, i18n) and not directly try to access collection.labels.singular.

To Reproduce

Create a collection with a multi-language label. Create a document in the colleciton.

Payload Version

2.12.2

Adapters and Plugins

db-mongodb, bundler-webpack

@CherryDT CherryDT added the [possible-bug] Possible bug which hasn't been reproduced yet label Apr 24, 2024
@JessChowdhury JessChowdhury self-assigned this Apr 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[possible-bug] Possible bug which hasn't been reproduced yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants