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

Changing the LocalizationHelper.strings does not show the custom strings #3151

Closed
Ofer-Gal opened this issue Mar 31, 2024 · 4 comments
Closed
Labels
bug Something isn't working Needs: Triage 🔍

Comments

@Ofer-Gal
Copy link

I added

LocalizationHelper.strings = {
  noResultsFound: "Not Found",
  _components: {
    "people-picker": {
      inputPlaceholderText: 'Search for Author',
      maxSelectionsPlaceHolder:'ok' 
    }
  }
};

Still shows the default values.

String name Default value
inputPlaceholderText Search for a name
maxSelectionsPlaceHolder Max contacts added

I use react in a SPFx webpart and MGT 4.2.1

            <PeoplePicker      type={'person'}  selectionMode={'single'} showMax={1}/>

Please help

@Ofer-Gal Ofer-Gal added bug Something isn't working Needs: Triage 🔍 labels Mar 31, 2024
@cdragosf
Copy link

cdragosf commented Apr 2, 2024

Hi, where did you put those lines of code, in wich file?

Try to put the code provided by you on the main .ts webpart file not .tsx
I have placed mine just after the last import {...} from "...."; line and out of the default webpart class.

Give it a try.

@Ofer-Gal
Copy link
Author

Ofer-Gal commented Apr 2, 2024

Thanks for the answer.
I moved it to the ...WebPart.ts after the last import {...} from "...."; line
I did not understand "and out of the default webpart class." did you mean the main TSX file? then I did. (not using classes)
Anyway it did not make a difference. Still shows the defaults.
Also,
I question the usability of having just one central setting.
For the "inputPlaceholderText" property I can use the controls "placeholder" property so each PeoplePicker will have its own message.
But for the "maxSelectionsPlaceHolder" There is no control property to specify but a developer may want a specific message for each PeoplePicker. Say "No more users" Vs "no more Guests"

Maybe I missed something?

I use 4.2.1 version now and it works 😂

@musale
Copy link
Contributor

musale commented May 14, 2024

I use 4.2.1 version now and it works 😂

@Ofer-Gal does this mean using the v4.2.1 fixed this?

@Ofer-Gal
Copy link
Author

Yes even if you have a different LocalizationHelper.strings for each component (*.tsx)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Needs: Triage 🔍
Projects
Status: Done ✔️
Development

No branches or pull requests

3 participants