ryandrewjohnson / react-localize-redux

Dead simple localization for your React components
https://ryandrewjohnson.github.io/react-localize-redux-docs/
MIT License
374 stars 88 forks source link

Performance with big translation file #211

Closed ghost closed 1 year ago

ghost commented 4 years ago

Do you want to request a feature or report a bug? Bug

What is the current behavior? So we have translation files over 70Kb each, noticed that inital website loading is stalled for 5 seconds, profiling shows that this is due to calls addTranslationForLanguage and getTranslationsForLanguage, 2 times each (for 2 languages loaded). Tried to load only 1 language, but getTranslationsForLanguage still called two times and each time takes around 700ms, despite the fact that only one language data available.

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem. Your bug will get fixed much faster if we can run your code. Paste the link to your JSFiddle (https://jsfiddle.net/Luktwrdm/) or CodeSandbox (https://codesandbox.io/s/new) example below:

What is the expected behavior? Would be good to be able to remove calls of getTranslationsForLanguage which loading nothing therefore improve initial loading time for website. Also would be good to know if such big files can be handled more effeciently.

Which versions of react and react-localize-redux are you using? react 16.13.1 react-localize-redux 2.13.7

ghost commented 1 year ago

Not working on that project anymore, so will be closing this issue.