-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Strings stored in constant values do not change on different language selection #118
Comments
Hi, you should provide some code to test your specific situation, otherwise I'm sorry but I'm unable to provide you with an answer... |
Hello @stefalda , For example, My util file for localization is like this:
I have a constant file like this:
It's corresponding language file for English is something like this:
Similarly its French file for language is this:
I use the pageName constant in my react component file as:
When I change my language from english to french using However, the strings directly used in the react component files do work properly as intended. |
Have you tried to do setState ()? |
Where do I need to setState to? I do not want to set my components to initial state. Also, I am tracking the state of a selected language |
You can just set a state without changing anything just to produce a redraw |
Force redraw doesn't work for me. For now as a workaround, I'm setting the strings as functions and calling them as functions at the place of use. This does solve the problem but does not look optimal. pages.js
my component file
|
hello,ayush-shta , I have the similar issue , had you figure this out or using the same approach as above |
I have some stings that are stored in a separate constant files.
I am able to set and see those strings on my page when the language is set to initial value. However, after I update the selected language using:
strings.setLanguage(language)
, the strings stored in the constants file are not changed for that respective language.Do I have to do anything specific to get the behavior I want, or is it not possible with this library?
The text was updated successfully, but these errors were encountered: