Open cyberlp23 opened 5 years ago
@cyberlp23 Here is a working JSFiddle for you.
I notice 3 issues in your above code:
Your dict object should have the keys as strings, but you haven't written them as such. It should be enclosed within "
.
You have to instantiate the translate. After instantiating you should call the translate method.
var translator = $('body').translate({lang: "en", t: dict}); translator.lang("pt"); // Mention the language you want to translate to
Check the above fiddle I have shared. It should be of help to you.
Hello, Sorry, i'm not sure to understand how this works. Should I only add something like this? It doesn't seem to work. Well, it does recognize the right language defined in $('body').translate({lang: "en", t: dict}); , but nothing happens when clicking on the translation buttons. Also, do I need in the var dict to put the whole text of the variable, or can I use for example the id of an element? Thanks!