![]() |
![]() |
![]()
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? |
|
|
![]() ![]() |
![]() |
Aktualny czas: 24.08.2025 - 19:02 |