function getUrlVars()
{
var map = {};
var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) {
map[key] = value;
});
return map;
}
var urlVars = getUrlVars(); //call function
document.write(urlVars["lang"]); //this will write "en" to the document as in the above example
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script src="ckeditor/ckeditor.js" type="text/javascript"></script>
</head>
<body>
<textarea name="editor1"></textarea>
<script type="text/javascript">
window.onload = function ()
{
function getUrlVars()
{
var map = {};
var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function (m, key, value)
{
map[key] = value;
});
return map;
}
var urlVars = getUrlVars(); //get the lang from the GET variable "lang"
CKEDITOR.replace("editor1",
{
language: urlVars["lang"]
});
};
</script>
</body>
</html>
Re: how to set the localized language dynamically?
Re: how to set the localized language dynamically?
would you show me some code since im new the CKEditor, please?
thanks a lot
Re: how to set the localized language dynamically?
function getUrlVars() { var map = {}; var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) { map[key] = value; }); return map; }CKEDITOR.replace("editor1", { language: urlVars["lang"] });<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> <script src="ckeditor/ckeditor.js" type="text/javascript"></script> </head> <body> <textarea name="editor1"></textarea> <script type="text/javascript"> window.onload = function () { function getUrlVars() { var map = {}; var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function (m, key, value) { map[key] = value; }); return map; } var urlVars = getUrlVars(); //get the lang from the GET variable "lang" CKEDITOR.replace("editor1", { language: urlVars["lang"] }); }; </script> </body> </html>