locked
localization setup on react RRS feed

  • Question

  • User1034446946 posted

    I am looking to localize my site, i would prefer not to use static files, to allow the localization to be controller from a database, but i can't find any good examples.

    My main concern are my storage considerations for the client, i know what localstorage is and state, but i have very little experience and i am worried about the impact and other considerations, putting all my resource references into one or the other.

    I can find lots of resources with simple examples but nothing with greater info to help me understand it better.

    Any suggests would be appriciated.

    Tuesday, September 10, 2019 8:59 PM

Answers

All replies

  • User61956409 posted

    Hi EnenDaveyBoy,

    EnenDaveyBoy

    I am looking to localize my site, i would prefer not to use static files, to allow the localization to be controller from a database

    It seems that you'd like to store your language specific data in database instead of in static file (such as json or .js file), and you want to dynamically and programmatically supply these language specific data for localization module. If that is the case, you can create a back-end service for retrieve language specific data from database and consume it from your react app to dynamically populate and supply expected data for localization module function(s).

    With Regards,  

    Fei Han

    Wednesday, September 11, 2019 2:57 AM
  • User1034446946 posted

    thanks for the info, but my concern isn't the backend integrations its the front end considerations.

    Like should i download all the resource references at the sametime in one api call,which could be 1000+ references (although each one would be small), or just do them as the page is requested, which would lead to more api calls.

    and then what the best storage practice, should i hold the information in state,which would lead to one extra component level (not a massive issue) but would mean i would need to request the resourses every request, or hold the information in localstorage or session storage.

    Wednesday, September 11, 2019 2:36 PM
  • User-474980206 posted

    not sure why you are not using a supported method like  react-intl and babel/webpack as a helper.

    https://www.codeandweb.com/babeledit/tutorials/how-to-translate-your-react-app-with-react-intl

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, September 12, 2019 3:26 PM
  • User1034446946 posted

    i hadn't found it while searching tbh, i had been searching for localization not translation and it didn't show up.

    Thanks for the link.

    Thursday, September 12, 2019 4:40 PM