How do you translate the language from clicking from a list viewer?
Can you explain more clearly or give more details?
So when the user clicks the list viewer item, it sets the language so users can translate from that language.
See this demo project
Thanks @muneer but don’t really get what’s happening here.
Tell me which part you want me to explain and I’ll try my best to make it clearer.
How does the objects and the list things work? I’m a noob, so I don’t know much.
This block of the code is to make the list of available languages and once the user selects one the list becomes only the selected language
InitializeLang function is to create the objects of all components that I want to have difference languages for and for each component it gives the the text is different languages.
Whenever the user selects another language from the list the function
changeLang changes the text in the components to the text of the selected language.
This part of the object will store the selected language so that the next time the user uses the app it opens with the lastly selected language.
The object is a
stored variable so it will be stored on the user’s phone and will not be deleted when the app is closed.
Hope this makes it clear.
WOW! Thanks a lot @muneer.
Hope you don’t mind me asking more questions.
Ask whatever you want and I’ll try to answer whatever I know.
What is the difference between set property and create object?
create object is used to create/construct a new object from scratch and assign keys (properties) to the object and optionally assign values to the properties.
The created object can then be saved as
stored variable or in a table or in Firebase.
When it is the time to change the value of any property in the object you will use
set property. Which is used for existing object to change/update the value of certain properties inside the object.
@muneer, what does this do?(from my project)
I was just testing
When you select any item from the list this block will run and do the following:
If the variable
Language is not yet assigned then it will create an object and assign it to the variable
Otherwise it will do nothing.
Please note that for the object to be created the first time you need to initialize the variable
Language and assign it null.
Oh ok. Thanks.
But how do I make it function.
Please explain better what you want so I can suggest you what to do.