hcoz/react-context-multilang

JSON data with html tag

vivek-yes opened this issue · 2 comments

Is it possible to retrieve HTML tags from the language JSON? Example{ "exploreHeader": "< strong >Erkunden</ strong >" }.
Also Is it possible to change the language using link? Example < a href="#" >France< / a >

hcoz commented
  • Is it possible to retrieve HTML tags from the language JSON? Example{ "exploreHeader": "< strong >Erkunden</ strong >" }.
    You can use dictionary directly instead of Text component to achieve this. such as below:
    const { dictionary } = useContext(LanguageContext); <strong>{dictionary.exploreHeader}</strong>
    Please take a look at src/components/Explore.js for more details.

  • Also Is it possible to change the language using link? Example < a href="#" >France< / a >
    You can achieve this by modifying src/components/LanguageSelector.js component. Currently, it uses a select HTML element but I think it should be ul HTML element in your case.

Thanks hcoz for the reply, this library is very beneficial to me and perfectly satisfies my needs.

I actually have both Select(dropdown) and click(button) options on my page. Click will only have one particular country, while Select will have a vast list of countries. Any suggestions for this issue?

It will be beneficial if you include the button language switcher to your library.

Thanks in advance!