Skip to content
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

Translate alert message #161

Open
jwebcode opened this issue May 24, 2018 · 4 comments
Open

Translate alert message #161

jwebcode opened this issue May 24, 2018 · 4 comments

Comments

@jwebcode
Copy link

Hello,
is it possible to translate alert(); messages?

Thanks in advance

@jwebcode
Copy link
Author

I've translated the alert(); messages, but i don't understand how to translate text in others file than the one who have $.i18n.load function.
How can i do it?
Thanks in advance,

@jwebcode jwebcode reopened this May 24, 2018
@yilinUnique
Copy link

yilinUnique commented Aug 14, 2019

You can extract a method like this in common file:

function updateText(doI18n) {
	var i18n = $.i18n();
	i18n.locale = "zh-CN";
	var path = "i18n/zh-CN.json";
	i18n.load(path, i18n.locale).done(doI18n ? doI18n : console.log("callback does not exist"));
}

Then in which file you want to translate, use updateText() at the entry function:

$(function(
	updateText();
));
alert($.i18n("message"));

@pushpanjali-10
Copy link

I want to work on this, Please assign me

@draunger
Copy link

draunger commented Jan 6, 2024

Assign me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants