![]() |
![]() |
![]()
Post
#1
|
|
Grupa: Zarejestrowani Postów: 210 Pomógł: 0 Dołączył: 31.01.2004 Skąd: Kraków Ostrzeżenie: (0%) ![]() ![]() |
Witam
Chciałem zainstalować sobie skrypt phpspell. Skrypt jest już na serwerze, słownik podłączony. Problem jest tylko ze zmuszeniem go do pracy z polskimi czcionkami... Zdaje się, że wystarczy tylko edytować jeden plik odpowiedzialny za dany język. Dla przykładu podam angielski i rosyjski: Angielski: Kod <?php // -------------------------------------------------------------------- // phpSpell Language Template // // This is (c)Copyright 2002, 2003, Team phpSpell. // -------------------------------------------------------------------- // -------------------------- // Table Name // -------------------------- $DB_TableName=$table_prefix."spelling_words"; // Language Text $Language_Text = array('Scanned %d words. Found %d words to be corrected.'); $Language_Javascript = array('Checking Document...','No misspellings found','OK','Cancel','Spell Check Completed','Correct','All','Ignore','Learn','Suggest','Definition','Thesaurus','Word correction','No Suggestions'); // Prefix Database name for MSSQL tables // if ($dbms == "mssql") { // $DB_TableName = $dbname.".".$DB_TableName; // } // --------------------------------------- // PSPELL Support - Use English Dictionary // --------------------------------------- $Spell_Config["PSPELL_LANGUAGE"] = "en"; // -------------------------------------------------------------------- // Example translation table: // $Translation_Table = array("Ŕ", "Ć", "Ç"); // $Replacement_Table = array("a", "an", "sth"); // $Language_Translation_Character_List = "ŔĆÇ"; // -------------------------------------------------------------------- // for every "Ŕ" it finds in a word it will replace it with a "a" // for every "Ç" it finds it will replace it with a "sth" // for every "Ć" it finds it will replace it with a "an" // -------------------------------------------------------------------- // Put the character(s) to be translated into the Translation_Table // Put the replacement character(s) into the replacement table // -------------------------------------------------------------------- // The replacement string should be equivelent to the ENGLISH PHONETIC // sound. So if you were to take a word with "Ŕ" in it; how would you // phonetically spell the word in english. If the "Ŕ" sounds like a "A" // in english then "A" would be the replacement character. // If it sounds like "th" then you would use "th" as the characters. // always replace Larger groups first. (i.e. if "ńń" sounds differently // than "ń" then in the translation table you would have the "ńń" listed // before the "ń". So that way when it would replaced the "ńń" before it // replaced it twice with "ń". // -------------------------------------------------------------------- // Any letters you do not translate will be IGNORED for // when it attempts to find spelling matches!!! // -------------------------------------------------------------------- $Translation_Table = array(); $Replacement_Table = array(); // -------------------------------------------------------------------- // Put the list of valid characters in your language in this list // -------------------------------------------------------------------- $Language_Character_List = "abcdefghijklmnopqrstuvwxyz'"; $Language_Common_Words = ",the,is,was,be,are,were,been,being,am,of,and,a,an,in,inside,to,have,has,had, having,he,him,his,it,its,i,me,my,to,they,their,not,no,for,you,your,she,her,with,o n,that,these,this,those,do,did,does,done,doing,we,us,our,by,at,but,from,as,which, or,will,said,say,says,saying,would,what,there,if,can,who,whose,so,go,gone,went,go es,more,other,another,one,see,saw,seen,seeing,know,knew,known,knows,knowing,there ,"; // -------------------------------------------------------------------- // Translation function // -------------------------------------------------------------------- function Translate_Word($Word) { return ($Word); } // -------------------------------------------------------------------- // Phonetic work function // -------------------------------------------------------------------- function Word_Sound_Function($Word) { return (metaphone($Word)); } function Language_Decode(&$Data) { // MS Internet Explorer Hack -- IE sends utf8-unicode for upper (ascii 128+) characters if (strpos(@$_SERVER['HTTP_USER_AGENT'], 'MSIE') > 0 || strpos(@$_SERVER['ALL_HTTP'], 'MSIE') > 0) { if (function_exists('utf8_decode')) $Data = utf8_decode($Data); } return ($Data); } function Language_Encode(&$Data) { return ($Data); } function Language_Lower(&$Data) { return(strtolower($Data)); } function Language_Upper(&$Data) { return(strtoupper($Data)); } ?> Rosyjski: Kod <?php // -------------------------------------------------------------------- // phpSpell Language Template // // This is (c)Copyright 2002, 2003 Team phpSpell. // -------------------------------------------------------------------- // -------------------------- // Table Name // -------------------------- $DB_TableName="russian_spelling_words"; $Meta_Language = "windows-1251"; // Language Text (Recommend that they are converted to HTML entities - that way they should display in all browsers properly) $Language_Text = array('Scanned %d words. Found %d words to be corrected.'); $Language_Javascript = array('Проверка текста', 'Нет ошибок', 'OK', 'Отменить', 'Нет предложени', 'Исправить', 'Все', 'Пропустить', 'Learn','Suggest','Definition','Thesaurus', 'Правка слова', 'No Suggestions'); // --------------------------------------- // PSPELL Support - Use English Dictionary // --------------------------------------- $Spell_Config["PSPELL_LANGUAGE"] = "ru"; // -------------------------------------------------------------------- // Example translation table: // $Translation_Table = array("Ŕ", "Ć", "Ç"); // $Replacement_Table = array("a", "an", "sth"); // $Language_Translation_Character_List = "ŔĆÇ"; // -------------------------------------------------------------------- // for every "Ŕ" it finds in a word it will replace it with a "a" // for every "Ç" it finds it will replace it with a "sth" // for every "Ć" it finds it will replace it with a "Ć" // -------------------------------------------------------------------- // Put the character(s) to be translated into the Translation_Table // Put the replacement character(s) into the replacement table // -------------------------------------------------------------------- // The replacement string should be equivelent to the ENGLISH PHONETIC // sound. So if you were to take a word with "Ŕ" in it; how would you // phonetically spell the word in english. If the "Ŕ" sounds like a "A" // in english then "A" would be the replacement character. // If it sounds like "th" then you would use "th" as the characters. // always replace Larger groups first. (i.e. if "ńń" sounds differently // than "ń" then in the translation table you would have the "ńń" listed // before the "ń". So that way when it would replaced the "ńń" before it // replaced it twice with "ń". // -------------------------------------------------------------------- // Any letters you do not translate will be IGNORED for // when it attempts to find spelling matches!!! // -------------------------------------------------------------------- $Translation_Table = array("ŕ", "á", "â", "ă", "ä", "ĺ", "¸", "ć", "ç", "č", "é", "ę", "ë", "ě", "í", "î", "ď", "đ", "ń", "ň", "ó", "ô", "ő", "ö", "÷", "ř", "ů", "ű", "ý", "ţ", "˙", "ü"); $Replacement_Table = array("a", "b", "v", "g", "d", "e", "o", "j", "z", "i", "y", "k", "l", "m", "n", "o", "p", "r", "s", "t", "u", "f", "kh", "ts", "ch", "sh", "shch", "i", "e", "u", "a", ""); $Language_Translation_Character_List = "ŕáâăäĺ¸ćçčéęëěíîďđńňóôőö÷řůűýţ˙"; // -------------------------------------------------------------------- // Put the list of valid characters in your language in this list // -------------------------------------------------------------------- $Language_Character_List = "ŕáâăäĺ¸ćçčéęëěíîďđńňóôőö÷řůúűüýţ˙"; // -------------------------------------------------------------------- // Put the list of most common words in this list ",word,word,word," // -------------------------------------------------------------------- $Language_Common_Words = ",ŕ,áĺç,áîëĺĺ,áű,áűë,áűëŕ,áűëč,áűëî,áűňü,â,âŕě,âŕń,âĺńü,âî,âîň,âńĺ,âńĺăî,âńĺő ,âű,ăäĺ,äŕ,äŕćĺ,äë˙,äî,ĺăî,ĺĺ,ĺńëč,ĺńňü,ĺůĺ,ćĺ,çŕ,çäĺńü,č,čç,čëč,čě,čő,ę,ęŕę,ęî,ę îăäŕ,ęňî,ëč,ëčáî,ěíĺ,ěîćĺň,ěű,íŕ,íŕäî,íŕř,íĺ,íĺăî,íĺĺ,íĺň,íč,íčő,íî,íó,î,îá,îäíŕę î,îí,îíŕ,îíč,îíî,îň,î÷ĺíü,ďî,ďîä,ďđč,ń,ńî,ňŕę,ňŕęćĺ,ňŕęîé,ňŕě,ňĺ,ňĺě,ňî,ňîăî,ňîćĺ ,ňîé,ňîëüęî,ňîě,ňű,ó,óćĺ,őîň˙,÷ĺăî,÷ĺé,÷ĺě,÷ňî,÷ňîáű,÷üĺ,÷ü˙,ýňŕ,ýňč,ýňî,˙,ä,ĺ,¸, ć,ç,é,ë,ě,í,đ,ň,ô,ő,ö,÷,ř,ů,ű,ý,ţ,"; // -------------------------------------------------------------------- // Translation function // -------------------------------------------------------------------- function Translate_Word($Word) { global $Translation_Table, $Replacement_Table; $New_Word = str_replace($Translation_Table, $Replacement_Table, $Word); // echo "New: $New_Word<br>"; return ($New_Word); } // -------------------------------------------------------------------- // Phonetic work function // -------------------------------------------------------------------- function Word_Sound_Function($Word) { return (metaphone($Word)); } // Based off of the code by bn2@ukr.net function Language_Decode($Data) { global $Encode_Type; $Output=''; $FirstByte=''; $MultiByte=false; $Counter = strlen($Data); $Pos1 = strpos($Data, '
'); $Pos2 = strpos($Data, ''); if ($Pos1 !== false || $Pos2 !== false) { if ($Pos1 === false) $Pos1 = $Pos2; if ($Data[$Pos1+6] == ';') { $Encode_Type = 2; if (version_compare("4.3.2", phpversion(), "<=")) { $Output = html_entity_decode($Data, ENT_NOQUOTES, "cp1251"); } else { echo "<!-- Second -->"; // $Output = myhtml_entity_decode($Data); } } } if ($Encode_Type == 0) { for ($i=0;$i<$Counter;$i++) { $Code = ord($Data[$i]); if ($Code <= 127) $Output .= $Data[$i]; else { if ($MultiByte) { $Conv_2=($FirstByte&3)*64+($Code&63); $Conv_1=($FirstByte>>2)&5; $Converted=$Conv_1*256+$Conv_2; if ($Converted==1025) $NewCharacter=168; else if ($Converted==1105) $NewCharacter=184; else $NewCharacter=$Converted-848; $Output.=chr($NewCharacter); $MultiByte=false; } else if (($Code>>5)==6) { $Encode_Type = 1; $FirstByte=$Code; $MultiByte=true; } else $Output .= $Data[$i]; } } } return $Output; } function Language_Encode($Data) { global $Encode_Type; if ($Encode_Type == 0) return ($Data); $Output = ''; if ($Encode_Type == 3) { $Count = strlen($Data); for ($i=0;$i<$Count;$i++) { $Byte = ord($Data[$i]); if ($Byte <= 127) $Output .= $Data[$i]; else if ($Byte >= 192 && $Byte <= 239) $Output .= chr(208).chr($Byte-48); else if ($Byte >= 240 && $Byte <= 255) $Output .= chr(209).chr($Byte-112); else if ($Byte == 184) $Output .= chr(209).chr(209); else if ($Byte == 168) $Output .= chr(208).chr(129); } } if ($Encode_Type == 2 || $Encode_Type == 1) { // || $Encode_Type == 1) { if (version_compare("4.3.2", phpversion(), "<=")) { $Output = htmlentities($Data, ENT_NOQUOTES, "cp1251"); } else { $Output = $Data; // $Output = myhtml_entity_encode($Data); } } return ($Output); } function Language_Upper(&$Data) { $New_Data = strtoupper($Data); return ($New_Data); } function Language_Lower(&$Data) { // Translate $New_Data = strtr($Data, '×ߨ','÷˙¸'); $New_Data = strtolower($New_Data); return ($New_Data); } ?> ten plik może być źle wyświetlany ze względu na inne kodowanie Czy mógłby mi ktoś podpowiedzieć jak powinien wyglądać taki plik dla polskiego słownika? |
|
|
![]() |
![]()
Post
#2
|
|
Grupa: Zarejestrowani Postów: 8 Pomógł: 0 Dołączył: 10.08.2005 Ostrzeżenie: (0%) ![]() ![]() |
Też chciałbym polski słownik do spell-a
Jeśli ktoś ma - bardzo będę wdzięczny... pozdrawiam |
|
|
![]() ![]() |
![]() |
Aktualny czas: 7.10.2025 - 13:02 |