Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Use localize at any js file. #84

Open
dovvas opened this issue Jul 25, 2016 · 0 comments
Open

Use localize at any js file. #84

dovvas opened this issue Jul 25, 2016 · 0 comments

Comments

@dovvas
Copy link

dovvas commented Jul 25, 2016

I made some fixes and since it took me some time, would like to share for everyone to know.
On the jquery.localize.js simple declare a global variable the top of the file "var globallanguage;"
at the line somewhere around 183 where "lang" is declared simple after that, add the
"globallanguage=lang;"

Then you may go at any file you want and simple add the below code...

$("[data-localize]").localize("folder/where/your/json/file/is/",
{ language: globallanguage, //taking from localize.jquery
callback: function(data, defaultCallback)
{message = data.alert.incidentalert.MESSAGE;
defaultCallback(data);
}});
alert(message);

Now at the file with this code, you may use translated strings according to the language you have choosed.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant