Page 1 of 1

New Option/Plugin Request - Diacritic Letters

Posted: Mon May 05, 2008 1:22 pm
by Kisiel
Hi, everone! Before using AkelPad i tried many other standard windows notepad replacements.
Metapad, LitePad, Notepad2, Notepad++, FastPad - all those are better than standard windows notepad but AkelPad
linking the best functions from them to one useful program. However few great functions still aren't
added. So I'm begging for new option/plugin:

"Change Diacritic Letters"

example:
*Polish (in php code):

<?

function convert_polish_letters($str){
$trans = array(
"Ą" => "A",
"ą" => "a",
"Ć" => "C",
"ć" => "c",
"Ę" => "E",
"ę" => "e",
"Ł" => "L",
"ł" => "l",
"Ń" => "N",
"ń" => "n",
"Ó" => "O",
"ó" => "o",
"Ś" => "S",
"ś" => "s",
"Ź" => "Z",
"ź" => "z",
"Ż" => "Z",
"ż" => "z",
);
return strtr($str, $trans);
}
?>


---
I think it can be great option for diffrent language too.
Czech: á, é, í, ó, ú, ý, č, ď, ě, ň, ř, š, ť, ž, ů
Livonian: ā, ä, ǟ, ḑ, ē, ī, ļ, ņ, ō, ȯ, ȱ, õ, ȭ, ŗ, š, ț, ū, ž.
Latvian: ā, ē, ī, ū, ŗ, ļ, ķ, ņ, ģ, š, ž, č
and many others

for full diacritic letters go to:
http://en.wikipedia.org/wiki/Diacritic

Thanks for great program and sorry for my bad english ;)

Posted: Mon May 05, 2008 5:19 pm
by Infocatcher
Kisiel, try Scripts plugin and following script:

Code: Select all

var map = {
	"\u0104": "A",
	"\u0105": "a",
	"\u0106": "C",
	"\u0107": "c",
	"\u0118": "E",
	"\u0119": "e",
	"\u0141": "L",
	"\u0142": "l",
	"\u0143": "N",
	"\u0144": "n",
	"\u00D3": "O",
	"\u00F3": "o",
	"\u015A": "S",
	"\u015B": "s",
	"\u0179": "Z",
	"\u017A": "z",
	"\u017B": "Z",
	"\u017C": "z"
};

function replaceLetters(str) {
	for(var s in map)
		str = str.replace(new RegExp(s, "g"), map[s]);
	return str;
}

var AkelPad = new ActiveXObject("AkelPad.document");
AkelPad.ReplaceSel(
	replaceLetters(AkelPad.GetSelText())
);
For get "\u0104" I use JavaScript method escape:

Code: Select all

javascript: void(prompt('', escape('Ą')));
(copy this line in address bar of browser and press <enter>. JS in address bar not works in IE...)

Or you can use AkelPad for this:

Code: Select all

var AkelPad = new ActiveXObject("AkelPad.document");
AkelPad.ReplaceSel(
	escape(AkelPad.GetSelText())
);

Posted: Mon May 05, 2008 6:11 pm
by Kisiel
I already tryed to use 'Scripts plugin'
but whatever i try i get error occurted and akelpad close
I just reinstalled it to newest version with plugins but nothing changed.

First i think i deactivated vbs&js scripting in windows - thats not it.
Its strange because now i can't use any scrpit in akelpad.

Posted: Tue May 06, 2008 3:38 am
by Instructor
Kisiel
Check that Scripts plugin version is 3.2.