0

How can I use the language selector (number 2 at image) of Patternfly LoginPage component?

enter image description here

At docs, the language selector dropdown appears in all the examples. However I can't figure out how to use it. I guess there should exist a property on LoginPage to render it but I can't find it.

I have checked the list of properties in the own code too, with no luck.

Rashomon
  • 5,962
  • 4
  • 29
  • 67
  • Your question is not clear, what's the problem you face? is the dropdown not working or do you want to know how to connect it to translations? – tp45 Jun 21 '22 at 08:08
  • I want to use the language selector of `LoginPage` component. It appears at docs but I cant find instructions on how to use it. – Rashomon Jun 21 '22 at 08:11

3 Answers3

1

Here you can find full example, with code example and all available props described.

Nemanja
  • 3,295
  • 11
  • 15
0

enter code hereI think they just help you with design you should do the rest

Use i18n to translate. https://react.i18next.com/latest/using-with-hooks

Try this https://lokalise.com/blog/how-to-internationalize-react-application-using-i18next/

tp45
  • 123
  • 4
  • 13
  • Thanks for your response. I know how to use `react-i18next`. I just want to use the patternfly language selector component to integrate it. – Rashomon Jun 21 '22 at 09:05
  • They are just dropdown lists so you can use click events to get the selected language then change translation like ```const handleOnclick=(e)=>{ e.preventDefault(); setLanguage(e.target.value); i18n.changeLanguage(e.target.value); }``` – tp45 Jun 21 '22 at 13:44
  • https://locize.com/blog/how-to-internationalize-react-i18next/#language-switcher – adrai Jun 21 '22 at 20:01
0

Seems that LoginPage React component property languageSelector has been removed from Patternfly. Docs are outdated.

Got following response in the github repository issues section:

Yes, I believe this had been removed a while ago as we were working through some design issues. However you can see a core HTML example that includes the language selector here: https://www.patternfly.org/v4/components/login-page/html#with-language-selector

Rashomon
  • 5,962
  • 4
  • 29
  • 67