Closed Giuseppetm closed 3 years ago
@UmbertoPirovano provided us a first version of translation from Italian to English.
We may already proceed with the development of the code to support this feature.
Option 2 here (html-react-parser): link
@manuelelucchi can you help with this one?
This is an example, how to handle the localization in json files? I was thinking on defining new field values like "it" and "en" in the json (description will be an array) so we can map the available languages we have and relate them to the json field values.
We should move away from JSON files imo
We should move away from JSON files imo
The server will always return a json, and the db must handle the translated fields, so.. 🙉🙉🙉
We should move away from JSON files imo
The server will always return a json, and the db must handle the translated fields, so.. 🙉🙉🙉
Then we need to adapt the JSON format for this use case.
I was thinking on defining new field values like "it" and "en" in the json (description will be an array) so we can map the available languages we have and relate them to the json field values.
Can we duplicate the JSON file for each language? By doing so we save bandwith
I was thinking on defining new field values like "it" and "en" in the json (description will be an array) so we can map the available languages we have and relate them to the json field values.
Can we duplicate the JSON file for each language? By doing so we save bandwith
The JSONs we need to translate are services and maybe extra groups. If we use multiple jsons we introduce redundancy and possibly inconsistency. The bandwith for the actual 2 jsons that we need to translate is minimal.
For the last bug reported: maybe it's because of the initial declaration of the state for the cookies. I should use something like: let [cookies, ] = useCookies();
Edit: this has been done in color palette switcher.
Note: html react parser doesn't work with custom react components, but only with pure html. This is not what I need, so I must find another package to parse from strings to components.
Maybe this one? : https://stackoverflow.com/questions/63256579/convert-string-to-html-on-react-rich-text-editor
Edit: we need to fix cookies behaviour on the branch master.
React-jsx-parser did the trick for parsing react components from string. https://github.com/TroyAlford/react-jsx-parser
Note for @manuelelucchi:
Sometimes the localization object is initialized as undefined. We must fix this error.
Edit: I probably fixed it.
The change not being globally has been fixed by using withCookies.
The user must be able to change the language of the website: the available ones should be english and italian.