initialize() and setActiveLanguage() take some time
See original GitHub issueI need to fetch data via REST API according to the active language.
When I set the language using the standard Toggle component from the docs, and right after that send a query (parametrized using activeLanguage.code
) to the API, the old language still applies. It seems like setActiveLanguage()
(and intialize()
as well) takes a little time to finish and works async.
It would be great if there was either some way to determine when these methods finisch their jobs (may something like a JS Promise) or if you could tell them to run synchronously.
I’m using react 16.8.6 and react-localize-redux 3.5.2
I hope I didn’t miss something very basic.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:7 (3 by maintainers)
Top Results From Across the Web
getting-started – React Localize Redux Documentation
For your component to have access to the initialize prop you'll need to use the withLocalize higher-order component. Add translation data. To add...
Read more >UMLLanguageManager - IBM
Retrieves the language descriptor initialized with the given context. ... public IUMLLanguageDescriptor getActiveDescriptor().
Read more >[ABMaterial] 1.09 Localization using dynamic pages | B4X ...
As described in Part 1, dynamic pages was a must-have if you want to do ... The 'clientx' part is the param you...
Read more >Solved: What is the specific use of gr.initialize()? - ServiceNow
insert();. So, for current GlideRecord, is there no need for initialize function? Then why is gr.initialize() specifically used?
Read more >Index of all elements
HTML attributes of the select and the option tags; autoConv: in file I18Nv2.php, method I18Nv2::autoConv() Automatically transform output between character ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hey I have quite the same problem with addTranslation, here’s my use case :
I’m loading several translation files with get requests, use addTranslation for each of them, then set translationsLoaded to true when it’s all done.
Sadly, translationsLoaded is set to true before the translations are added.
Sadly I don’t have that much time right now. But simply put I have a class component, where I initialize your library using the
initialize()
method. When I log theactiveLanguage
prop every time my component gets rendered, the first log is alwaysundefined
while every following log correctly shows theactiveLanguage
object.