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

MultiSelect: Translation does not take effect #6303

Closed
cromerc opened this issue Aug 28, 2024 · 3 comments · Fixed by #6414
Closed

MultiSelect: Translation does not take effect #6303

cromerc opened this issue Aug 28, 2024 · 3 comments · Fixed by #6414
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@cromerc
Copy link

cromerc commented Aug 28, 2024

Describe the bug

MultiSelect does not show the locale translation when you have a comma separated select and have selected various items. It always shows in English.

In the stackblitz that I shared I show a working Select component that will change between English, Spanish or Chinese. Then after that there is a MultiSelect component that does not change language when the language is modified.

Reproducer

https://stackblitz.com/edit/primevue-4-vite-issue-template-v4fdq8

PrimeVue version

4.0.5

Vue version

3.x

Language

TypeScript

Build / Runtime

Vite

Browser(s)

No response

Steps to reproduce the behavior

  1. Add a multi select component that is comma separated and set its max selected labels to a value lower than the number of options.
  2. Change the locale for the primevue components.
  3. The translation does not take effect on this specific component.

Expected behavior

The component should show "N elementos seleccionados" instead of "N items selected" if spanish is selected for example.

@cromerc cromerc added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Aug 28, 2024
@avramz
Copy link
Contributor

avramz commented Sep 2, 2024

There is a selectedItemsLabel prop for MultiSelect, which takes precedence over the locale.
Demo: https://stackblitz.com/edit/primevue-4-vite-issue-template-shrs7a?file=src%2FApp.vue,src%2Fassets%2Fprimevuelocales.json

By looking at the code, the selectedItemsLabel has a default value, so selectionMessage from locale config will never render.
selectedItemsLabel should be removed in favor of locale data. Happy to put a PR for this. @tugcekucukoglu thoughts?

@c-scholz
Copy link

Stumbled across this today, too. Fix would be appreciated.

@avramz
Copy link
Contributor

avramz commented Sep 16, 2024

Fix in PR :)

@tugcekucukoglu tugcekucukoglu added Type: Bug Issue contains a bug related to a specific component. Something about the component is not working and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Sep 24, 2024
@tugcekucukoglu tugcekucukoglu added this to the 4.1.0 milestone Sep 24, 2024
tugcekucukoglu added a commit that referenced this issue Sep 24, 2024
…e-locale

#6303 fix: Multiselect - correctly default to locale when selectedItemsLabel…
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants